ctn-waterloo/nengo_1.4 — pull request #419 by xchoo (2013-11-27 01:04:17+00:00)
Title: Udp node

Initial working implementation of SocketUDPNode.
- Note: Named so that SocketTCPNode would later work as a name.

SocketUDPNode.java
- Added udp socket node. With this node you can create socket connections to other socket nodes.
- There are 5 operating modes the socket node can have. Each of which is specified via the appropriate socket node constructor
- Send only
- Receive only (blocking receive. Syncs simulation times)
- Receive only (blocking receive. Ignores simulation times)
- Send and receive (blocking receive. Syncs simulation times)
- Send and receive (blocking receive. Ignores simulation times)
- Note: Socket node only binds to socket in the initialization function (see LocalSimulator initRun function). This is to prevent socket nodes from being unable to bind to socket if errors occur during the last build process (previously, socket nodes bound to sockets in the constructor).
- Note: Socket nodes can only be cloned if socket node is not bound to any ports / sockets.

BasicOrigin.java
- Fixed problem with cloning (with node option). Now properly assigns node reference to cloned origin

NetworkImpl.java
- Added condition to test if node being removed from network is a socket node. If it is, SocketUDPNode.close function has to be called to close the socket (to avoid hogging resources)

PassthroughNode.java
- Added additional constructor to PassthroughNodeTermination. New constructor determines termination dimension from given transform.
- Fixed getTransform to return an identity matrix if stored transformation is null (i.e. not given at construction time)
- Fixed clone method to ignore MU.clone function call if stored transform is null.
- Fixed clone method to ignore myValues if myValues is null.

LocalSimulator.java
- Added code to initRun function to initialize all socket nodes within the network.
- Added code to endRun function to shut down all socket nodes within the network.

CutAction.java
CopyAction.java
ActionException.java
- Improved error reporting code in UI regarding cloning of nodes (now reports the actual error that was thrown, not just "could not clone node")

TODO:
- Thread each socket node. Theoretically, the system can deadlock if receiving nodes are executed before sending nodes during each simulator timestep. The solution is to have each socket node in its own thread.