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

Chien-Liang Fok chien-liang at users.sourceforge.net
Fri May 19 13:07:47 PDT 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-serv28720/edu/wustl/mobilab/agilla/messages

Modified Files:
	AgillaQueryReplyAgentLocMsgJ.java 
	AgillaQueryReplyAllAgentsMsgJ.java 
	AgillaQueryNumAgentsMsgJ.java 
	AgillaQueryReplyNearestAgentMsgJ.java 
	AgillaQueryReplyNumAgentsMsgJ.java 
Added Files:
	QueryConstants.java QueryReplyConstants.java 
Log Message:


--- NEW FILE: QueryConstants.java ---
package edu.wustl.mobilab.agilla.messages;

public class QueryConstants {
	public static final int GLOBAL  = 1;  // whether the query is global or local
}

--- NEW FILE: QueryReplyConstants.java ---
package edu.wustl.mobilab.agilla.messages;

/**
 *  The following are used in the "flags" field of the 
 *  query reply messages.
 */
public class QueryReplyConstants {
	public static final int INVALID = 0x01;
	public static final int VALID = 0x02;
	public static final int COARSE = 0x04;
}

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.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AgillaQueryReplyAgentLocMsgJ.java	5 Apr 2006 10:28:19 -0000	1.2
--- AgillaQueryReplyAgentLocMsgJ.java	19 May 2006 20:07:44 -0000	1.3
***************
*** 36,42 ****
   */
  package edu.wustl.mobilab.agilla.messages;

import edu.wustl.mobilab.agilla.*;
! 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() {		
--- 36,44 ----
   */
  package edu.wustl.mobilab.agilla.messages;

import edu.wustl.mobilab.agilla.*;
! 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 int flags;
	private AgillaLocation loc;
  	private AgillaString networkName;
	
  	public AgillaQueryReplyAgentLocMsgJ() {		
***************
*** 49,57 ****
  	 * @param dest The ID of the host on which the agent resides.
  	 * @param qid The query id
  	 * @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;
	}
  	
--- 51,61 ----
  	 * @param dest The ID of the host on which the agent resides.
  	 * @param qid The query id
+ 	 * @param flags The flags as defined within edu.wustl.mobilab.agilla.messages.QueryReplyConstants
  	 * @param loc The location of the agent.
  	 */
	public AgillaQueryReplyAgentLocMsgJ(AgillaAgentID id, 
! 			int dest, int qid, int flags, AgillaLocation loc, AgillaString networkName)
	{
		this.id = id;
  		this.dest = dest;
! 		this.qid = qid;
! 		this.flags = flags;
		this.loc = loc;
  		this.networkName = networkName;
	}
  	
***************
*** 59,63 ****
  		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());
	}
  	
--- 63,68 ----
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		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());
  		this.networkName = new AgillaString(msg.get_nw_desc_string());
	}
  	
***************
*** 75,78 ****
--- 80,87 ----
  		return qid;
  	}
+ 	
+ 	public int flags() {
+ 		return flags;
+ 	}
  
  	public AgillaLocation loc() 
***************
*** 87,91 ****
  		msg.set_agent_id_id(id.getID());
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
		msg.set_loc_x(loc.getx());
  		msg.set_loc_y(loc.gety());
  		msg.set_nw_desc_string(networkName.getString());
--- 96,101 ----
  		msg.set_agent_id_id(id.getID());
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
! 		msg.set_flags(flags);
		msg.set_loc_x(loc.getx());
  		msg.set_loc_y(loc.gety());
  		msg.set_nw_desc_string(networkName.getString());
***************
*** 95,98 ****
--- 105,109 ----
  		return "QueryReplyAgentLocMsg: \n\t" + "ID: " + id + "\n\tdest: " + 
  				dest + "\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
+ 				"\n\tflags: 0x" + Integer.toHexString(flags) + 
  				"\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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AgillaQueryReplyAllAgentsMsgJ.java	5 Apr 2006 10:28:20 -0000	1.3
