JBotSim
JBotSim copied to clipboard
Print a warning when getID() is called on a node before being added to the topology
Nodes receive their IDs only when they are added to the Topology. It often occurs that an algorithm tries to consult this value in the constructor of the Node, rather than (say) in onStart(). The former does not work, but latter does work, since onStart() may execute only after a node has been added to a Topology (and thus has its ID). The programmer could be hinted to this direction, as it makes no sense to call getID() from the constructor.