Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

ReplyInfo.java

00001 package gov.nasa.arc.ase.jpf;
00002 
00003 public class ReplyInfo implements java.io.Serializable {
00004   int sent;
00005   int received;
00006   boolean ok;
00007 
00008   public ReplyInfo() {
00009     sent = 0;
00010     received = 0;
00011     ok = true;
00012   }  
00013   public ReplyInfo(byte[] data) {
00014     ByteArray a = new ByteArray(data);
00015 
00016     sent = a.unpackInt();
00017     received = a.unpackInt();
00018     ok = a.unpackBoolean();
00019   }  
00020   public ReplyInfo(int s, int r, boolean o) {
00021     sent = s;
00022     received = r;
00023     ok = o;
00024   }  
00025   public void add(ReplyInfo ri) {
00026     sent += ri.sent;
00027     received += ri.received;
00028     ok = ok && ri.ok;
00029   }  
00030   public byte[] getData() {
00031     ByteArray a = new ByteArray();
00032 
00033     a.pack(sent);
00034     a.pack(received);
00035     a.pack(ok);
00036 
00037     return a.getData();
00038   }  
00039   public boolean isOk() {
00040     return ok && sent == received;
00041   }  
00042   public String toString() {
00043     StringBuffer sb = new StringBuffer();
00044 
00045     sb.append("I'm ");
00046     if(!ok) sb.append("not ");
00047     sb.append("okay to stop; ");
00048     sb.append("I've sent ");
00049     sb.append(sent);
00050     sb.append(" messages and received ");
00051     sb.append(received);
00052     sb.append(".");
00053     
00054     return sb.toString();
00055   }  
00056 }

Generated at Thu Feb 7 06:53:52 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001