Class ContinuousVariable

java.lang.Object
edu.cmu.tetrad.data.AbstractVariable
edu.cmu.tetrad.data.ContinuousVariable
All Implemented Interfaces:
Variable, Node, TetradSerializable, Serializable, Comparable<Node>

public final class ContinuousVariable extends AbstractVariable implements Variable
Represents a real-valued variable. The values are doubles, and the default missing value marker for is Double.NaN.
Author:
Willie Wheeler 07/99, josephramsey modifications 12/00
See Also:
  • Constructor Details

    • ContinuousVariable

      public ContinuousVariable(String name)
      Constructs a new continuous variable with the given name.
      Parameters:
      name - the name of the variable.
    • ContinuousVariable

      public ContinuousVariable(ContinuousVariable variable)
      Copy constructor.
  • Method Details

    • serializableInstance

      public static ContinuousVariable serializableInstance()
      Generates a simple exemplar of this class to test serialization.
    • getDoubleMissingValue

      public static double 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

      public boolean checkValue(Object value)
      Checks the value to make sure it's a legitimate value for this column.
      Specified by:
      checkValue in interface Variable
      Overrides:
      checkValue in class AbstractVariable
      Parameters:
      value - the value to check.
      Returns:
      true iff the value is legitimate.
    • like

      public Node like(String name)
      Description copied from interface: Node
      Creates a new node of the same type as this one with the given name.
      Specified by:
      like in interface Node
      Specified by:
      like in class AbstractVariable
      Parameters:
      name - the name of the new node.
      Returns:
      the new node.
    • getMissingValueMarker

      public Object getMissingValueMarker()
      Description copied from interface: Variable
      Returns the name of the variable.
      Specified by:
      getMissingValueMarker in interface Variable
      Specified by:
      getMissingValueMarker in class AbstractVariable
      Returns:
      the missing value marker, wrapped as a Double.
    • isMissingValue

      public boolean isMissingValue(Object value)
      Determines whether the argument is equal to the missing value marker.
      Specified by:
      isMissingValue in interface Variable
      Specified by:
      isMissingValue in class AbstractVariable
      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.
    • hashCode

      public int hashCode()
      Description copied from interface: Node
      Removes a property change listener.
      Specified by:
      hashCode in interface Node
      Overrides:
      hashCode in class Object
      Returns:
      a hashcode for this variable.
    • equals

      public boolean equals(Object o)
      Two continuous variables are equal if they have the same name and the same missing value marker.
      Specified by:
      equals in interface Node
      Overrides:
      equals in class Object
      Returns:
      true iff this variable is equal to the given variable.
    • getNodeType

      public NodeType getNodeType()
      Description copied from interface: Node
      Returns the node type for this node.
      Specified by:
      getNodeType in interface Node
      Returns:
      the node type for this node.
    • setNodeType

      public void setNodeType(NodeType nodeType)
      Description copied from interface: Node
      Sets the node type for this node.
      Specified by:
      setNodeType in interface Node
      Parameters:
      nodeType - the node type for this node.
    • getCenterX

      public int getCenterX()
      Description copied from interface: Node
      Returns the x coordinate of the center of this node.
      Specified by:
      getCenterX in interface Node
      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.
      Specified by:
      setCenterX in interface Node
      Parameters:
      centerX - This coordinate.
    • getCenterY

      public int getCenterY()
      Description copied from interface: Node
      Returns the y coordinate of the center of this node.
      Specified by:
      getCenterY in interface Node
      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.
      Specified by:
      setCenterY in interface Node
      Parameters:
      centerY - This coordinate.
    • setCenter

      public void setCenter(int centerX, int centerY)
      Sets the (x, y) coordinates of the center of this node.
      Specified by:
      setCenter in interface Node
      Parameters:
      centerX - The x coordinate.
      centerY - The y coordinate.
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener l)
      Adds a property change listener.
      Specified by:
      addPropertyChangeListener in interface Node
      Parameters:
      l - This listener.
    • getNodeVariableType

      public NodeVariableType getNodeVariableType()
      Description copied from interface: Node
      Returns the node shape for this node.
      Specified by:
      getNodeVariableType in interface Node
      Returns:
      the intervention type
    • setNodeVariableType

      public void setNodeVariableType(NodeVariableType nodeVariableType)
      Description copied from interface: Node
      Sets the type (domain, interventional status, interventional value..) for this node variable
      Specified by:
      setNodeVariableType in interface Node
      Parameters:
      nodeVariableType - the type (domain, interventional status, interventional value..) for this node variable
    • getAllAttributes

      public Map<String,Object> getAllAttributes()
      Specified by:
      getAllAttributes in interface Node
    • getAttribute

      public Object getAttribute(String key)
      Specified by:
      getAttribute in interface Node
    • removeAttribute

      public void removeAttribute(String key)
      Specified by:
      removeAttribute in interface Node
    • addAttribute

      public void addAttribute(String key, Object value)
      Specified by:
      addAttribute in interface Node