Entity entity = (Entity) entities.next();
for (Iterator ports = entity.portList().iterator(); ports.hasNext();) {
Port port = (Port) ports.next();
Set set = analysis.getNotConstVariables(port);
Variable variable;
variable = DFUtilities.getRateVariable(port,
"tokenInitProduction");
_listenToRateVariable(variable, rateVariables);
newList.add(variable);
if (set.contains(variable)) {
_assertDynamicRateVariable(model, variable, rateVariables,
analysis);
}
variable = DFUtilities.getRateVariable(port,
"tokenConsumptionRate");
_listenToRateVariable(variable, rateVariables);
newList.add(variable);
if (set.contains(variable)) {
_assertDynamicRateVariable(model, variable, rateVariables,
analysis);
}
variable = DFUtilities.getRateVariable(port,
"tokenProductionRate");
_listenToRateVariable(variable, rateVariables);
newList.add(variable);
if (set.contains(variable)) {
_assertDynamicRateVariable(model, variable, rateVariables,
analysis);
}
}
}
// Don't listen to old rate variables anymore.
oldList.removeAll(newList);
for (Iterator oldRateVariables = oldList.iterator(); oldRateVariables
.hasNext();) {
Variable variable = (Variable) oldRateVariables.next();
if (_debugging) {
_debug("No longer listening to rate variable " + variable);
}
variable.removeValueListener(this);
rateVariables.remove(variable);
}
}