--- AgillaQueryReplyAllAgentsMsgJ.java	19 May 2006 20:07:44 -0000	1.4
***************
*** 40,44 ****
  	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() {		
--- 40,45 ----
  	private int src;
  	private int dest;
! 	private int qid;
! 	private int flags;
	private int num_agents;
	private Vector<AgillaLocMAgentInfo> agents;
  	public static final int MAX_NUM_AGENTS = 2;
	
  	public AgillaQueryReplyAllAgentsMsgJ() {		
***************
*** 51,59 ****
  	 * @param dest The ID of the host on which the agent resides.
  	 * @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>();
	}
  	
--- 52,62 ----
  	 * @param dest The ID of the host on which the agent resides.
  	 * @param qid The query id.
+ 	 * @param flags The flags as defined within edu.wustl.mobilab.agilla.messages.QueryReplyConstants
  	 * @param num_agents The number of agents in the system.
! 	 */
	public AgillaQueryReplyAllAgentsMsgJ(AgillaAgentID id, int src,	int dest, int qid, int flags, int num_agents)
	{
		this.id = id;
  		this.src = src;
  		this.dest = dest;
! 		this.qid = qid;
! 		this.flags = flags;
		this.num_agents = num_agents;
  		agents = new Vector<AgillaLocMAgentInfo>();
	}
  	
***************
*** 62,66 ****
  		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;
--- 65,70 ----
  		this.src = msg.get_src();
  		this.dest = msg.get_dest();
! 		this.qid = msg.get_qid();
! 		this.flags = msg.get_flags();
		this.num_agents = msg.get_num_agents();
  		agents = new Vector<AgillaLocMAgentInfo>();
  		int size = num_agents;
***************
*** 112,115 ****
--- 116,123 ----
  	}
  
+ 	public int flags() {
+ 		return flags;
+ 	}
+ 	
  	public int num_agents() 
  	{
***************
*** 124,128 ****
  		msg.set_src(src);
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
		msg.set_num_agents(num_agents);
  		//assert (num_agents >= 0 && num_agents <= msg.numElements_agent_info_agent_id_id());
  		assert (agents.size() <= msg.numElements_agent_info_agent_id_id());
--- 132,137 ----
  		msg.set_src(src);
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
! 		msg.set_flags(flags);
		msg.set_num_agents(num_agents);
  		//assert (num_agents >= 0 && num_agents <= msg.numElements_agent_info_agent_id_id());
  		assert (agents.size() <= msg.numElements_agent_info_agent_id_id());
***************
*** 137,140 ****
--- 146,150 ----
  		String res = "QueryReplyAllAgentsMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest + 
  						"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
+ 						"\n\tflags: " + flags +
  						"\n\tnum_agents: " + num_agents + "\n\tagents:[";
  		for(int i = 0; i < agents.size(); i++){

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.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AgillaQueryNumAgentsMsgJ.java	5 Apr 2006 10:28:19 -0000	1.4
--- AgillaQueryNumAgentsMsgJ.java	19 May 2006 20:07:44 -0000	1.5
***************
*** 51,55 ****
  	 * @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 agent_type The agent type
  	 */
	public AgillaQueryNumAgentsMsgJ(AgillaAgentID id, 
--- 51,55 ----
  	 * @param src The ID of the host on which the agent resides.
  	 * @param qid The query id.
! 	 * @param flags The flags as defined within edu.wustl.mobilab.agilla.messages.QueryConstants
  	 * @param agent_type The agent type
  	 */
	public AgillaQueryNumAgentsMsgJ(AgillaAgentID id, 

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.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AgillaQueryReplyNearestAgentMsgJ.java	5 Apr 2006 10:28:19 -0000	1.2
--- AgillaQueryReplyNearestAgentMsgJ.java	19 May 2006 20:07:44 -0000	1.3
***************
*** 39,43 ****
  	private int src;
  	private int dest;
! 	private int qid;
	private AgillaAgentID nearest_agent_id;
	private AgillaLocation nearest_agent_loc;
	
  	public AgillaQueryReplyNearestAgentMsgJ() {		
  	}
--- 39,44 ----
  	private int src;
  	private int dest;
! 	private int qid;
! 	private int flags;
	private AgillaAgentID nearest_agent_id;
	private AgillaLocation nearest_agent_loc;
	
  	public AgillaQueryReplyNearestAgentMsgJ() {		
  	}
***************
*** 49,59 ****
  	 * @param dest The ID of the host to which the query must be routed.
  	 * @param qid The query id
  	 * @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;
	}
  	
  	public AgillaQueryReplyNearestAgentMsgJ(AgillaQueryReplyNearestAgentMsg msg) {
--- 50,63 ----
  	 * @param dest The ID of the host to which the query must be routed.
  	 * @param qid The query id
+ 	 * @param flags The flags as defined within edu.wustl.mobilab.agilla.messages.QueryReplyConstants
  	 * @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, int flags,
! 			AgillaAgentID nearest_agent_id, AgillaLocation nearest_agent_loc)
	{
		this.id = id;
  		this.src = src;
  		this.dest = dest;
! 		this.qid = qid;
! 		this.flags = flags;
		this.nearest_agent_id = nearest_agent_id;
		this.nearest_agent_loc = nearest_agent_loc;
	}
  	
  	public AgillaQueryReplyNearestAgentMsgJ(AgillaQueryReplyNearestAgentMsg msg) {
***************
*** 61,65 ****
  		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());
	}
  	
  	public int getType() {	
--- 65,70 ----
  		this.src =msg.get_src();
  		this.dest = msg.get_dest();
! 		this.qid = msg.get_qid();
! 		this.flags = msg.get_flags();
		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());
	}
  	
  	public int getType() {	
***************
*** 81,84 ****
--- 86,93 ----
  	}
  
+ 	public int flags() {
+ 		return flags;
+ 	}
+ 	
  	public AgillaAgentID nearestAgentId() 
  	{
***************
*** 95,99 ****
  		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());
  		msg.set_nearest_agent_loc_y(nearest_agent_loc.gety());
		return msg;
	}
  	
