[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages AgillaClusterDebugMsgJ.java, NONE, 1.1 AgillaQueryNearestAgentMsgJ.java, 1.3, 1.4 AgillaQueryAgentLocMsgJ.java, 1.2, 1.3 AgillaQueryNumAgentsMsgJ.java, 1.3, 1.4 AgillaNbrMsgJ.java, 1.4, 1.5 AgillaQueryAllAgentsMsgJ.java, 1.3, 1.4 AgillaQueryReplyNearestAgentMsgJ.java, 1.1, 1.2 AgillaLocMsgJ.java, 1.4, 1.5 AgillaQueryReplyAgentLocMsgJ.java, 1.1, 1.2 AgillaQueryReplyAllAgentsMsgJ.java, 1.2, 1.3 AgillaQueryReplyNumAgentsMsgJ.java, 1.2, 1.3

borndigerati borndigerati at users.sourceforge.net
Wed Apr 5 03:29:04 PDT 2006


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

Modified Files:
	AgillaQueryNearestAgentMsgJ.java AgillaQueryAgentLocMsgJ.java 
	AgillaQueryNumAgentsMsgJ.java AgillaNbrMsgJ.java 
	AgillaQueryAllAgentsMsgJ.java 
	AgillaQueryReplyNearestAgentMsgJ.java AgillaLocMsgJ.java 
	AgillaQueryReplyAgentLocMsgJ.java 
	AgillaQueryReplyAllAgentsMsgJ.java 
	AgillaQueryReplyNumAgentsMsgJ.java 
Added Files:
	AgillaClusterDebugMsgJ.java 
Log Message:
Changes to support clustering!

--- NEW FILE: AgillaClusterDebugMsgJ.java ---
// $Id$
/* Agilla - A middleware for wireless sensor networks.
 * Copyright (C) 2004, Washington University in Saint Louis
 * By Chien-Liang Fok.
 *
 * Washington University states that Agilla is free software;
 * you can redistribute it and/or modify it under the terms of
 * the current version of the GNU Lesser General Public License
 * as published by the Free Software Foundation.
 *
 * Agilla is distributed in the hope that it will be useful, but
 * THERE ARE NO WARRANTIES, WHETHER ORAL OR WRITTEN, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
 *
 * YOU UNDERSTAND THAT AGILLA IS PROVIDED "AS IS" FOR WHICH NO
 * WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. THERE ARE NO
 * WARRANTIES AND NO REPRESENTATION THAT AGILLA IS FREE OF
 * INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHE
 * PROPRIETARY RIGHTS.  THERE ARE NO WARRANTIES THAT SOFTWARE IS
 * FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS",
 * OR OTHER HARMFUL CODE.
 *
 * YOU ASSUME THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR
 * ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF
 * INFORMATION GENERATED USING SOFTWARE. By using Agilla you agree to
 * indemnify, defend, and hold harmless WU, its employees, officers and
 * agents from any and all claims, costs, or liabilities, including
 * attorneys fees and court costs at both the trial and appellate levels
 * for any loss, damage, or injury caused by your actions or actions of
 * your officers, servants, agents or third parties acting on behalf or
 * under authorization from you, as a result of using Agilla.
 *
 * See the GNU Lesser General Public License for more details, which can
 * be found here: http://www.gnu.org/copyleft/lesser.html
 */
package edu.wustl.mobilab.agilla.messages;

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

/**
 * AgillaClusterDebugMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaClusterDebugMsgJ implements MessageJ, AgillaConstants {
	int chId;
	AgillaRectangle boundingBox;
	
	public AgillaClusterDebugMsgJ() {		
	}
	
	public AgillaClusterDebugMsgJ(int chId, AgillaRectangle boundingBox)
	{
		this.chId = chId;
		this.boundingBox = boundingBox;
	}
	
	public AgillaClusterDebugMsgJ(AgillaClusterDebugMsg msg) {
		this.chId = msg.get_id();
		this.boundingBox = new AgillaRectangle(new AgillaLocation(msg.get_bounding_box_llc_x(), msg.get_bounding_box_llc_y()),
				new AgillaLocation(msg.get_bounding_box_urc_x(), msg.get_bounding_box_urc_y()));
	}
	
	public int getType() {	
		return AgillaClusterMsg.AM_TYPE;
	}
	
	public int chId(){
		return chId;
	}
	public AgillaRectangle boundingBox() {
		return boundingBox;
	}

	
	public net.tinyos.message.Message toTOSMsg() {
		AgillaClusterDebugMsg msg = new AgillaClusterDebugMsg();
		msg.set_id(chId);
		msg.set_bounding_box_llc_x(boundingBox.lowerLeftCorner().getx());
		msg.set_bounding_box_llc_y(boundingBox.lowerLeftCorner().gety());
		msg.set_bounding_box_urc_x(boundingBox.upperRightCorner().getx());
		msg.set_bounding_box_urc_y(boundingBox.upperRightCorner().gety());
		return msg;
	}
	
	public String toString() {
		return "ClusterMsg[ID: " + chId + "\tboundingBox:" + boundingBox + "]";
	}
}



Index: AgillaQueryNearestAgentMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryNearestAgentMsgJ.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AgillaQueryNearestAgentMsgJ.java	28 Mar 2006 01:58:52 -0000	1.3
--- AgillaQueryNearestAgentMsgJ.java	5 Apr 2006 10:28:19 -0000	1.4
***************
*** 39,42 ****
--- 39,43 ----
  	private AgillaAgentType agent_type;
  	private int src;
+ 	private int dest;
  	private int qid;
  	private int flags;
	private AgillaLocation loc;
	
***************
*** 53,58 ****
  	 * @param agent_type The agent type
  	 */
	public AgillaQueryNearestAgentMsgJ(AgillaAgentID id, 
! 			int src, int qid, int flags, AgillaLocation loc, AgillaAgentType agent_type)
	{
		this.id = id;
  		this.src = src;
  		this.qid = qid;
  		this.flags = flags;
		this.loc = loc;
--- 54,60 ----
  	 * @param agent_type The agent type
  	 */
	public AgillaQueryNearestAgentMsgJ(AgillaAgentID id, 
! 			int src, int dest, int qid, int flags, AgillaLocation loc, AgillaAgentType agent_type)
	{
		this.id = id;
  		this.src = src;
+ 		this.dest = dest;
  		this.qid = qid;
  		this.flags = flags;
		this.loc = loc;
***************
*** 62,65 ****
--- 64,68 ----
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.src = msg.get_src();
+ 		this.dest = msg.get_dest();
  		this.qid = msg.get_qid();
  		this.flags = msg.get_flags();
		this.loc = new AgillaLocation(msg.get_loc_x(), msg.get_loc_y());
***************
*** 76,79 ****
--- 79,86 ----
  	}
  	
+ 	public int dest() {
+ 		return dest;
+ 	}
+ 	
  	public int qid() {
  		return qid;
***************
*** 99,102 ****
--- 106,110 ----
  		msg.set_agent_id_id(id.getID());
  		msg.set_src(src);
+ 		msg.set_dest(dest);
  		msg.set_qid(qid);	
  		msg.set_flags(flags);
		msg.set_loc_x(loc.getx());
***************
*** 105,111 ****
  	
  	public String toString() {
! 		return "QueryNearestAgentMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src 
! 			+ "\n\tqid: " + qid + "\n\tflags: "  + flags 
! 			+ "\n\tloc: " + loc + "\n\tagent_type" + agent_type;
  	}
  }
--- 113,119 ----
  	
  	public String toString() {
! 		return "QueryNearestAgentMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest
! 			+ "\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
! 			"\n\tflags: "  + flags + "\n\tloc: " + loc + "\n\tagent_type: " + agent_type;
  	}
  }

Index: AgillaQueryAgentLocMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryAgentLocMsgJ.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AgillaQueryAgentLocMsgJ.java	28 Mar 2006 01:58:53 -0000	1.2
--- AgillaQueryAgentLocMsgJ.java	5 Apr 2006 10:28:19 -0000	1.3
***************
*** 38,41 ****
--- 38,42 ----
  import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaQueryAgentLocMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryAgentLocMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
  	private int src;
+ 	private int dest;
  	private int qid;
  	private int flags;
	private AgillaAgentID find_agent_id;
	
***************
*** 48,57 ****
  	 * @param id The AgentID of the agent issuing the query.
  	 * @param src The ID of the host on which the agent resides.
  	 * @param qid The query id.
  	 * @param flags Certain flags required for the query
  	 * @param find_agent_id The id of the agent whose location is requested.
  	 */
	public AgillaQueryAgentLocMsgJ(AgillaAgentID id, 
! 			int src, int qid, int flags, AgillaAgentID find_agent_id)
	{
		this.id = id;
  		this.src = src;
  		this.qid = qid;
  		this.flags = flags;
		this.find_agent_id = find_agent_id;
	}
--- 49,60 ----
  	 * @param id The AgentID of the agent issuing the query.
  	 * @param src The ID of the host on which the agent resides.
+ 	 * @param dest The destination of the message
  	 * @param qid The query id.
  	 * @param flags Certain flags required for the query
  	 * @param find_agent_id The id of the agent whose location is requested.
  	 */
	public AgillaQueryAgentLocMsgJ(AgillaAgentID id, 
! 			int src, int dest, int qid, int flags, AgillaAgentID find_agent_id)
	{
		this.id = id;
  		this.src = src;
+ 		this.dest = dest;
  		this.qid = qid;
  		this.flags = flags;
		this.find_agent_id = find_agent_id;
	}
***************
*** 60,63 ****
--- 63,67 ----
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.src = msg.get_src();
+ 		this.dest = msg.get_dest();
  		this.qid = msg.get_qid();
  		this.flags = msg.get_flags();
		this.find_agent_id = new AgillaAgentID(msg.get_find_agent_id_id());
	}
