Class GraphNode

java.lang.Object
edu.cmu.tetrad.graph.GraphNode
All Implemented Interfaces:
Node, TetradSerializable, Serializable, Comparable<Node>

public class GraphNode extends Object implements Node
Implements a basic node in a graph--that is, a node that is not itself a variable.
Version:
$Id: $Id
Author:
josephramsey, Willie Wheeler
See Also:
  • Constructor Details

    • GraphNode

      public GraphNode(String name)
      Constructs a new Tetrad node with the given (non-null) string.
      Parameters:
      name - a String object
    • GraphNode

      public GraphNode(GraphNode node)
      Copy constructor.
      Parameters:
      node - a GraphNode object
  • Method Details

    • serializableInstance

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

      public final String getName()

      Getter for the field name.

      Specified by:
      getName in interface Node
      Returns:
      the name of the variable.
    • setName

      public final void setName(String name)
      Sets the name of this node.

      Sets the name of this variable.

      Specified by:
      setName in interface Node
      Parameters:
      name - the name of this node.
    • getNodeType

      public final NodeType getNodeType()

      Getter for the field nodeType.

      Specified by:
      getNodeType in interface Node
      Returns:
      the node type.
      See Also:
    • setNodeType

      public final void setNodeType(NodeType nodeType)
      Sets the node type for this node.

      Sets the node type.

      Specified by:
      setNodeType in interface Node
      Parameters:
      nodeType - the node type for this node.
      See Also:
    • getCenterX

      public final int getCenterX()

      Getter for the field centerX.

      Specified by:
      getCenterX in interface Node
      Returns:
      the x coordinate of the center of the node.
    • setCenterX

      public final 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:
      setCenterX in interface Node
      Parameters:
      centerX - This coordinate.
    • getCenterY

      public final int getCenterY()

      Getter for the field centerY.

      Specified by:
      getCenterY in interface Node
      Returns:
      the y coordinate of the center of the node.
    • setCenterY

      public final 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:
      setCenterY in interface Node
      Parameters:
      centerY - This coordinate.
    • setCenter

      public final 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.

      Specified by:
      setCenter in interface Node
      Parameters:
      centerX - The x coordinate.
      centerY - The y coordinate.
    • addPropertyChangeListener

      public final void addPropertyChangeListener(PropertyChangeListener l)
      Adds a property change listener.

      Adds a property change listener.

      Specified by:
      addPropertyChangeListener in interface Node
      Parameters:
      l - This listener.
    • toString

      public String toString()

      toString.

      Specified by:
      toString in interface Node
      Overrides:
      toString in class Object
      Returns:
      the name of the node as its string representation.
    • hashCode

      public int hashCode()

      hashCode.

      Specified by:
      hashCode in interface Node
      Overrides:
      hashCode in class Object
      Returns:
      a int
    • equals

      public boolean equals(Object o)
      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.

      Specified by:
      equals in interface Node
      Overrides:
      equals in class Object
      Parameters:
      o - a Object object
      Returns:
      true iff this variable is equal to the given variable.
    • like

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

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

      public void setNodeVariableType(NodeVariableType nodeVariableType)
      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()

      getAllAttributes.

      Specified by:
      getAllAttributes in interface Node
      Returns:
      a Map object
    • getAttribute

      public Object getAttribute(String key)

      getAttribute.

      Specified by:
      getAttribute in interface Node
      Parameters:
      key - a String object
      Returns:
      a Object object
    • removeAttribute

      public void removeAttribute(String key)

      removeAttribute.

      Specified by:
      removeAttribute in interface Node
      Parameters:
      key - a String object
    • addAttribute

      public void addAttribute(String key, Object value)

      addAttribute.

      Specified by:
      addAttribute in interface Node
      Parameters:
      key - a String object
      value - a Object object