All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.antsr.apps.statsfusion.StatsCapsule
java.lang.Object
   |
   +----edu.utah.janos.antsr.core.Capsule
           |
           +----edu.utah.janos.antsr.apps.statsfusion.StatsCapsule

  Summary

public class  StatsCapsule
     extends edu.utah.janos.antsr.core.Capsule
{
          // Fields 12
     private static final byte[] MID;
     private static final byte[] PID;
     public Vector branches;
     public int cachetime;
     public byte depth;
     public short dpt;
     public long keyid;
     public int maxwaittime;
     public long now;
     private int numreturns;
     public int returnwaittime;
     public int rootaddress;

          // Constructors 2
     public StatsCapsule();
     public StatsCapsule(int);

          // Methods 8
     private int branch(Node);
     public Xdr decode();
     public Xdr encode();
     public boolean evaluate(Node);
     public int length();
     protected byte[] mid();
     protected byte[] pid();
     private StatsReturnCapsule waitForReturns(StatsReturnCapsule, int, Node);
}

Stats request capsule.

Author:
Janos Ministry of Development




  Fields

· MID

Summary  |  Top

   private static final byte[] MID


· PID

Summary  |  Top
   private static final byte[] PID


· rootaddress

Summary  |  Top
   public int rootaddress


· keyid

Summary  |  Top
   public long keyid


· dpt

Summary  |  Top
   public short dpt


· depth

Summary  |  Top
   public byte depth


· now

Summary  |  Top
   public long now


· cachetime

Summary  |  Top
   public int cachetime


· returnwaittime

Summary  |  Top
   public int returnwaittime

The maximum milliseconds to wait for unreturned capsules before sending what has been accumlated so far


· maxwaittime

Summary  |  Top
   public int maxwaittime

The maximum milliseconds to wait before giving up on unresponded nodes; only accurate to the nearest returnwaittime


· branches

Summary  |  Top
   public Vector branches


· numreturns

Summary  |  Top
   private int numreturns


  Constructors

· StatsCapsule

Summary  |  Top

   public StatsCapsule() 


· StatsCapsule

Summary  |  Top
   public StatsCapsule(int d) 


  Methods

· mid

Summary  |  Top
   protected byte[] mid() 
Overrides:
mid in class Capsule


· pid

Summary  |  Top
   protected byte[] pid() 
Overrides:
pid in class Capsule


· length

Summary  |  Top
   public int length() 
Overrides:
length in class Capsule


· encode

Summary  |  Top
   public Xdr encode() 

Stats request capsules look like:
4 Address of the root of the tree
4 Unique key id of this request tree
2 Application port
1 Depth
4 Time capsule was sent 4 Cachetime parameter 4 Returnwait parameter 4 Returntimeout parameter

Overrides:
encode in class Capsule


· decode

Summary  |  Top
   public Xdr decode() 
Overrides:
decode in class Capsule


· branch

Summary  |  Top
   private int branch(Node n) 

Does the actual process of branching the request packet out to all neighboring nodes except those the have already been visited.

Uses soft-state to persistantly keep track of which nodes have already been visited and to keep from sending back to root or the source of this request capsule

Returns:
The number of requests branched out


· waitForReturns

Summary  |  Top
   private StatsReturnCapsule waitForReturns(StatsReturnCapsule baseCap, 
                                             int numbranches, 
                                             Node n) 

Waits for a maximum amount of time or for the number of expected responses from neighboring nodes and returns a fused capsule of all the stats return capsules that came to this node.

Parameter Description
baseCap - The capsule to fuse other incomming capsules to, or null to start with the first capsule that comes in
numbranches - The number of expected branches to return
n - This node



· evaluate

Summary  |  Top
   public boolean evaluate(Node n) 
Overrides:
evaluate in class Capsule


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7