Class ContinuousVariable
- All Implemented Interfaces:
Variable,Node,TetradSerializable,Serializable,Comparable<Node>
- Version:
- $Id: $Id
- Author:
- Willie Wheeler 07/99, josephramsey modifications 12/00
- See Also:
-
Field Summary
Fields inherited from class edu.cmu.tetrad.data.AbstractVariable
LAST_ID -
Constructor Summary
ConstructorsConstructorDescriptionContinuousVariable(ContinuousVariable variable) Copy constructor.ContinuousVariable(String name) Constructs a new continuous variable with the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, Object value) addAttribute.voidAdds a property change listener.booleancheckValue(Object value) Checks to see whether the passed value can be converted into a value for this variable.booleanTests whether this variable is equal to the given variable.getAllAttributes.getAttribute(String key) getAttribute.intGetter for the fieldcenterX.intGetter for the fieldcenterY.static doublegetDoubleMissingValue.getMissingValueMarker.Getter for the fieldnodeType.Returns the node shape for this node.intgetRank()Returns the rank, or -1 if no rank is set.booleanReturns the selection bias status for this node.inthashCode()hashCode.static booleanisDoubleMissingValue(double value) Determines whether the argument is equal to the missing value marker.booleanisMissingValue(Object value) Tests whether the given value is the missing data marker.Creates a new node of the same type as this one with the given name.voidremoveAttribute(String key) removeAttribute.static ContinuousVariableGenerates a simple exemplar of this class to test serialization.voidsetCenter(int centerX, int centerY) Sets the (x, y) coordinates of the center of this node.voidsetCenterX(int centerX) Sets the x coordinate of the center of this node.voidsetCenterY(int centerY) Sets the y coordinate of the center of this node.voidsetNodeType(NodeType nodeType) Sets the node type for this node.voidsetNodeVariableType(NodeVariableType nodeVariableType) Sets the type (domain, interventional status, interventional value..) for this node variablevoidsetRank(int rank) Sets the rank for this variable.Methods inherited from class edu.cmu.tetrad.data.AbstractVariable
getName, setName, setSelectionBias, toStringMethods inherited from interface edu.cmu.tetrad.graph.Node
compareTo, getDisplayName, getName, setName, setSelectionBias, toString
-
Constructor Details
-
ContinuousVariable
Constructs a new continuous variable with the given name.- Parameters:
name- the name of the variable.
-
ContinuousVariable
Copy constructor.- Parameters:
variable- aContinuousVariableobject
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- a
ContinuousVariableobject
-
getDoubleMissingValue
public static double getDoubleMissingValue()getDoubleMissingValue.
- Returns:
- the missing value marker.
-
isDoubleMissingValue
public static boolean isDoubleMissingValue(double value) Determines whether the argument is equal to the missing value marker.- Parameters:
value- the Object to test--should be a wrapped version of the missing value marker.- Returns:
- true iff it really is a wrapped version of the missing value marker.
-
checkValue
Checks to see whether the passed value can be converted into a value for this variable.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.
Checks the value to make sure it's a legitimate value for this column.
- Specified by:
checkValuein interfaceVariable- Overrides:
checkValuein classAbstractVariable- Parameters:
value- The object value to be checked. For instance, for a continuous variable, this would be a Double, for a discrete variable, and Integer, etc.- Returns:
- true iff the object is a valid value for this variable.
-
like
Creates a new node of the same type as this one with the given name.- Specified by:
likein interfaceNode- Specified by:
likein classAbstractVariable- Parameters:
name- the name of the new node.- Returns:
- the new node.
-
getMissingValueMarker
getMissingValueMarker.
- Specified by:
getMissingValueMarkerin interfaceVariable- Specified by:
getMissingValueMarkerin classAbstractVariable- Returns:
- the missing value marker, wrapped as a Double.
-
isMissingValue
Tests whether the given value is the missing data marker.Tests whether the given value is the missing data marker.
Determines whether the argument is equal to the missing value marker.
- Specified by:
isMissingValuein interfaceVariable- Specified by:
isMissingValuein classAbstractVariable- Parameters:
value- The object value one wants to check as a missing value.- Returns:
- true iff the given object is equals to
getMissingValueMarker().
-
hashCode
public int hashCode()hashCode.
-
equals
Tests whether this variable is equal to the given variable.Two continuous variables are equal if they have the same name and the same missing value marker.
-
getRank
public int getRank()Description copied from interface:NodeReturns the rank, or -1 if no rank is set. -
setRank
public void setRank(int rank) Sets the rank for this variable. The rank must be either -1 (indicating no rank is set) or a non-negative integer value.- Specified by:
setRankin interfaceNode- Parameters:
rank- the rank to set; must be -1 or greater than or equal to 0- Throws:
IllegalArgumentException- if the rank is less than -1
-
getNodeType
Getter for the field
nodeType.- Specified by:
getNodeTypein interfaceNode- Returns:
- a
NodeTypeobject
-
setNodeType
Sets the node type for this node.- Specified by:
setNodeTypein interfaceNode- Parameters:
nodeType- the node type for this node.
-
getSelectionBias
public boolean getSelectionBias()Description copied from interface:NodeReturns the selection bias status for this node.- Specified by:
getSelectionBiasin interfaceNode- Returns:
- the selection bias status for this node.
-
getCenterX
public int getCenterX()Getter for the field
centerX.- Specified by:
getCenterXin interfaceNode- Returns:
- the x coordinate of the center of the node.
-
setCenterX
public void setCenterX(int centerX) Sets the x coordinate of the center of this node.Sets the x coordinate of the center of this node.
- Specified by:
setCenterXin interfaceNode- Parameters:
centerX- This coordinate.
-
getCenterY
public int getCenterY()Getter for the field
centerY.- Specified by:
getCenterYin interfaceNode- Returns:
- the y coordinate of the center of the node.
-
setCenterY
public void setCenterY(int centerY) Sets the y coordinate of the center of this node.Sets the y coordinate of the center of this node.
- Specified by:
setCenterYin interfaceNode- Parameters:
centerY- This coordinate.
-
setCenter
public void setCenter(int centerX, int centerY) Sets the (x, y) coordinates of the center of this node.Sets the (x, y) coordinates of the center of this node.
-
addPropertyChangeListener
Adds a property change listener.Adds a property change listener.
- Specified by:
addPropertyChangeListenerin interfaceNode- Parameters:
l- This listener.
-
getNodeVariableType
Returns the node shape for this node.- Specified by:
getNodeVariableTypein interfaceNode- Returns:
- the intervention type
-
setNodeVariableType
Sets the type (domain, interventional status, interventional value..) for this node variable- Specified by:
setNodeVariableTypein interfaceNode- Parameters:
nodeVariableType- the type (domain, interventional status, interventional value..) for this node variable
-
getAllAttributes
getAllAttributes.
- Specified by:
getAllAttributesin interfaceNode- Returns:
- a
Mapobject
-
getAttribute
getAttribute.
- Specified by:
getAttributein interfaceNode- Parameters:
key- aStringobject- Returns:
- a
Objectobject
-
removeAttribute
removeAttribute.
- Specified by:
removeAttributein interfaceNode- Parameters:
key- aStringobject
-
addAttribute
addAttribute.
- Specified by:
addAttributein interfaceNode- Parameters:
key- aStringobjectvalue- aObjectobject
-