***************
*** 73,76 ****
--- 77,84 ----
  	}
  	
+ 	public int dest() {
+ 		return dest;
+ 	}
+ 	
  	public int qid() {
  		return qid;
***************
*** 93,103 ****
  		msg.set_agent_id_id(id.getID());
  		msg.set_src(src);
  		msg.set_qid(qid);	
  		msg.set_flags(flags);
		msg.set_find_agent_id_id(find_agent_id.getID());
		return msg;
	}
  	
  	public String toString() {
! 		return "QueryAgentLocMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + 
! 			"\n\tqid: " + qid + "\n\tflags: "  + flags +
! 			"\n\tfind_agent_id: " + find_agent_id;
  	}
  }
--- 101,112 ----
  		msg.set_agent_id_id(id.getID());
  		msg.set_src(src);
+ 		msg.set_dest(dest);
  		msg.set_qid(qid);	
  		msg.set_flags(flags);
		msg.set_find_agent_id_id(find_agent_id.getID());
		return msg;
	}
  	
  	public String toString() {
! 		return "QueryAgentLocMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest +
! 			"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
! 			"\n\tflags: "  + flags + "\n\tfind_agent_id: " + find_agent_id;
  	}
  }

Index: AgillaQueryNumAgentsMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryNumAgentsMsgJ.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AgillaQueryNumAgentsMsgJ.java	28 Mar 2006 01:58:53 -0000	1.3
--- AgillaQueryNumAgentsMsgJ.java	5 Apr 2006 10:28:19 -0000	1.4
***************
*** 101,106 ****
  	public String toString() {
  		return "QueryNumAgentsMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src 
! 				+ "\n\tqid: " + qid + "\n\tflags: "  + flags 
! 				+ "\n\ttagent_ype" + agent_type ;
  	}
  }
