J
Jay McGavren
`I've got some very strange behavior here involving an if statement
which, when false, skips the first statement in its block, but then
*executes the second*! I'm hoping I've made some mistake which will be
obvious to someone in the group, that I just haven't noticed yet.
Here's output from a jdb session (my comments preceded with "*"):
*The if statement is about to be evaluated:
main[1] list
54 Iterator conditions = conditionIterator();
55 boolean conditionFailed = false; //If behavior has no
conditions, it should be performed by default.
56 conditionLoop: while (conditions.hasNext()) {
57 Condition condition = (Condition) conditions.next();
58 => if (condition.isMet((GameObject) subject, (GameObject)
object) == false) {
59 conditionFailed = true;
60 break conditionLoop;
61 }
62 }
63
*As you can see, it *should* evaluate to false:
main[1] print condition.isMet((GameObject) subject, (GameObject)
object)
condition.isMet((GameObject) subject, (GameObject) object) = true
main[1] nextStep completed: "thread=main", net.sourceforge.zyps.Behavior.perform(),
line=60
bci=44
*And yet, here it is ready to execute the *second* statement
*in the if block! (Even though it skipped the first!)
60 break conditionLoop;
main[1] list
56 conditionLoop: while (conditions.hasNext()) {
57 Condition condition = (Condition) conditions.next();
58 if (condition.isMet((GameObject) subject, (GameObject)
object) == false) {
59 conditionFailed = true;
60 => break conditionLoop;
61 }
62 }
63
64 //Process all actions.
65 Iterator actions = actionIterator();
JDB was run with the command:
jdb -classpath build;test_build;C:\junit\junit.jar -sourcepath
source;test net.sourceforge.zyps.BehaviorTest
Full source can be accessed here:
Behavior:
http://cvs.sourceforge.net/viewcvs....rceforge/zyps/Behavior.java?rev=1.4&view=auto
BehaviorTest (probably not relevant):
http://cvs.sourceforge.net/viewcvs....orge/zyps/BehaviorTest.java?rev=1.4&view=auto
Entire source tree:
http://cvs.sourceforge.net/viewcvs.py/zyps/zyps/
If anyone has any ideas, they would be most appreciated!
which, when false, skips the first statement in its block, but then
*executes the second*! I'm hoping I've made some mistake which will be
obvious to someone in the group, that I just haven't noticed yet.
Here's output from a jdb session (my comments preceded with "*"):
*The if statement is about to be evaluated:
main[1] list
54 Iterator conditions = conditionIterator();
55 boolean conditionFailed = false; //If behavior has no
conditions, it should be performed by default.
56 conditionLoop: while (conditions.hasNext()) {
57 Condition condition = (Condition) conditions.next();
58 => if (condition.isMet((GameObject) subject, (GameObject)
object) == false) {
59 conditionFailed = true;
60 break conditionLoop;
61 }
62 }
63
*As you can see, it *should* evaluate to false:
main[1] print condition.isMet((GameObject) subject, (GameObject)
object)
condition.isMet((GameObject) subject, (GameObject) object) = true
main[1] nextStep completed: "thread=main", net.sourceforge.zyps.Behavior.perform(),
line=60
bci=44
*And yet, here it is ready to execute the *second* statement
*in the if block! (Even though it skipped the first!)
60 break conditionLoop;
main[1] list
56 conditionLoop: while (conditions.hasNext()) {
57 Condition condition = (Condition) conditions.next();
58 if (condition.isMet((GameObject) subject, (GameObject)
object) == false) {
59 conditionFailed = true;
60 => break conditionLoop;
61 }
62 }
63
64 //Process all actions.
65 Iterator actions = actionIterator();
JDB was run with the command:
jdb -classpath build;test_build;C:\junit\junit.jar -sourcepath
source;test net.sourceforge.zyps.BehaviorTest
Full source can be accessed here:
Behavior:
http://cvs.sourceforge.net/viewcvs....rceforge/zyps/Behavior.java?rev=1.4&view=auto
BehaviorTest (probably not relevant):
http://cvs.sourceforge.net/viewcvs....orge/zyps/BehaviorTest.java?rev=1.4&view=auto
Entire source tree:
http://cvs.sourceforge.net/viewcvs.py/zyps/zyps/
If anyone has any ideas, they would be most appreciated!