java.lang.Object
es.upm.fi.cig.multictbnc.nodes.AbstractNode
- All Implemented Interfaces:
Node
- Direct Known Subclasses:
DiscreteStateNode
Abstract class defining common variables and methods for any kind of node.
-
Constructor Summary
ConstructorDescriptionAbstractNode
(String name) Common initialisation for nodes.AbstractNode
(String name, boolean isClassVariable) Common initialisation for nodes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Remove the set of parents and children of the node.boolean
Returns the children of the node.getName()
Returns the name of the node.int
Returns the number of parents of the node.Returns the parents of the node.boolean
Specifies if the node has children.boolean
Specifies if the node has a class variable as parent.boolean
Specifies if the node has a class variable as spouse.int
hashCode()
boolean
Specifies if the node has parents.boolean
Specifies if the node is a class variable.void
isClassVariable
(boolean isClassVariable) Defines if the node is a class variable.boolean
Specifies if the node is disconnected, i.e., it has neither parents or children.boolean
Specifies if the node is in the Markov blanket of at least one class variable.void
Removes the parents and children of the node.void
removeChild
(Node nodeChild) Removes a certain child of the node.void
Removes the children of the node.void
removeParent
(Node nodeParent) Removes a certain parent of the node.void
Removes the parents of the node.void
Defines a provided node as a child of this one.void
Defines a provided node as a parent of this one.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface es.upm.fi.cig.multictbnc.nodes.Node
areParametersEstimated, estimateLogLikelihood, setSufficientStatistics
-
Constructor Details
-
AbstractNode
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
Common initialisation for nodes. This constructor allows specifying if the node is a class variable.- Parameters:
name
- name of the nodeisClassVariable
- 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 interfaceNode
-
getChildren
Description copied from interface:Node
Returns the children of the node.- Specified by:
getChildren
in interfaceNode
- Returns:
- child node list
-
getName
Description copied from interface:Node
Returns the name of the node. -
getNumParents
public int getNumParents()Description copied from interface:Node
Returns the number of parents of the node.- Specified by:
getNumParents
in interfaceNode
- Returns:
- parent node list
-
getParents
Description copied from interface:Node
Returns the parents of the node.- Specified by:
getParents
in interfaceNode
- Returns:
- parent node list
-
hasChildren
public boolean hasChildren()Description copied from interface:Node
Specifies if the node has children.- Specified by:
hasChildren
in interfaceNode
- 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 interfaceNode
- 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 interfaceNode
- 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 interfaceNode
- 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 interfaceNode
- 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 interfaceNode
- 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 interfaceNode
- 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 interfaceNode
- 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 interfaceNode
-
removeChild
Description copied from interface:Node
Removes a certain child of the node.- Specified by:
removeChild
in interfaceNode
- Parameters:
nodeChild
- child node
-
removeChildren
public void removeChildren()Description copied from interface:Node
Removes the children of the node.- Specified by:
removeChildren
in interfaceNode
-
removeParent
Description copied from interface:Node
Removes a certain parent of the node.- Specified by:
removeParent
in interfaceNode
- Parameters:
nodeParent
- parent node
-
removeParents
public void removeParents()Description copied from interface:Node
Removes the parents of the node.- Specified by:
removeParents
in interfaceNode
-
setChild
Description copied from interface:Node
Defines a provided node as a child of this one. -
setParent
Description copied from interface:Node
Defines a provided node as a parent of this one. -
hashCode
public int hashCode() -
equals
-
toString
-