--- 101,106 ----
  	public String toString() {
  		return "QueryNumAgentsMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src 
! 				+ "\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" + 
! 				"\n\tflags: "  + flags + "\n\tagent_type: " + agent_type + "(" + agent_type.getVal() + ")" ;
  	}
  }

Index: AgillaNbrMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaNbrMsgJ.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AgillaNbrMsgJ.java	26 Mar 2006 07:51:52 -0000	1.4
--- AgillaNbrMsgJ.java	5 Apr 2006 10:28:19 -0000	1.5
***************
*** 42,45 ****
--- 42,52 ----
  import java.util.Vector;
  
+ /**
+  * This message is sent from a sensor node in response to an AgillaGetNbrMsgJ.  
+  * It contains a list of neighbors in the sensor's neighbor list.
+  * 
+  * @author liang
+  *
+  */
  public class AgillaNbrMsgJ implements MessageJ, AgillaConstants {
  	private Vector neighbors = new Vector();
***************
*** 48,56 ****
  	public AgillaNbrMsgJ() {}
  	
! 	public void addNeighbor(int nbr, short hopsToGW) {
  		neighbors.add(new Address(nbr, hopsToGW));
  	}
  	
! 	public void addNeighbor(int nbr, short hopsToGW, int lqi) {
  		neighbors.add(new Address(nbr, hopsToGW, lqi));
  	}
--- 55,63 ----
  	public AgillaNbrMsgJ() {}
  	
! 	public void addNeighbor(int nbr, int hopsToGW) {
  		neighbors.add(new Address(nbr, hopsToGW));
  	}
  	
! 	public void addNeighbor(int nbr, int hopsToGW, int lqi) {
  		neighbors.add(new Address(nbr, hopsToGW, lqi));
  	}
***************
*** 59,66 ****
  		for (int i = 0; i < AGILLA_NBR_MSG_SIZE; i++) {
  			int nbr = msg.getElement_nbr(i);
! 			short hopsToGW = msg.getElement_hopsToGW(i);
  			int lqi = msg.getElement_lqi(i);
  			if (nbr != TOS_BCAST_ADDRESS)
! 				addNeighbor(nbr, hopsToGW);
  		}
  	}
