All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

public class  StatsReturnCapsule
     extends edu.utah.janos.antsr.core.Capsule
{
          // Fields 18
     private static final byte[] MID;
     private static final byte[] PID;
     public Vector branches;
     public int cachetime;
     public long capTime;
     public ByteArray data;
     public int dpt;
     public Vector fusedcapsules;
     public int infosource;
     public long keyid;
     public long latency;
     public int nodessentto;
     public int numstatsstrings;
     public int parentnode;
     public boolean partial;
     public long removekey;
     public int rootaddress;
     public ByteArray statsstrings;

          // Constructors 4
     public StatsReturnCapsule();
     public StatsReturnCapsule(int);
     public StatsReturnCapsule(long, int);
     public StatsReturnCapsule(short, short, int, Node);

          // Methods 17
     public Xdr decode();
     public Xdr encode();
     private String[] encodeHeaders();
     private String[] encodeNodeInfo(Node);
     public boolean equals(Object);
     public boolean evaluate(Node);
     public void fuse(StatsReturnCapsule);
     public int hashCode();
     public int length();
     protected byte[] mid();
     private ByteArray nodeHeadersToByteArray();
     protected byte[] pid();
     public void setData(ByteArray);
     public void showInformation(StatsReturnCapsule, Node);
     public void subdecode(Xdr);
     public void subencode(Xdr);
     public int sublength();
}

Stats return capsule.

Author:
Janos Ministry of Development


  Cross Reference

Returned By:
StatsCapsule.waitForReturns()





  Fields

· MID

Summary  |  Top
   private static final byte[] MID


· PID

Summary  |  Top
   private static final byte[] PID


· infosource

Summary  |  Top
   public int infosource

Capsule headers and statistics returns


· parentnode

Summary  |  Top
   public int parentnode


· capTime

Summary  |  Top
   public long capTime


· latency

Summary  |  Top
   public long latency


· keyid

Summary  |  Top
   public long keyid


· nodessentto

Summary  |  Top
   public int nodessentto


· branches

Summary  |  Top
   public Vector branches


· dpt

Summary  |  Top
   public int dpt

Capsule headers which only occur in the main capsule


· rootaddress

Summary  |  Top
   public int rootaddress


· data

Summary  |  Top
   public ByteArray data


· partial

Summary  |  Top
   public boolean partial


· numstatsstrings

Summary  |  Top
   public int numstatsstrings


· statsstrings

Summary  |  Top
   public ByteArray statsstrings


· cachetime

Summary  |  Top
   public int cachetime

The number of seconds to wait in the NodeCache before expiring


· removekey

Summary  |  Top
   public long removekey

An arbitrary number used to single out this capsule from other return capsules in a node cache


· fusedcapsules

Summary  |  Top
   public Vector fusedcapsules

All capsules fused with this one


  Constructors

· StatsReturnCapsule

Summary  |  Top

   public StatsReturnCapsule() 


· StatsReturnCapsule

Summary  |  Top
   public StatsReturnCapsule(int d) 


· StatsReturnCapsule

Summary  |  Top
   public StatsReturnCapsule(long keyid, 
                             int rootaddress) 

Constructor used when StatsReturnCapsule is sitting in the node cache

This sets only the information neccessary to compare this capsule to those sitting in the node cache.



· StatsReturnCapsule

Summary  |  Top
   public StatsReturnCapsule(short sa, 
                             short da, 
                             int na, 
                             Node n) 


  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


· sublength

Summary  |  Top
   public int sublength() 

Sublength is called on each fused capsule and the parent capsule to get the length of just that capsule



· encode

Summary  |  Top
   public Xdr encode() 

Return capsule data looks like:
4 Address of the actual source of the information
4 Address of the node that requested stats from source node
8 Time capsule this is a response to was sent
8 Latency (0 if latency has yet to be figured)
8 The key id of this capsule (used in the node cache)
4 Number of nodes the source of this return sent to
4 Cachetime parameter n The addresses of the nodes the request was sent to
n The byte array containing the return data

The data in the capsule contains strings which specify the actual statistics of the node this is returning from

The header for an entire return capsule looks like:
4 The number of fused capules
4 The destination application port
4 The address of the root of this tree
1 The partial flag (indicates that more returns might come from this source
4 The number of stats strings in each return capsule
n The return stats header strings

Overrides:
encode in class Capsule


· subencode

Summary  |  Top
   public void subencode(Xdr xdr) 

Subencode is called on each fused capsule and the parent capsule to encode only its own data



· decode

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


· subdecode

Summary  |  Top
   public void subdecode(Xdr xdr) 

Subencode is called on each fused capsule and the parent capsule to decode only the capsules data.



· evaluate

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


· encodeNodeInfo

Summary  |  Top
   private String[] encodeNodeInfo(Node n) 

Encode information about this node to be returned to the root of the stats

To change the statistics returned by the tree, change this function and the encodeHeaders function



· encodeHeaders

Summary  |  Top
   private String[] encodeHeaders() 

Encode the stats header strings. These must be one-to-one with the strings returned by the encodeNodeInfo function



· nodeHeadersToByteArray

Summary  |  Top
   private ByteArray nodeHeadersToByteArray() 

Convert the return of encodeHeaders() to a byte array which can be encoded



· showInformation

Summary  |  Top
   public void showInformation(StatsReturnCapsule hsrc, 
                               Node n) 

Print out the information that is contained in this capsule



· fuse

Summary  |  Top
   public void fuse(StatsReturnCapsule src) 

Fuses the information from src into this capsule

Note that this only holds on to a reference to the capsule to be fused until this capsule is actually sent

Parameter Description
src - The capsule to fuse with this one



· setData

Summary  |  Top
   public void setData(ByteArray ba) 


· equals

Summary  |  Top
   public boolean equals(Object o) 

Used when a StatsReturnCapsule is held in a NodeCache

Overrides:
equals in class Object


· hashCode

Summary  |  Top
   public int hashCode() 

Used when a StatsReturnCapsule is held in a NodeCache

Overrides:
hashCode in class Object


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