[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory
TraceAnalyser.java, 1.4, 1.5
Chien-Liang Fok
chien-liang at users.sourceforge.net
Fri Apr 7 22:51:11 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15793/edu/wustl/mobilab/directory
Modified Files:
TraceAnalyser.java
Log Message:
Added flags to specify AgentID of querier and intruder
Index: TraceAnalyser.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/tools/java/edu/wustl/mobilab/directory/TraceAnalyser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TraceAnalyser.java 8 Apr 2006 05:22:41 -0000 1.4
--- TraceAnalyser.java 8 Apr 2006 05:51:08 -0000 1.5
***************
*** 6,10 ****
public class TraceAnalyser {
! public static final int INTRUDER_AGENT_ID = 0;
private boolean debug;
--- 6,11 ----
public class TraceAnalyser {
! static int INTRUDER_AGENT_ID = 0;
! static int QUERIER_AGENT_ID = 1;
private boolean debug;
***************
*** 43,50 ****
if (line.agentID == INTRUDER_AGENT_ID) {
if (intruderLoc != null) {
! if (Math.abs(intruderLoc.getx() - line.loc.getx()) > 1 || Math.abs(intruderLoc.gety() - line.loc.gety()) > 1) {
! System.err.println("ERROR: intruder made an illegal move from (" + intruderLoc.getx() + ", " + intruderLoc.gety() + ") to (" + line.loc.getx() + ", " + line.loc.gety() + ")");
! numErrors++;
! }
}
--- 44,51 ----
if (line.agentID == INTRUDER_AGENT_ID) {
if (intruderLoc != null) {
! // if (Math.abs(intruderLoc.getx() - line.loc.getx()) > 1 || Math.abs(intruderLoc.gety() - line.loc.gety()) > 1) {
! // System.err.println("ERROR: intruder made an illegal move from (" + intruderLoc.getx() + ", " + intruderLoc.gety() + ") to (" + line.loc.getx() + ", " + line.loc.gety() + ")");
! // numErrors++;
! // }
}
***************
*** 52,59 ****
} else {
if (querierLoc != null) {
! if (Math.abs(querierLoc.getx() - line.loc.getx()) > 1 || Math.abs(querierLoc.gety() - line.loc.gety()) > 1) {
! System.err.println("ERROR: querier made an illegal move from (" + querierLoc.getx() + ", " + querierLoc.gety() + ") to (" + line.loc.getx() + ", " + line.loc.gety() + ")");
! numErrors++;
! }
}
querierLoc = line.loc;
--- 53,60 ----
} else {
if (querierLoc != null) {
! // if (Math.abs(querierLoc.getx() - line.loc.getx()) > 1 || Math.abs(querierLoc.gety() - line.loc.gety()) > 1) {
! // System.err.println("ERROR: querier made an illegal move from (" + querierLoc.getx() + ", " + querierLoc.gety() + ") to (" + line.loc.getx() + ", " + line.loc.gety() + ")");
! // numErrors++;
! // }
}
querierLoc = line.loc;
***************
*** 168,179 ****
index++;
file = args[index];
! }else if (arg.equals("-d")) {
debug = true;
} else {
usage();
System.exit(1);
}
index++;
! }
if (file == null)
throw new Exception();
--- 169,185 ----
index++;
file = args[index];
! } else if (arg.equals("-d")) {
debug = true;
+ } else if (arg.equals("-i")) {
+ INTRUDER_AGENT_ID = Integer.valueOf(args[++index]);
+ } else if (arg.equals("-q")) {
+ QUERIER_AGENT_ID = Integer.valueOf(args[++index]);
} else {
+ System.err.println("Unknown argument \"" + arg + "\"");
usage();
System.exit(1);
}
index++;
! }
if (file == null)
throw new Exception();
***************
*** 190,196 ****
private static void usage() {
! System.err.println("Usage: TraceAnalyser [-h | -d | -f <file>]");
System.err.println("\t-h Print this help message");
! System.err.println("\t-d Enable Debug mode");
System.err.println("\t-f <file> Where <file> is contains the experiment trace data.");
}
--- 196,204 ----
private static void usage() {
! System.err.println("Usage: TraceAnalyser [-h | -d | -q | -i | -f <file>]");
System.err.println("\t-h Print this help message");
! System.err.println("\t-d Enable Debug mode");
! System.err.println("\t-i AgentID of intruder");
! System.err.println("\t-q AgentID of querier");
System.err.println("\t-f <file> Where <file> is contains the experiment trace data.");
}
More information about the Tinyos-contrib-commits
mailing list