--- 66,73 ----
  		for (int i = 0; i < AGILLA_NBR_MSG_SIZE; i++) {
  			int nbr = msg.getElement_nbr(i);
! 			int hopsToGW = msg.getElement_hopsToGW(i);
  			int lqi = msg.getElement_lqi(i);
  			if (nbr != TOS_BCAST_ADDRESS)
! 				addNeighbor(nbr, hopsToGW, lqi);
  		}
  	}

Index: AgillaQueryAllAgentsMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryAllAgentsMsgJ.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AgillaQueryAllAgentsMsgJ.java	28 Mar 2006 01:58:53 -0000	1.3
--- AgillaQueryAllAgentsMsgJ.java	5 Apr 2006 10:28:19 -0000	1.4
***************
*** 39,42 ****
--- 39,43 ----
  	private AgillaAgentType agent_type;
  	private int src;
+ 	private int dest;
  	private int qid;
  	private int flags;
	
***************
*** 53,58 ****
  	 * @param agent_type The agent type
  	 */
	public AgillaQueryAllAgentsMsgJ(AgillaAgentID id, 
! 			int src, int qid, int flags, AgillaAgentType agent_type)
	{
		this.id = id;
  		this.src = src;
  		this.qid = qid;
  		this.flags = flags;
--- 54,60 ----
  	 * @param agent_type The agent type
  	 */
	public AgillaQueryAllAgentsMsgJ(AgillaAgentID id, 
! 			int src, int dest, int qid, int flags, AgillaAgentType agent_type)
	{
		this.id = id;
  		this.src = src;
+ 		this.dest = dest;
  		this.qid = qid;
  		this.flags = flags;
***************
*** 62,65 ****
--- 64,68 ----
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.src = msg.get_src();
+ 		this.dest = msg.get_dest();
  		this.qid = msg.get_qid();
  		this.flags = msg.get_flags();
***************
*** 76,79 ****
--- 79,86 ----
  	}
  	
+ 	public int dest() {
+ 		return dest;
+ 	}
+ 	
  	public int qid() {
  		return qid;
***************
*** 94,97 ****
--- 101,105 ----
  		msg.set_agent_id_id(id.getID());
  		msg.set_src(src);
+ 		msg.set_dest(dest);
  		msg.set_qid(qid);		
  		msg.set_flags(flags);
***************
*** 99,104 ****
  	
  	public String toString() {
! 		return "QueryAllAgentsMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src 
! 			+ "\n\tqid: " + qid + "\n\tflags: "  + flags + "\n\tagent_type" + agent_type;
  	}
  }
--- 107,113 ----
  	
  	public String toString() {
! 		return "QueryAllAgentsMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest +
! 				"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
! 				"\n\tflags: "  + flags + "\n\tagent_type: " + agent_type;
  	}
  }

Index: AgillaQueryReplyNearestAgentMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryReplyNearestAgentMsgJ.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AgillaQueryReplyNearestAgentMsgJ.java	20 Mar 2006 02:42:28 -0000	1.1
--- AgillaQueryReplyNearestAgentMsgJ.java	5 Apr 2006 10:28:19 -0000	1.2
***************
*** 37,40 ****
--- 37,41 ----
  package edu.wustl.mobilab.agilla.messages;

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

/**
 * AgillaQueryReplyNearestAgentMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryReplyNearestAgentMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
+ 	private int src;
  	private int dest;
  	private int qid;
	private AgillaAgentID nearest_agent_id;
	private AgillaLocation nearest_agent_loc;
	
***************
*** 50,55 ****
  	 * @param nearest_agent_id AgentID of nearest agent.
  	 * @param nearest_agent_loc Location of nearest agent.
! 	 */
	public AgillaQueryReplyNearestAgentMsgJ(AgillaAgentID id, 
  			int dest, int qid, AgillaAgentID nearest_agent_id, AgillaLocation nearest_agent_loc)
	{
		this.id = id;
  		this.dest = dest;
  		this.qid = qid;
		this.nearest_agent_id = nearest_agent_id;
		this.nearest_agent_loc = nearest_agent_loc;
	}
--- 51,57 ----
  	 * @param nearest_agent_id AgentID of nearest agent.
  	 * @param nearest_agent_loc Location of nearest agent.
! 	 */
	public AgillaQueryReplyNearestAgentMsgJ(AgillaAgentID id, int src, 
  			int dest, int qid, AgillaAgentID nearest_agent_id, AgillaLocation nearest_agent_loc)
	{
		this.id = id;
+ 		this.src = src;
  		this.dest = dest;
  		this.qid = qid;
		this.nearest_agent_id = nearest_agent_id;
		this.nearest_agent_loc = nearest_agent_loc;
	}
