[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages AgillaStateMsgJ.java, 1.2, 1.2.4.1

Chien-Liang Fok chien-liang at users.sourceforge.net
Mon Nov 20 22:51:51 PST 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv12178/edu/wustl/mobilab/agilla/messages

Modified Files:
      Tag: GroupComm
	AgillaStateMsgJ.java 
Log Message:
it works!


Index: AgillaStateMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaStateMsgJ.java,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** AgillaStateMsgJ.java	11 Nov 2005 02:15:49 -0000	1.2
--- AgillaStateMsgJ.java	21 Nov 2006 06:51:49 -0000	1.2.4.1
***************
*** 36,44 ****
   */
  package edu.wustl.mobilab.agilla.messages;

import edu.wustl.mobilab.agilla.*;
! import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaStateMsgJ.java
 *
 * @author Chien-Liang Fok
 */
public class AgillaStateMsgJ implements MessageJ, AgillaConstants {
	private int dest;
	private int replyAddr;
	private AgillaAgentID id;
	private short op, sp;
	private int pc, condition, codeSize;
	private short numHpMsgs, numRxnMsgs;
	
	public AgillaStateMsgJ(int dest,
						   int replyAddr,
						   AgillaAgentID id,
						   short op, short sp,
						   int pc, int condition, int codeSize,
						   short numHpMsgs,
						   short numRxnMsgs)
	{
		this.dest = dest;
		this.replyAddr = replyAddr;
		this.id = id;
		this.op = op;
		this.sp = sp;
		this.pc = pc;
		this.condition = condition;
		this.codeSize = codeSize;
		this.numHpMsgs = numHpMsgs;
		this.numRxnMsgs = numRxnMsgs;
	}
! 	public AgillaStateMsgJ(AgillaStateMsg msg) {
		this.dest = msg.get_dest();
		this.replyAddr = msg.get_replyAddr();
		this.id = new AgillaAgentID(msg.get_id_id());
		this.op = msg.get_op();
		this.sp = msg.get_sp();
		this.pc = msg.get_pc();
		this.condition = msg.get_condition();
		this.codeSize = msg.get_codeSize();
		this.numHpMsgs = msg.get_numHpMsgs();
		this.numRxnMsgs = msg.get_numRxnMsgs();
	}
  	public int getType() {
		//return AM_AGILLASTATEMSG;
  		return AgillaStateMsg.AM_TYPE;
	}
	
	public int getReply() {
	  return replyAddr;
	}
! 	public net.tinyos.message.Message toTOSMsg() {
		AgillaStateMsg msg = new AgillaStateMsg();
		msg.set_dest(dest);
		msg.set_replyAddr(replyAddr);
		msg.set_id_id(id.getID());
		msg.set_op(op);
		msg.set_sp(sp);
		msg.set_pc(pc);
		msg.set_condition(condition);
		msg.set_codeSize(codeSize);
		msg.set_numHpMsgs(numHpMsgs);
		msg.set_numRxnMsgs(numRxnMsgs);
		return msg;
	}
  	public String toString() {
  		String result = "STATE MESSAGE:\n";
--- 36,63 ----
   */
  package edu.wustl.mobilab.agilla.messages;

import edu.wustl.mobilab.agilla.*;
! import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaStateMsgJ.java
 *
 * @author Chien-Liang Fok
 */
public class AgillaStateMsgJ implements MessageJ, AgillaConstants {
	private int dest;
	private int replyAddr;
	private AgillaAgentID id;
	private short op, sp, pstate, rstate;
	private int pc, condition, codeSize;
	private short numHpMsgs, numRxnMsgs;

! 	public AgillaStateMsgJ(int dest,
! 			   int replyAddr,
! 			   AgillaAgentID id,
! 			   short op, short sp,
! 			   int pc, int condition, int codeSize,
! 			   short numHpMsgs,
! 			   short numRxnMsgs)
! 	{
! 		this(dest, replyAddr, id, op, sp, pc, condition, codeSize, numHpMsgs, numRxnMsgs, (short)0, (short)0);
! 	}
! 	
	public AgillaStateMsgJ(int dest,
						   int replyAddr,
						   AgillaAgentID id,
						   short op, short sp,
						   int pc, int condition, int codeSize,
						   short numHpMsgs,
						   short numRxnMsgs, 
! 						   short pstate,
! 						   short rstate)
	{
		this.dest = dest;
		this.replyAddr = replyAddr;
		this.id = id;
		this.op = op;
		this.sp = sp;
		this.pc = pc;
		this.condition = condition;
		this.codeSize = codeSize;
		this.numHpMsgs = numHpMsgs;
		this.numRxnMsgs = numRxnMsgs;
! 		this.pstate = pstate;
! 		this.rstate = rstate;
	}
! 	public AgillaStateMsgJ(AgillaStateMsg msg) {
		this.dest = msg.get_dest();
		this.replyAddr = msg.get_replyAddr();
		this.id = new AgillaAgentID(msg.get_id_id());
		this.op = msg.get_op();
		this.sp = msg.get_sp();
		this.pc = msg.get_pc();
		this.condition = msg.get_condition();
		this.codeSize = msg.get_codeSize();
		this.numHpMsgs = msg.get_numHpMsgs();
		this.numRxnMsgs = msg.get_numRxnMsgs();
! 		this.pstate = msg.get_pstate();
! 		this.rstate = msg.get_rstate();
	}
  	public int getType() {
		//return AM_AGILLASTATEMSG;
  		return AgillaStateMsg.AM_TYPE;
	}
	
	public int getReply() {
	  return replyAddr;
	}
! 	public net.tinyos.message.Message toTOSMsg() {
		AgillaStateMsg msg = new AgillaStateMsg();
		msg.set_dest(dest);
		msg.set_replyAddr(replyAddr);
		msg.set_id_id(id.getID());
		msg.set_op(op);
		msg.set_sp(sp);
		msg.set_pc(pc);
		msg.set_condition(condition);
		msg.set_codeSize(codeSize);
		msg.set_numHpMsgs(numHpMsgs);
		msg.set_numRxnMsgs(numRxnMsgs);
! 		msg.set_rstate(rstate);
! 		msg.set_pstate(pstate);
		return msg;
	}
  	public String toString() {
  		String result = "STATE MESSAGE:\n";
***************
*** 51,55 ****
  		result += "\tCodesize = " + codeSize + "\n";
  		result += "\tNumber of Heap Msgs = " + numHpMsgs + "\n";
! 		result += "\tNumber of Reaction Msgs = " + numRxnMsgs;
  		return result;
  	}
--- 70,76 ----
  		result += "\tCodesize = " + codeSize + "\n";
  		result += "\tNumber of Heap Msgs = " + numHpMsgs + "\n";
! 		result += "\tNumber of Reaction Msgs = " + numRxnMsgs;
! 		result += "\tpstate = " + pstate;
! 		result += "\trstate = " + rstate;
  		return result;
  	}



More information about the Tinyos-contrib-commits mailing list