Class NeighList

java.lang.Object
  extended by NeighList

public class NeighList
extends java.lang.Object


Constructor Summary
NeighList(int nbNodes)
          Initialisation constructor
 
Method Summary
 void addNeighbor(int node1, int node2)
          Add a new neighbor to a node
 void addNode()
           
 int chooseNeighbor(int node)
          Return a random node of a node neighborhood
 void deleteNeighbor(int node1, int node2)
          Delete a neighbor of a node
 int getNbNeighbor(int node1)
          Return the number of neighbor of a node
 int getNbNodes()
          Return the number of nodes
 boolean isNeighbor(int node1, int node2)
          Return if a node is neighbor of an other node
 java.lang.String toString()
          Return a string which represent the content of the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NeighList

public NeighList(int nbNodes)
Initialisation constructor

Parameters:
nbNodes - number of nodes
Method Detail

getNbNodes

public int getNbNodes()
Return the number of nodes

Returns:
number of nodes

getNbNeighbor

public int getNbNeighbor(int node1)
Return the number of neighbor of a node

Parameters:
node1 - node which you want the neighbor number
Returns:
number of neighbor

addNode

public void addNode()

addNeighbor

public void addNeighbor(int node1,
                        int node2)
Add a new neighbor to a node

Parameters:
node1 - node which has the new neighbor
node2 - the new neighbor

deleteNeighbor

public void deleteNeighbor(int node1,
                           int node2)
Delete a neighbor of a node

Parameters:
node1 - the node that we want retrive the neighbor
node2 - the neighbor

isNeighbor

public boolean isNeighbor(int node1,
                          int node2)
Return if a node is neighbor of an other node

Parameters:
node1 - node that we observe the neighborhood
node2 - node which you want to search into the neighborhood of node1

chooseNeighbor

public int chooseNeighbor(int node)
Return a random node of a node neighborhood

Parameters:
node - neighborhood of this node
Returns:
node choosen

toString

public java.lang.String toString()
Return a string which represent the content of the list

Overrides:
toString in class java.lang.Object
Returns:
String