***************
*** 57,60 ****
--- 59,63 ----
  	public AgillaQueryReplyNearestAgentMsgJ(AgillaQueryReplyNearestAgentMsg msg) {
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
+ 		this.src =msg.get_src();
  		this.dest = msg.get_dest();
  		this.qid = msg.get_qid();
		this.nearest_agent_id = new AgillaAgentID(msg.get_nearest_agent_id_id());
		this.nearest_agent_loc = new AgillaLocation(msg.get_nearest_agent_loc_x(), msg.get_nearest_agent_loc_y());
	}
***************
*** 66,69 ****
--- 69,76 ----
  	}
  	
+ 	public int src() {
+ 		return src;
+ 	}
+ 	
  	public int dest() {
  		return dest;
***************
*** 86,89 ****
--- 93,97 ----
  	public net.tinyos.message.Message toTOSMsg() {
		AgillaQueryReplyNearestAgentMsg msg = new AgillaQueryReplyNearestAgentMsg();
  		msg.set_agent_id_id(id.getID());
+ 		msg.set_src(src);
  		msg.set_dest(dest);
  		msg.set_qid(qid);	
		msg.set_nearest_agent_id_id(nearest_agent_id.getID());
		msg.set_nearest_agent_loc_x(nearest_agent_loc.getx());
***************
*** 91,95 ****
  	
  	public String toString() {
! 		return "QueryReplyNearestAgentMsg: \n\t" + "ID: " + id + "\n\tdest: " + dest + "\n\tqid: " + qid + 
  			"\n\tnearest_agent_id: " + nearest_agent_id + "\n\tnearest_agent_loc: " + nearest_agent_loc;
  	}
--- 99,104 ----
  	
  	public String toString() {
! 		return "QueryReplyNearestAgentMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest + 
! 			"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
  			"\n\tnearest_agent_id: " + nearest_agent_id + "\n\tnearest_agent_loc: " + nearest_agent_loc;
  	}

Index: AgillaLocMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaLocMsgJ.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AgillaLocMsgJ.java	26 Mar 2006 07:51:52 -0000	1.4
--- AgillaLocMsgJ.java	5 Apr 2006 10:28:19 -0000	1.5
***************
*** 38,42 ****
  import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaLocMsgJ.java
 *
 * @author Chien-Liang Fok
 */
public class AgillaLocMsgJ implements MessageJ, AgillaConstants {
  	private AgillaAgentID id;
! 	private int src, seq;
  	AgillaAgentType agent_type;
  	private AgillaLocation loc;
--- 38,42 ----
  import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaLocMsgJ.java
 *
 * @author Chien-Liang Fok
 */
public class AgillaLocMsgJ implements MessageJ, AgillaConstants {
  	private AgillaAgentID id;
! 	private int src, seq, dest;
  	AgillaAgentType agent_type;
  	private AgillaLocation loc;
***************
*** 57,61 ****
  	 */
	public AgillaLocMsgJ(AgillaAgentID id, AgillaAgentType agent_type,
  			int src, int seq, AgillaLocation loc, 
! 			long time_high32, long time_low32)
	{
		this.id = id;
  		this.agent_type = agent_type;
  		this.src = src;
--- 57,61 ----
  	 */
	public AgillaLocMsgJ(AgillaAgentID id, AgillaAgentType agent_type,
  			int src, int seq, AgillaLocation loc, 
! 			long time_high32, long time_low32, int dest)
	{
		this.id = id;
  		this.agent_type = agent_type;
  		this.src = src;
***************
*** 63,67 ****
  		this.loc = loc;
  		this.time_high32 = time_high32;
! 		this.time_low32 = time_low32;
	}
  	
  	public AgillaLocMsgJ(AgillaLocMsg msg) {
--- 63,68 ----
  		this.loc = loc;
  		this.time_high32 = time_high32;
! 		this.time_low32 = time_low32;
! 		this.dest = dest;
	}
  	
  	public AgillaLocMsgJ(AgillaLocMsg msg) {
***************
*** 72,76 ****
  		this.loc = new AgillaLocation(msg.get_loc_x(), msg.get_loc_y());		
  		this.time_high32 = msg.get_timestamp_high32();
! 		this.time_low32 = msg.get_timestamp_low32();
	}
  	
  	public int getType() {	
--- 73,78 ----
  		this.loc = new AgillaLocation(msg.get_loc_x(), msg.get_loc_y());		
  		this.time_high32 = msg.get_timestamp_high32();
! 		this.time_low32 = msg.get_timestamp_low32();
! 		this.dest = msg.get_dest();
	}
  	
  	public int getType() {	
***************
*** 92,95 ****
--- 94,101 ----
  	}
  	
+ 	public int dest() {
+ 		return dest;
+ 	}
+ 	
  	public AgillaLocation loc() {
  		return loc;
***************
*** 115,123 ****
  		msg.set_loc_x(loc.getx());
  		msg.set_loc_y(loc.gety());
		msg.set_timestamp_high32(time_high32);
! 		msg.set_timestamp_low32(time_low32);		
		return msg;
	}
  	
  	public String toString() {
! 		return "LocMsg: \n\t" + "ID: " + id + "\n\ttype:" + agent_type + "\n\tsrc: " + src + "\n\tserial: " + seq + "\n\tloc: " 
! 			+ loc +"\n\ttimestamp: " + time();
  	}
  }
--- 121,130 ----
  		msg.set_loc_x(loc.getx());
  		msg.set_loc_y(loc.gety());
		msg.set_timestamp_high32(time_high32);
! 		msg.set_timestamp_low32(time_low32);
! 		msg.set_dest(dest);
		return msg;
	}
  	
  	public String toString() {
! 		return "LocMsg: \n\t" + "ID: " + id + "\n\ttype:" + agent_type + "\n\tsrc: " + src + "\n\tseq: " + seq + "\n\tloc: " 
! 			+ loc +"\n\ttimestamp: " + time() + "\n\tdest: " + dest;
  	}
  }

Index: AgillaQueryReplyAgentLocMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryReplyAgentLocMsgJ.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AgillaQueryReplyAgentLocMsgJ.java	20 Mar 2006 02:42:27 -0000	1.1
--- AgillaQueryReplyAgentLocMsgJ.java	5 Apr 2006 10:28:19 -0000	1.2
***************
*** 38,42 ****
  import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaQueryReplyAgentLocMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryReplyAgentLocMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
  	private int dest;
! 	private int qid;
	private AgillaLocation loc;
	
  	public AgillaQueryReplyAgentLocMsgJ() {		
  	}
--- 38,43 ----
  import edu.wustl.mobilab.agilla.variables.*;

/**
 * AgillaQueryReplyAgentLocMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryReplyAgentLocMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
  	private int dest;
! 	private int qid;
	private AgillaLocation loc;
! 	private AgillaString networkName;
	
  	public AgillaQueryReplyAgentLocMsgJ() {		
  	}
***************
*** 50,61 ****
  	 * @param loc The location of the agent.
  	 */
	public AgillaQueryReplyAgentLocMsgJ(AgillaAgentID id, 
! 			int dest, int qid, AgillaLocation loc)
	{
		this.id = id;
  		this.dest = dest;
! 		this.qid = qid;
		this.loc = loc;
	}
  	
  	public AgillaQueryReplyAgentLocMsgJ(AgillaQueryReplyAgentLocMsg msg) {
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.dest = msg.get_dest();
! 		this.qid = msg.get_qid();
		this.loc = new AgillaLocation(msg.get_loc_x(), msg.get_loc_y());
	}
  	
  	public int getType() {	
--- 51,64 ----
  	 * @param loc The location of the agent.
  	 */
	public AgillaQueryReplyAgentLocMsgJ(AgillaAgentID id, 
! 			int dest, int qid, AgillaLocation loc, AgillaString networkName)
	{
		this.id = id;
  		this.dest = dest;
! 		this.qid = qid;
		this.loc = loc;
! 		this.networkName = networkName;
	}
  	
  	public AgillaQueryReplyAgentLocMsgJ(AgillaQueryReplyAgentLocMsg msg) {
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.dest = msg.get_dest();
! 		this.qid = msg.get_qid();
		this.loc = new AgillaLocation(msg.get_loc_x(), msg.get_loc_y());
! 		this.networkName = new AgillaString(msg.get_nw_desc_string());
	}
  	
  	public int getType() {	
***************
*** 77,81 ****
  		return loc;
  	}
! 	
	
  	public net.tinyos.message.Message toTOSMsg() {
		AgillaQueryReplyAgentLocMsg msg = new AgillaQueryReplyAgentLocMsg();
  		msg.set_agent_id_id(id.getID());
--- 80,87 ----
  		return loc;
  	}
! 	
! 	public AgillaString networkName(){
! 		return networkName;
! 	}
	
  	public net.tinyos.message.Message toTOSMsg() {
		AgillaQueryReplyAgentLocMsg msg = new AgillaQueryReplyAgentLocMsg();
  		msg.set_agent_id_id(id.getID());
***************
*** 83,90 ****
  		msg.set_qid(qid);	
		msg.set_loc_x(loc.getx());
  		msg.set_loc_y(loc.gety());
! 		System.out.println("TOSMsg of Location Query reply message: " + msg);
		return msg;
	}
  	
  	public String toString() {
! 		return "QueryReplyAgentLocMsg: \n\t" + "ID: " + id + "\n\tdest: " + dest + "\n\tqid: " + qid + "\n\tloc: " + loc;
  	}
  }
--- 89,99 ----
  		msg.set_qid(qid);	
		msg.set_loc_x(loc.getx());
  		msg.set_loc_y(loc.gety());
! 		msg.set_nw_desc_string(networkName.getString());
! 		//System.out.println("TOSMsg of Location Query reply message: " + msg);
		return msg;
	}
  	
  	public String toString() {
! 		return "QueryReplyAgentLocMsg: \n\t" + "ID: " + id + "\n\tdest: " + 
! 				dest + "\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
! 				"\n\tloc: " + loc + "\n\tnetworkName: " + networkName.toString();
  	}
  }

Index: AgillaQueryReplyAllAgentsMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryReplyAllAgentsMsgJ.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AgillaQueryReplyAllAgentsMsgJ.java	20 Mar 2006 23:22:51 -0000	1.2
--- AgillaQueryReplyAllAgentsMsgJ.java	5 Apr 2006 10:28:20 -0000	1.3
***************
*** 38,44 ****
  import edu.wustl.mobilab.agilla.variables.*;
  import java.util.*;

/**
 * AgillaQueryReplyAllAgentsMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryReplyAllAgentsMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
  	private int dest;
! 	private int qid;
	private int num_agents;
	private Vector agents;
! 	public static final int MAX_NUM_AGENTS = 3;
	
  	public AgillaQueryReplyAllAgentsMsgJ() {		
  	}
--- 38,45 ----
  import edu.wustl.mobilab.agilla.variables.*;
  import java.util.*;

/**
 * AgillaQueryReplyAllAgentsMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryReplyAllAgentsMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
+ 	private int src;
  	private int dest;
! 	private int qid;
	private int num_agents;
	private Vector<AgillaLocMAgentInfo> agents;
! 	public static final int MAX_NUM_AGENTS = 2;
	
  	public AgillaQueryReplyAllAgentsMsgJ() {		
  	}
***************
*** 51,65 ****
  	 * @param qid The query id.
  	 * @param num_agents The number of agents in the system.
! 	 */
	public AgillaQueryReplyAllAgentsMsgJ(AgillaAgentID id, 
! 			int dest, int qid, int num_agents)
	{
		this.id = id;
  		this.dest = dest;
  		this.qid = qid;
		this.num_agents = num_agents;
! 		agents = new Vector();
	}
  	
  	public AgillaQueryReplyAllAgentsMsgJ(AgillaQueryReplyAllAgentsMsg msg) {
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.dest = msg.get_dest();
  		this.qid = msg.get_qid();
		this.num_agents = msg.get_num_agents();
! 		agents = new Vector();
  		int size = num_agents;
  		if(size > MAX_NUM_AGENTS) size = MAX_NUM_AGENTS;
--- 52,67 ----
  	 * @param qid The query id.
  	 * @param num_agents The number of agents in the system.
! 	 */
	public AgillaQueryReplyAllAgentsMsgJ(AgillaAgentID id, int src,	int dest, int qid, int num_agents)
	{
		this.id = id;
! 		this.src = src;
  		this.dest = dest;
  		this.qid = qid;
		this.num_agents = num_agents;
! 		agents = new Vector<AgillaLocMAgentInfo>();
	}
  	
  	public AgillaQueryReplyAllAgentsMsgJ(AgillaQueryReplyAllAgentsMsg msg) {
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
+ 		this.src = msg.get_src();
  		this.dest = msg.get_dest();
  		this.qid = msg.get_qid();
		this.num_agents = msg.get_num_agents();
! 		agents = new Vector<AgillaLocMAgentInfo>();
  		int size = num_agents;
  		if(size > MAX_NUM_AGENTS) size = MAX_NUM_AGENTS;
***************
*** 69,73 ****
  				new AgillaLocMAgentInfo(new AgillaAgentID(msg.getElement_agent_info_agent_id_id(i)),
  					new AgillaLocation(msg.getElement_agent_info_loc_x(i), msg.getElement_agent_info_loc_y(i)));
! 			agents.addElement(agentInf);
  		}
	}
  	
