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 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()booleanget(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.inthashCode()booleanbooleanbooleanisEmpty()Check if the modeList is empty Need to override this since this class is extending AbstractList.booleanisMixed()remove(int index) Removes the DataModel at the given 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 list..voidsetSelectedModel(DataModel model) intsize()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, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
sizein interfaceCollection<DataModel>- Specified by:
sizein interfaceList<DataModel>- Specified by:
sizein classAbstractCollection<DataModel>- Returns:
- the size of the getModel list. Required for AbstractList.
-
getVariables
Description copied from interface:VariableSourceReturns the list of variables associated with this object.- Specified by:
getVariablesin interfaceVariableSource- Returns:
- the list of variables associated with this object.
-
getKnowledge
- Specified by:
getKnowledgein interfaceKnowledgeTransferable- Returns:
- a copy of the knowledge for this class.
-
setKnowledge
Description copied from interface:KnowledgeTransferableSets knowledge to a copy of the given object.- Specified by:
setKnowledgein interfaceKnowledgeTransferable
-
getVariableNames
Description copied from interface:VariableSourceReturns the variable names associated with this 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 -
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:DataModelRenders the data model as as String.- Specified by:
toStringin interfaceDataModel- Overrides:
toStringin classAbstractCollection<DataModel>- Returns:
- a string representation of the data model list.
-
isContinuous
public boolean isContinuous()- Specified by:
isContinuousin interfaceDataModel
-
isDiscrete
public boolean isDiscrete()- Specified by:
isDiscretein interfaceDataModel
-
isMixed
public boolean isMixed() -
getVariable
- Specified by:
getVariablein interfaceDataModel
-
copy
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<DataModel>- Specified by:
hashCodein interfaceList<DataModel>- Overrides:
hashCodein classAbstractList<DataModel>
-
equals
- Specified by:
equalsin interfaceCollection<DataModel>- Specified by:
equalsin interfaceList<DataModel>- Overrides:
equalsin classAbstractList<DataModel>
-