--- 104,109 ----
  		msg.set_src(src);
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
! 		msg.set_flags(flags);
		msg.set_nearest_agent_id_id(nearest_agent_id.getID());
		msg.set_nearest_agent_loc_x(nearest_agent_loc.getx());
  		msg.set_nearest_agent_loc_y(nearest_agent_loc.gety());
		return msg;
	}
  	
***************
*** 101,104 ****
--- 111,115 ----
  		return "QueryReplyNearestAgentMsg: \n\t" + "ID: " + id + "\n\tsrc: " + src + "\n\tdest: " + dest + 
  			"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
+ 			"\n\tflags: " + Integer.toHexString(flags) + 
  			"\n\tnearest_agent_id: " + nearest_agent_id + "\n\tnearest_agent_loc: " + nearest_agent_loc;
  	}

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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AgillaQueryReplyNumAgentsMsgJ.java	5 Apr 2006 10:28:20 -0000	1.3
--- AgillaQueryReplyNumAgentsMsgJ.java	19 May 2006 20:07:44 -0000	1.4
***************
*** 38,42 ****
  import edu.wustl.mobilab.agilla.variables.*;

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

/**
 * AgillaQueryReplyNumAgentsMsgJ.java
 *
 * @author Sangeeta Bhattacharya
 */
public class AgillaQueryReplyNumAgentsMsgJ implements MessageJ, AgillaConstants {
	private AgillaAgentID id;
  	private int dest;
! 	private int qid;
! 	private int flags;
	private short num_agents;
	
  	public AgillaQueryReplyNumAgentsMsgJ() {		
  	}
***************
*** 48,61 ****
  	 * @param dest The ID of the host on which the agent resides.
  	 * @param qid The query id
  	 * @param num_agents The total number of agents in the system.
  	 */
	public AgillaQueryReplyNumAgentsMsgJ(AgillaAgentID id, 
! 			int dest, int qid, short num_agents)
	{
		this.id = id;
  		this.dest = dest;
! 		this.qid = qid;
		this.num_agents = num_agents;
	}
  	
  	public AgillaQueryReplyNumAgentsMsgJ(AgillaQueryReplyNumAgentsMsg 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();
	}
  	
  	public int getType() {	
--- 49,65 ----
  	 * @param dest The ID of the host on which the agent resides.
  	 * @param qid The query id
+ 	 * @param flags The flags as defined within edu.wustl.mobilab.agilla.messages.QueryReplyConstants
  	 * @param num_agents The total number of agents in the system.
  	 */
	public AgillaQueryReplyNumAgentsMsgJ(AgillaAgentID id, 
! 			int dest, int qid, int flags, short num_agents)
	{
		this.id = id;
  		this.dest = dest;
! 		this.qid = qid;
! 		this.flags = flags;
		this.num_agents = num_agents;
	}
  	
  	public AgillaQueryReplyNumAgentsMsgJ(AgillaQueryReplyNumAgentsMsg msg) {
  		this.id = new AgillaAgentID(msg.get_agent_id_id());
  		this.dest = msg.get_dest();
! 		this.qid = msg.get_qid();
! 		this.flags = msg.get_flags();
		this.num_agents = msg.get_num_agents();
	}
  	
  	public int getType() {	
***************
*** 72,75 ****
--- 76,83 ----
  		return qid;
  	}
+ 	
+ 	public int flags() {
+ 		return flags;
+ 	}
  
  	public short num_agents() 
***************
*** 81,89 ****
  		msg.set_agent_id_id(id.getID());
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
		msg.set_num_agents(num_agents);
		return msg;
	}
  	
  	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;
  	}
--- 89,99 ----
  		msg.set_agent_id_id(id.getID());
  		msg.set_dest(dest);
! 		msg.set_qid(qid);	
! 		msg.set_flags(flags);
		msg.set_num_agents(num_agents);
		return msg;
	}
  	
  	public String toString() {
  		return "QueryReplyNumAgentsMsg: \n\t" + "ID: " + id + "\n\tdest: " + dest + 
  				"\n\tqid: " + qid + "(" + ((qid >> 8)& 0xff) + ":" + (qid & 0xff) + ")" +  
+ 				"\n\tflags : " + Integer.toHexString(flags) + 
  				"\n\tnum_agents: " + num_agents;
  	}



More information about the Tinyos-contrib-commits mailing list