Class AbstractNode

java.lang.Object
es.upm.fi.cig.multictbnc.nodes.AbstractNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
DiscreteStateNode

public abstract class AbstractNode extends Object implements Node
Abstract class defining common variables and methods for any kind of node.
  • Constructor Details

    • AbstractNode

      public AbstractNode(String name)
      Common initialisation for nodes. This constructor initialises the node as not being a class variable, a type of variable that does not appear in those models that are not meant for classification.
      Parameters:
      name - name of the node
    • AbstractNode

      public AbstractNode(String name, boolean isClassVariable)
      Common initialisation for nodes. This constructor allows specifying if the node is a class variable.
      Parameters:
      name - name of the node
      isClassVariable - true if the node represents a class variable, false otherwise
  • Method Details

    • clearParentAndChildrenSets

      public void clearParentAndChildrenSets()
      Description copied from interface: Node
      Remove the set of parents and children of the node. This method should be used with caution, as references to this node from others will not be affected. It is recommended its use when creating an empty PGM, i.e., we are removing all edges between nodes.
      Specified by:
      clearParentAndChildrenSets in interface Node
    • getChildren

      public List<Node> getChildren()
      Description copied from interface: Node
      Returns the children of the node.
      Specified by:
      getChildren in interface Node
      Returns:
      child node list
    • getName

      public String getName()
      Description copied from interface: Node
      Returns the name of the node.
      Specified by:
      getName in interface Node
      Returns:
      node name
    • getNumParents

      public int getNumParents()
      Description copied from interface: Node
      Returns the number of parents of the node.
      Specified by:
      getNumParents in interface Node
      Returns:
      parent node list
    • getParents

      public List<Node> getParents()
      Description copied from interface: Node
      Returns the parents of the node.
      Specified by:
      getParents in interface Node
      Returns:
      parent node list
    • hasChildren

      public boolean hasChildren()
      Description copied from interface: Node
      Specifies if the node has children.
      Specified by:
      hasChildren in interface Node
      Returns:
      true if the node has children, false otherwise
    • hasParents

      public boolean hasParents()
      Description copied from interface: Node
      Specifies if the node has parents.
      Specified by:
      hasParents in interface Node
      Returns:
      true if the node has parents, false otherwise
    • hasClassVariableAsParent

      public boolean hasClassVariableAsParent()
      Description copied from interface: Node
      Specifies if the node has a class variable as parent.
      Specified by:
      hasClassVariableAsParent in interface Node
      Returns:
      true if the node has a class variable as parent, false otherwise
    • hasClassVariableAsSpouse

      public boolean hasClassVariableAsSpouse()
      Description copied from interface: Node
      Specifies if the node has a class variable as spouse.
      Specified by:
      hasClassVariableAsSpouse in interface Node
      Returns:
      true if the node has a class variable as spouse, false otherwise
    • isInMarkovBlanketClassVariable

      public boolean isInMarkovBlanketClassVariable()
      Description copied from interface: Node
      Specifies if the node is in the Markov blanket of at least one class variable.
      Specified by:
      isInMarkovBlanketClassVariable in interface Node
      Returns:
      true if the node is in the Markov blanket of a class variable, false otherwise
    • isDisconnected

      public boolean isDisconnected()
      Description copied from interface: Node
      Specifies if the node is disconnected, i.e., it has neither parents or children.
      Specified by:
      isDisconnected in interface Node
      Returns:
      true if the node is disconnected, false otherwise
    • isClassVariable

      public void isClassVariable(boolean isClassVariable)
      Description copied from interface: Node
      Defines if the node is a class variable.
      Specified by:
      isClassVariable in interface Node
      Parameters:
      isClassVariable - true if the node is a class variable, false otherwise
    • isClassVariable

      public boolean isClassVariable()
      Description copied from interface: Node
      Specifies if the node is a class variable.
      Specified by:
      isClassVariable in interface Node
      Returns:
      true if the node is a class variable, false otherwise
    • removeAllEdges

      public void removeAllEdges()
      Description copied from interface: Node
      Removes the parents and children of the node.
      Specified by:
      removeAllEdges in interface Node
    • removeChild

      public void removeChild(Node nodeChild)
      Description copied from interface: Node
      Removes a certain child of the node.
      Specified by:
      removeChild in interface Node
      Parameters:
      nodeChild - child node
    • removeChildren

      public void removeChildren()
      Description copied from interface: Node
      Removes the children of the node.
      Specified by:
      removeChildren in interface Node
    • removeParent

      public void removeParent(Node nodeParent)
      Description copied from interface: Node
      Removes a certain parent of the node.
      Specified by:
      removeParent in interface Node
      Parameters:
      nodeParent - parent node
    • removeParents

      public void removeParents()
      Description copied from interface: Node
      Removes the parents of the node.
      Specified by:
      removeParents in interface Node
    • setChild

      public void setChild(Node nodeChild)
      Description copied from interface: Node
      Defines a provided node as a child of this one.
      Specified by:
      setChild in interface Node
      Parameters:
      nodeChild - child node
    • setParent

      public void setParent(Node nodeParent)
      Description copied from interface: Node
      Defines a provided node as a parent of this one.
      Specified by:
      setParent in interface Node
      Parameters:
      nodeParent - parent node
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object