Package edu.cmu.tetrad.data
Class DataModelList
- All Implemented Interfaces:
DataModel
,KnowledgeTransferable
,VariableSource
,TetradSerializable
,Serializable
,Iterable<DataModel>
,Collection<DataModel>
,List<DataModel>
,SequencedCollection<DataModel>
Stores a list of data models and keeps track of which one is selected.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for DataModelList.DataModelList
(DataModelList dataModelList) Constructor for DataModelList. -
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()
copy.boolean
get
(int index) Getter for the fieldknowledge
.Getter for the fieldmodelList
.getName()
Gets the name of the data model list.Getter for the fieldselectedModel
.getVariable
(String name) getVariable.getVariableNames.getVariables.int
hashCode()
hashCode.boolean
isContinuous.boolean
isDiscrete.boolean
isEmpty()
boolean
isMixed()
isMixed.remove
(int 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 (may be null).void
setSelectedModel
(DataModel model) Setter for the fieldselectedModel
.int
size()
toString()
toString.Methods inherited from class java.util.AbstractList
add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, set, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Constructor Details
-
DataModelList
public DataModelList()Constructor for DataModelList.
-
DataModelList
Constructor for DataModelList.
- Parameters:
dataModelList
- aDataModelList
object
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
DataModelList
object
-
get
-
size
public int size()- Specified by:
size
in interfaceCollection<DataModel>
- Specified by:
size
in interfaceList<DataModel>
- Specified by:
size
in classAbstractCollection<DataModel>
-
getVariables
getVariables.
- Specified by:
getVariables
in interfaceVariableSource
- Returns:
- a
List
object
-
getKnowledge
Getter for the field
knowledge
.- Specified by:
getKnowledge
in interfaceKnowledgeTransferable
- Returns:
- a
Knowledge
object
-
setKnowledge
Sets knowledge to a copy of the given object.- Specified by:
setKnowledge
in interfaceKnowledgeTransferable
- Parameters:
knowledge
- the knowledge to set
-
getVariableNames
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- Returns:
- a boolean
-
getModelList
-
remove
-
getSelectedModel
Getter for the field
selectedModel
.- 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
-
setName
-
toString
-
isContinuous
public boolean isContinuous()isContinuous.
- Specified by:
isContinuous
in interfaceDataModel
- Returns:
- true if the data model is continuous, false otherwise.
-
isDiscrete
public boolean isDiscrete()isDiscrete.
- Specified by:
isDiscrete
in interfaceDataModel
- Returns:
- true if the data model is discrete, false otherwise.
-
isMixed
-
getVariable
getVariable.
- Specified by:
getVariable
in interfaceDataModel
- Parameters:
name
- aString
object- Returns:
- the variable with the given name, or null if no such variable exists.
-
copy
-
hashCode
public int hashCode()hashCode.
- Specified by:
hashCode
in interfaceCollection<DataModel>
- Specified by:
hashCode
in interfaceList<DataModel>
- Overrides:
hashCode
in classAbstractList<DataModel>
- Returns:
- a int
-
equals
- Specified by:
equals
in interfaceCollection<DataModel>
- Specified by:
equals
in interfaceList<DataModel>
- Overrides:
equals
in classAbstractList<DataModel>
-