Fairness.Nodes
Class NodePacket

java.lang.Object
  extended by Fairness.Nodes.NodePacket

public class NodePacket
extends java.lang.Object

NodePacket represents packets in the fairness simulation. It is intended that NodePackets are always routed and passed to children nodes even if in the simulated network they are not "sent" at all or even "lost". This is the reason for the existance of the lost and send flags. If a NodePacket arrives successfully at its destination it is considered to be a live packet.


Constructor Summary
NodePacket(Node source, int stripeId, boolean lost, boolean sent, int size)
          Constructs a new NodePacket
 
Method Summary
 int getSize()
          Returns this packet's size in bytes.
 Node getSource()
          Returns the source of this packet, or null if the source is the publisher.
 int getStripeId()
          Returns the stripe ID for this packet
 boolean isLive()
          Returns true if this packet was not lost and was sent.
 boolean isLost()
          Returns true if this packet is being simulated as a lost packet.
 boolean isSent()
          Returns true if this packet is being simulated as having been purposefully sent by the source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodePacket

public NodePacket(Node source,
                  int stripeId,
                  boolean lost,
                  boolean sent,
                  int size)
Constructs a new NodePacket

Parameters:
source - nullable Node as source. null means the publisher is the source
stripeId - stripe ID for the data in this packet
lost - true if packet has been lost due to network errors
sent - true if the source chose to send the packet purposefully
size - size of the packet in bytes
Method Detail

getSource

public Node getSource()
Returns the source of this packet, or null if the source is the publisher.

Returns:
nullable Node

getStripeId

public int getStripeId()
Returns the stripe ID for this packet


isLost

public boolean isLost()
Returns true if this packet is being simulated as a lost packet.


isSent

public boolean isSent()
Returns true if this packet is being simulated as having been purposefully sent by the source.


getSize

public int getSize()
Returns this packet's size in bytes.

Returns:
packet's size in bytes.

isLive

public boolean isLive()
Returns true if this packet was not lost and was sent.