anthill
Class Neighbour

java.lang.Object
  |
  +--anthill.Neighbour
All Implemented Interfaces:
Serializable

public class Neighbour
extends Object
implements Serializable

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: 1.8 $
Author:
Alberto Montresor
See Also:
Serialized Form

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(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 getNestId()
          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.
 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

getNestId

public NestId getNestId()
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(Object obj)
Check whether this LocalNid is equal to the specified object.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object