JBotSim icon indicating copy to clipboard operation
JBotSim copied to clipboard

Print a warning when getID() is called on a node before being added to the topology

Open acasteigts opened this issue 3 years ago • 0 comments

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.

acasteigts avatar Dec 16 '21 08:12 acasteigts