Package edu.cmu.tetrad.data
Class DataModelList
- All Implemented Interfaces:
DataModel
,KnowledgeTransferable
,VariableSource
,TetradSerializable
,Serializable
,Iterable<DataModel>
,Collection<DataModel>
,List<DataModel>
Stores a list of data models and keeps track of which one is selected.
- Author:
- josephramsey
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given DataModel to the list at the given index.boolean
Use this to check if the dataModelList only contains the default empty dataset that is being used to populat the empty spreadsheet - Added by Kevincopy()
boolean
get
(int index) getName()
Gets the name of the data model list.getVariable
(String name) Returns the variable names associated with this getVariableNames.Returns the list of variables associated with this object.int
hashCode()
boolean
boolean
boolean
isEmpty()
Check if the modeList is empty Need to override this since this class is extending AbstractList.boolean
isMixed()
remove
(int index) Removes the DataModel at the given index.static DataModelList
Generates a simple exemplar of this class to test serialization.void
setKnowledge
(Knowledge knowledge) Sets knowledge to a copy of the given object.void
Sets the name of the data model list..void
setSelectedModel
(DataModel model) int
size()
toString()
Renders the data model as as String.Methods inherited from class java.util.AbstractList
add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
DataModelList
public DataModelList() -
DataModelList
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization. -
get
-
size
public int size()- Specified by:
size
in interfaceCollection<DataModel>
- Specified by:
size
in interfaceList<DataModel>
- Specified by:
size
in classAbstractCollection<DataModel>
- Returns:
- the size of the getModel list. Required for AbstractList.
-
getVariables
Description copied from interface:VariableSource
Returns the list of variables associated with this object.- Specified by:
getVariables
in interfaceVariableSource
- Returns:
- the list of variables associated with this object.
-
getKnowledge
- Specified by:
getKnowledge
in interfaceKnowledgeTransferable
- Returns:
- a copy of the knowledge for this class.
-
setKnowledge
Description copied from interface:KnowledgeTransferable
Sets knowledge to a copy of the given object.- Specified by:
setKnowledge
in interfaceKnowledgeTransferable
-
getVariableNames
Description copied from interface:VariableSource
Returns the variable names associated with this getVariableNames.- Specified by:
getVariableNames
in interfaceVariableSource
- Returns:
- the list of variable names for columns, in order.
-
add
Adds the given DataModel to the list at the given index. Required for AbstractList. -
isEmpty
public boolean isEmpty()Check if the modeList is empty Need to override this since this class is extending AbstractList.- Specified by:
isEmpty
in interfaceCollection<DataModel>
- Specified by:
isEmpty
in interfaceList<DataModel>
- Overrides:
isEmpty
in classAbstractCollection<DataModel>
-
containsEmptyData
public boolean containsEmptyData()Use this to check if the dataModelList only contains the default empty dataset that is being used to populat the empty spreadsheet - Added by Kevin -
getModelList
-
remove
Removes the DataModel at the given index. Required for AbstractList. Required for AbstractList. -
getSelectedModel
- Returns:
- the model that is currently selected. The default is the first model. If there are no models in the list, null is returned.
-
setSelectedModel
-
getName
Gets the name of the data model list. -
setName
Sets the name of the data model list.. -
toString
Description copied from interface:DataModel
Renders the data model as as String.- Specified by:
toString
in interfaceDataModel
- Overrides:
toString
in classAbstractCollection<DataModel>
- Returns:
- a string representation of the data model list.
-
isContinuous
public boolean isContinuous()- Specified by:
isContinuous
in interfaceDataModel
-
isDiscrete
public boolean isDiscrete()- Specified by:
isDiscrete
in interfaceDataModel
-
isMixed
public boolean isMixed() -
getVariable
- Specified by:
getVariable
in interfaceDataModel
-
copy
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<DataModel>
- Specified by:
hashCode
in interfaceList<DataModel>
- Overrides:
hashCode
in classAbstractList<DataModel>
-
equals
- Specified by:
equals
in interfaceCollection<DataModel>
- Specified by:
equals
in interfaceList<DataModel>
- Overrides:
equals
in classAbstractList<DataModel>
-