I have a resource pool with only 1 resource unit, I'd like to have a node "myArea" changes its color depending on if the resource unit is idle or busy. I typed the following code in a function "updateColor" body which I call in the resource pool actions "on seize" and "on release" (and in the Main agent "on startup").
int idleUnits = speedyBag.idle();
if (idleUnits == 1){
myArea.setFillColor(Color.GREEN);
} else if (idleUnits == 0) {
myArea.setFillColor(Color.RED);
}
However this code doesn't work as I expected, the simulation starts with a green area but when the resource unit is seized it turns red and stays red forever. I guess with
speedyBag.idle()
I'm not pointing at what i think (the number of idle units in the pool, indicated in the picture). Any suggestions?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.