if (v instanceof UpdatableValue)
{
UpdatableValue upVal = (UpdatableValue) v;
final String variableLogName = name;
ValueListener listener = new ValueListener()
{
final String name = variableLogName;
public void changedValue(LexLocation location,
Value value, Context ctxt)
{
SimulationLogger.log(new SimulationMessage(name, SystemClock.getWallTime(), value.toString()));
}
};
if (upVal.listeners == null)
{
upVal.listeners = new ValueListenerList(listener);
} else
{
upVal.listeners.add(listener);
}
listener.changedValue(null, upVal, null);
} else
{
System.err.println("A non updatable value cannot be logged...it is constant!");
}
}