--- 71,75 ----
  				new AgillaLocMAgentInfo(new AgillaAgentID(msg.getElement_agent_info_agent_id_id(i)),
  					new AgillaLocation(msg.getElement_agent_info_loc_x(i), msg.getElement_agent_info_loc_y(i)));
! 			agents.add(agentInf);
  		}
	}
  	
***************
*** 75,79 ****
  		if(agents.size() >= MAX_NUM_AGENTS) 
  			throw new IllegalAccessException("Cannot add more than " + MAX_NUM_AGENTS + "elements");
! 		agents.addElement(agentInf);
  	}
  	
--- 77,81 ----
  		if(agents.size() >= MAX_NUM_AGENTS) 
  			throw new IllegalAccessException("Cannot add more than " + MAX_NUM_AGENTS + "elements");
! 		agents.add(agentInf);
  	}
  	
***************
*** 82,86 ****
  			throw new IllegalAccessException("Cannot add more than " + MAX_NUM_AGENTS + "elements");
  		AgillaLocMAgentInfo agentInf = new AgillaLocMAgentInfo(id, loc);
! 		agents.addElement(agentInf);
  	}
  	
--- 84,88 ----
  			throw new IllegalAccessException("Cannot add more than " + MAX_NUM_AGENTS + "elements");
  		AgillaLocMAgentInfo agentInf = new AgillaLocMAgentInfo(id, loc);
