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 TypeMethodDescriptionvoidAdds the given DataModel to the list at the given index.booleanUse 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.booleanget(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.inthashCode()hashCode.booleanisContinuous.booleanisDiscrete.booleanisEmpty()booleanisMixed()isMixed.remove(int index) static DataModelListGenerates a simple exemplar of this class to test serialization.voidsetKnowledge(Knowledge knowledge) Sets knowledge to a copy of the given object.voidSets the name of the data model (may be null).voidsetSelectedModel(DataModel model) Setter for the fieldselectedModel.intsize()toString()toString.Methods inherited from class java.util.AbstractList
add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArrayMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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- aDataModelListobject
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
DataModelListobject
-
get
-
size
public int size()- Specified by:
sizein interfaceCollection<DataModel>- Specified by:
sizein interfaceList<DataModel>- Specified by:
sizein classAbstractCollection<DataModel>
-
getVariables
getVariables.
- Specified by:
getVariablesin interfaceVariableSource- Returns:
- a
Listobject
-
getKnowledge
Getter for the field
knowledge.- Specified by:
getKnowledgein interfaceKnowledgeTransferable- Returns:
- a
Knowledgeobject
-
setKnowledge
Sets knowledge to a copy of the given object.- Specified by:
setKnowledgein interfaceKnowledgeTransferable- Parameters:
knowledge- the knowledge to set
-
getVariableNames
getVariableNames.
- Specified by:
getVariableNamesin 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:
isEmptyin interfaceCollection<DataModel>- Specified by:
isEmptyin interfaceList<DataModel>- Overrides:
isEmptyin 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
Getter for the field
modelList.- Returns:
- a
Listobject
-
remove
Removes the DataModel at the given index. Required for AbstractList. Required for AbstractList.
-
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
Setter for the field
selectedModel.- Parameters:
model- aDataModelobject
-
getName
Gets the name of the data model list. -
setName
Sets the name of the data model (may be null).Sets the name of the data model list..
-
toString
toString.
- Specified by:
toStringin interfaceDataModel- Overrides:
toStringin classAbstractCollection<DataModel>- Returns:
- a string representation of the data model list.
-
isContinuous
public boolean isContinuous()isContinuous.
- Specified by:
isContinuousin interfaceDataModel- Returns:
- true if the data model is continuous, false otherwise.
-
isDiscrete
public boolean isDiscrete()isDiscrete.
- Specified by:
isDiscretein interfaceDataModel- Returns:
- true if the data model is discrete, false otherwise.
-
isMixed
public boolean isMixed()isMixed.
-
getVariable
getVariable.
- Specified by:
getVariablein interfaceDataModel- Parameters:
name- aStringobject- Returns:
- the variable with the given name, or null if no such variable exists.
-
copy
copy.
-
hashCode
public int hashCode()hashCode.
- Specified by:
hashCodein interfaceCollection<DataModel>- Specified by:
hashCodein interfaceList<DataModel>- Overrides:
hashCodein classAbstractList<DataModel>- Returns:
- a int
-
equals
- Specified by:
equalsin interfaceCollection<DataModel>- Specified by:
equalsin interfaceList<DataModel>- Overrides:
equalsin classAbstractList<DataModel>
-