bees.core
Class Neighborhood
java.lang.Object
|
+--bees.core.Neighborhood
- Direct Known Subclasses:
- MulticastNeighborhood, RedundantNeighborhood
- public abstract class Neighborhood
- extends java.lang.Object
A Neighborhood is a collection of neighbors that a single capsule can be
sent to.
Field Summary |
protected bees.core.CapsuleEncoder |
ce
The CapsuleEncoder used to marshal capsules. |
protected java.util.Vector |
neighbors
The set of neighbors to send capsules to. |
protected Node |
node
The current node. |
Constructor Summary |
Neighborhood()
Construct an empty Neighborhood. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
node
protected final Node node
- The current node.
neighbors
protected final java.util.Vector neighbors
- The set of neighbors to send capsules to.
ce
protected final bees.core.CapsuleEncoder ce
- The CapsuleEncoder used to marshal capsules.
Neighborhood
public Neighborhood()
- Construct an empty Neighborhood.
addNeighbor
public void addNeighbor(NeighborImpl neighbor)
- Parameters:
neighbor
- The neighbor to add to the neighborhood.
removeNeighbor
public void removeNeighbor(NeighborImpl neighbor)
- Parameters:
neighbor
- The neighbor to remove from the neighborhood.
elements
public NeighborImpl[] elements()
- Returns:
- An array containing all the NeighborImpl's in the neighborhood.
size
public int size()
- Returns:
- The number of neighbors in the neighborhood.
send
public abstract void send(Capsule cap)
throws EncodingException,
java.io.IOException
- Parameters:
cap
- The capsule to send to the elements of the Neighborhood.- Throws:
EncodingException
- if there was a problem encoding the Capsule.java.io.IOException
- if there was a problem sending the Capsule.
handleRevokedNeighbor
public void handleRevokedNeighbor(NeighborImpl ni)
- Call back used to handle a revoked neighbor.
- Parameters:
e
- The received exception.
handleSendException
public void handleSendException(java.io.IOException e)
- Call back used to handle IOException during a send. The default simply
prints out the exception and moves on.
- Parameters:
e
- The received exception.
handleSendException
public void handleSendException(PermissionException e)
- Call back used to handle a PermissionException during a send. The
default simply prints out the exception and moves on.
- Parameters:
e
- The received exception.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
- See Also:
Object.toString()
This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/