Package edu.cmu.tetrad.data
Class AbstractVariable
java.lang.Object
edu.cmu.tetrad.data.AbstractVariable
- All Implemented Interfaces:
Variable
,Node
,TetradSerializable
,Serializable
,Comparable<Node>
- Direct Known Subclasses:
ContinuousVariable
,DiscreteVariable
Base class for variable specifications for DataSet. These objects govern the types of values which may be recorded in
a Column of data and provide information about the interpretation of these values. Variables of every type must
provide a marker which is recorded in a column of data for that variable when the value is missing; this missing data
marker should not be used for other purposes.
- Author:
- Willie Wheeler 7/99, josephramsey modifications 12/00
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkValue
(Object value) Checks to see whether the passed value is an acceptable value for this variable.abstract Object
Returns the name of the variable.final String
getName()
Returns the name of this node.abstract boolean
isMissingValue
(Object value) Tests whether the given value is the missing data marker.abstract Node
Creates a new node of the same type as this one with the given name.final void
Sets the name of this variable.toString()
Returns the intervention type for this node.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.cmu.tetrad.graph.Node
addAttribute, addPropertyChangeListener, compareTo, equals, getAllAttributes, getAttribute, getCenterX, getCenterY, getNodeType, getNodeVariableType, hashCode, removeAttribute, setCenter, setCenterX, setCenterY, setNodeType, setNodeVariableType
-
Field Details
-
LAST_ID
public static int LAST_IDThe last ID assigned to a variable.
-
-
Method Details
-
getMissingValueMarker
Description copied from interface:Variable
Returns the name of the variable.- Specified by:
getMissingValueMarker
in interfaceVariable
- Returns:
- the missing value marker as an Object.
-
isMissingValue
Tests whether the given value is the missing data marker.- Specified by:
isMissingValue
in interfaceVariable
- Parameters:
value
- The object value one wants to check as a missing value.- Returns:
- true iff the given object is equals to
getMissingValueMarker()
.
-
getName
Description copied from interface:Node
Returns the name of this node. -
setName
Sets the name of this variable. -
checkValue
Checks to see whether the passed value is an acceptable value for this variable. For AbstractVariable, this method always returns true. Subclasses should override checkValue() in order to provide for subclass-specific value checking. The value should pass the test if it can be converted into an equivalent object of the correct class type (see getValueClass()) for this variable; otherwise, it should fail. In general, checkValue() should not fail a value for simply not being an instance of a particular class. Since this method is not static, subclasses may (but need not) provide for instance-specific value checking.- Specified by:
checkValue
in interfaceVariable
- Parameters:
value
- a value- Returns:
- true if the value is an acceptable value for this variable, and false otherwise
-
toString
Description copied from interface:Node
Returns the intervention type for this node. -
like
Description copied from interface:Node
Creates a new node of the same type as this one with the given name.
-