Class DataModelList

All Implemented Interfaces:
DataModel, KnowledgeTransferable, VariableSource, TetradSerializable, Serializable, Iterable<DataModel>, Collection<DataModel>, List<DataModel>

public final class DataModelList extends AbstractList<DataModel> implements DataModel
Stores a list of data models and keeps track of which one is selected.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • DataModelList

      public DataModelList()

      Constructor for DataModelList.

    • DataModelList

      public DataModelList(DataModelList dataModelList)

      Constructor for DataModelList.

      Parameters:
      dataModelList - a DataModelList object
  • Method Details

    • serializableInstance

      public static DataModelList serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a DataModelList object
    • get

      public DataModel get(int index)
      Specified by:
      get in interface List<DataModel>
      Specified by:
      get in class AbstractList<DataModel>
    • size

      public int size()
      Specified by:
      size in interface Collection<DataModel>
      Specified by:
      size in interface List<DataModel>
      Specified by:
      size in class AbstractCollection<DataModel>
    • getVariables

      public List<Node> getVariables()

      getVariables.

      Specified by:
      getVariables in interface VariableSource
      Returns:
      a List object
    • getKnowledge

      public Knowledge getKnowledge()

      Getter for the field knowledge.

      Specified by:
      getKnowledge in interface KnowledgeTransferable
      Returns:
      a Knowledge object
    • setKnowledge

      public void setKnowledge(Knowledge knowledge)
      Sets knowledge to a copy of the given object.
      Specified by:
      setKnowledge in interface KnowledgeTransferable
      Parameters:
      knowledge - the knowledge to set
    • getVariableNames

      public List<String> getVariableNames()

      getVariableNames.

      Specified by:
      getVariableNames in interface VariableSource
      Returns:
      the list of variable names for columns, in order.
    • add

      public void add(int index, DataModel element)
      Adds the given DataModel to the list at the given index. Required for AbstractList.
      Specified by:
      add in interface List<DataModel>
      Overrides:
      add in class AbstractList<DataModel>
      Parameters:
      index - the index at which the DataModel is to be added.
      element - the DataModel to be added. (Note that this must be a DataModel.)
    • isEmpty

      public boolean isEmpty()

      Check if the modeList is empty Need to override this since this class is extending AbstractList.

      Specified by:
      isEmpty in interface Collection<DataModel>
      Specified by:
      isEmpty in interface List<DataModel>
      Overrides:
      isEmpty in class AbstractCollection<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

      public List<DataModel> getModelList()

      Getter for the field modelList.

      Returns:
      a List object
    • remove

      public DataModel remove(int index)

      Removes the DataModel at the given index. Required for AbstractList. Required for AbstractList.

      Specified by:
      remove in interface List<DataModel>
      Overrides:
      remove in class AbstractList<DataModel>
    • getSelectedModel

      public DataModel 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

      public void setSelectedModel(DataModel model)

      Setter for the field selectedModel.

      Parameters:
      model - a DataModel object
    • getName

      public String getName()
      Gets the name of the data model list.
      Specified by:
      getName in interface DataModel
      Returns:
      a String object
    • setName

      public void setName(String name)
      Sets the name of the data model (may be null).

      Sets the name of the data model list..

      Specified by:
      setName in interface DataModel
      Parameters:
      name - the name to set
    • toString

      public String toString()

      toString.

      Specified by:
      toString in interface DataModel
      Overrides:
      toString in class AbstractCollection<DataModel>
      Returns:
      a string representation of the data model list.
    • isContinuous

      public boolean isContinuous()

      isContinuous.

      Specified by:
      isContinuous in interface DataModel
      Returns:
      true if the data model is continuous, false otherwise.
    • isDiscrete

      public boolean isDiscrete()

      isDiscrete.

      Specified by:
      isDiscrete in interface DataModel
      Returns:
      true if the data model is discrete, false otherwise.
    • isMixed

      public boolean isMixed()

      isMixed.

      Specified by:
      isMixed in interface DataModel
      Returns:
      true if the data model is mixed continuous/discrete, false otherwise.
    • getVariable

      public Node getVariable(String name)

      getVariable.

      Specified by:
      getVariable in interface DataModel
      Parameters:
      name - a String object
      Returns:
      the variable with the given name, or null if no such variable exists.
    • copy

      public DataModel copy()

      copy.

      Specified by:
      copy in interface DataModel
      Returns:
      a copy of the data model.
    • hashCode

      public int hashCode()

      hashCode.

      Specified by:
      hashCode in interface Collection<DataModel>
      Specified by:
      hashCode in interface List<DataModel>
      Overrides:
      hashCode in class AbstractList<DataModel>
      Returns:
      a int
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Collection<DataModel>
      Specified by:
      equals in interface List<DataModel>
      Overrides:
      equals in class AbstractList<DataModel>