! 		agents.add(agentInf);
  	}
  	
***************
*** 89,93 ****
  			throw new IllegalAccessException("Cannot add more than " + MAX_NUM_AGENTS + "elements");
  		AgillaLocMAgentInfo agentInf = new AgillaLocMAgentInfo(new AgillaAgentID(id), new AgillaLocation(x, y));
! 		agents.addElement(agentInf);
  	}
  	
--- 91,95 ----
  			throw new IllegalAccessException("Cannot add more than " + MAX_NUM_AGENTS + "elements");
  		AgillaLocMAgentInfo agentInf = new AgillaLocMAgentInfo(new AgillaAgentID(id), new AgillaLocation(x, y));
! 		agents.add(agentInf);
  	}
  	
***************
*** 102,105 ****
--- 104,111 ----
  	}
  	
+ 	public int src() {
+ 		return src;
+ 	}
+ 	
  	public int qid() {
  		return qid;
***************
*** 111,119 ****
  	}
  	
! 	public Vector getAgentInfo(){
  		return agents;
  	}
	
  	public net.tinyos.message.Message toTOSMsg() {
		AgillaQueryReplyAllAgentsMsg msg = new AgillaQueryReplyAllAgentsMsg();
  		msg.set_agent_id_id(id.getID());
  		msg.set_dest(dest);
  		msg.set_qid(qid);	
		msg.set_num_agents(num_agents);
--- 117,126 ----
  	}
  	
! 	public Vector<AgillaLocMAgentInfo> getAgentInfo(){
  		return agents;
  	}
	
  	public net.tinyos.message.Message toTOSMsg() {
		AgillaQueryReplyAllAgentsMsg msg = new AgillaQueryReplyAllAgentsMsg();
  		msg.set_agent_id_id(id.getID());
+ 		msg.set_src(src);
  		msg.set_dest(dest);
  		msg.set_qid(qid);	
		msg.set_num_agents(num_agents);
***************
*** 128,134 ****
  	
  	public String toString() {
! 		String res = "QueryReplyAllAgentsMsg: \n\t" + "ID: " + id + "\n\tdest: " + dest + 
! 						"\n\tqid: " + qid + "\n\tnum_agents: " + num_agents +
! 						"\n\tagents:[";
  		for(int i = 0; i < agents.size(); i++){
  			AgillaLocMAgentInfo agentInf = (AgillaLocMAgentInfo)agents.elementAt(i);
--- 135,141 ----
  	
  	public String toString() {
! 		String res = "QueryReplyAllAgentsMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest + 
! 						"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
! 						"\n\tnum_agents: " + num_agents + "\n\tagents:[";
  		for(int i = 0; i < agents.size(); i++){
  			AgillaLocMAgentInfo agentInf = (AgillaLocMAgentInfo)agents.elementAt(i);

Index: AgillaQueryReplyNumAgentsMsgJ.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/agilla/messages/AgillaQueryReplyNumAgentsMsgJ.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AgillaQueryReplyNumAgentsMsgJ.java	22 Mar 2006 01:19:18 -0000	1.2
--- AgillaQueryReplyNumAgentsMsgJ.java	5 Apr 2006 10:28:20 -0000	1.3
***************
*** 84,88 ****
  	
  	public String toString() {
! 		return "QueryReplyNumAgentsMsg: \n\t" + "ID: " + id + "\n\tdest: " + dest + "\n\tqid: " + qid + "\n\tnum_agents: " + num_agents;
  	}
  }
--- 84,90 ----
  	
  	public String toString() {
! 		return "QueryReplyNumAgentsMsg: \n\t" + "ID: " + id + "\n\tdest: " + dest + 
! 				"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
! 				"\n\tnum_agents: " + num_agents;
  	}
  }



More information about the Tinyos-contrib-commits mailing list