ca.ualberta.cs.poker.free.server
Class Node

java.lang.Object
  extended by ca.ualberta.cs.poker.free.server.Node

public class Node
extends java.lang.Object

Node represents a node in a directed graph, where each node has a unique id, a list of parents, and a list of children, and optionally a name. In poker tournament form this is going to keep track of matches needing to be run, which are in progress and the outcome of finished matches


Constructor Summary
Node()
          Default constructor.
Node(TournamentTree g)
          Constructor that takes a DirectedGraph, and retrieves from it the next node ID.
 
Method Summary
 void annihilateChildren()
           
 java.util.List getChildren()
          getChildren returns a List of the children of the Node.
 TournamentTree getContainer()
           
 int getID()
          getID returns the unique node id number of this node
 java.lang.String getName()
          getName returns the name of Node
 java.util.List getNeighbours()
           
 java.util.List getParents()
          getParents returns a List of the parents of the Node.
 boolean hasChildren()
          hasChildren determines if the Node has any children
 boolean hasNeighbours()
           
 boolean hasParents()
          hasParents determines if the Node has any parents
 void setID(int id)
           
 void setName(java.lang.String string)
          setName sets the name of the Node to the specified String
 void setParents(java.util.List list)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node()
Default constructor. Creates a new Node and initalizes storage of data members.


Node

public Node(TournamentTree g)
Constructor that takes a DirectedGraph, and retrieves from it the next node ID.

Parameters:
g - DirectedGraph from which a Node ID is retrieved.
Method Detail

getChildren

public java.util.List getChildren()
getChildren returns a List of the children of the Node. That is, for each Node in the list of children, there exists a directed edge from this Node to the child. If the Node has no children, an empty ArrayList is returned.

Returns:
a List of DirectedNodes which are children of this Node

getID

public int getID()
getID returns the unique node id number of this node

Returns:
the id of the Node

setID

public void setID(int id)

getParents

public java.util.List getParents()
getParents returns a List of the parents of the Node. That is, for each Node in the list of parents, there exists a directed edge from the parent to this Node. If the Node has no parents, an empty ArrayList is returned.

Returns:
a List of DirectedNodes which are parents of this Node

annihilateChildren

public void annihilateChildren()

hasParents

public boolean hasParents()
hasParents determines if the Node has any parents

Returns:
true if the Node has any parents, false otherwise

hasChildren

public boolean hasChildren()
hasChildren determines if the Node has any children

Returns:
turn if the Node has any children, false otherwise

getName

public java.lang.String getName()
getName returns the name of Node

Returns:
the name of the Node

setName

public void setName(java.lang.String string)
setName sets the name of the Node to the specified String

Parameters:
string - the name that the Node is to be given

getNeighbours

public java.util.List getNeighbours()

hasNeighbours

public boolean hasNeighbours()

getContainer

public TournamentTree getContainer()

setParents

public void setParents(java.util.List list)
Parameters:
list -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object