anthill
Class Neighbour

java.lang.Object
  |
  +--anthill.Neighbour

public class Neighbour
extends java.lang.Object

Class Neighbour contains the information related to another nest related to another nest. The information stored in Neighbour objects include the identifier of the neighbour nest, the communication cost and the reachability status.

Version:
$Revision$
Author:
Alberto Montresor

Constructor Summary
Neighbour(NestId id)
          Constructs a new neighbour with the given identifier.
Neighbour(NestId id, float cost, boolean reachable)
          Constructs a new neighbour with the given identifier and with the specified additional parameters.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Check whether this LocalNid is equal to the specified object.
 float getCost()
          Returns a float value representing the cost of communication with this neighbor.
 NestId getId()
          Returns the nest identifier of the neighbour
 int hashCode()
          Returns a hash code value for the object.
 boolean isReachable()
          Returns true if this neghbour is considered reachable.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Neighbour

public Neighbour(NestId id)
Constructs a new neighbour with the given identifier.
Parameters:
id - identifier of the neighbour nest

Neighbour

public Neighbour(NestId id,
                 float cost,
                 boolean reachable)
Constructs a new neighbour with the given identifier and with the specified additional parameters.
Parameters:
id - identifier of the neighbour nest
cost - the cost of the connection
reachable - true if the neighbor nest is reachable
Method Detail

getId

public NestId getId()
Returns the nest identifier of the neighbour

getCost

public float getCost()
Returns a float value representing the cost of communication with this neighbor.

isReachable

public boolean isReachable()
Returns true if this neghbour is considered reachable.

equals

public boolean equals(java.lang.Object obj)
Check whether this LocalNid is equal to the specified object.
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns a hash code value for the object.
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object