protected NetworkNode(final String name, final NetworkNode parentNode, final NetworkTopology networkTopology) { this.name = name; this.parentNode = parentNode; this.networkTopology = networkTopology; if (this.parentNode != null) { this.parentNode.addChild(this); } if (this.networkTopology != null) { this.networkTopology.addNode(this); } }
protected NetworkNode(final String name, final NetworkNode parentNode, final NetworkTopology networkTopology) { this.name = name; this.parentNode = parentNode; this.networkTopology = networkTopology; if (this.parentNode != null) { this.parentNode.addChild(this); } if (this.networkTopology != null) { this.networkTopology.addNode(this); } }
@Override public void read(final DataInput in) throws IOException { this.name = StringRecord.readString(in); // We need to read the name before we can add the node to the topology's node map if (this.networkTopology != null) { this.networkTopology.addNode(this); } final int numberOfChildNodes = in.readInt(); for (int i = 0; i < numberOfChildNodes; i++) { final NetworkNode networkNode = new NetworkNode(this, this.networkTopology); networkNode.read(in); this.childNodes.add(networkNode); } }
@Override public void read(final DataInput in) throws IOException { this.name = StringRecord.readString(in); // We need to read the name before we can add the node to the topology's node map if (this.networkTopology != null) { this.networkTopology.addNode(this); } final int numberOfChildNodes = in.readInt(); for (int i = 0; i < numberOfChildNodes; i++) { final NetworkNode networkNode = new NetworkNode(this, this.networkTopology); networkNode.read(in); this.childNodes.add(networkNode); } }