@Test public void testToString() { SourceRoutingSwitch device = new SourceRoutingSwitch(1, null, 5, new IdentityFlowletIntermediary()); device.addConnection(topology.getPort(1, 0)); device.addConnection(topology.getPort(1, 2)); device.addConnection(topology.getPort(1, 3)); device.addPathToDestination(0, makePath(new Integer[]{1, 0})); device.addPathToDestination(2, makePath(new Integer[]{1, 2})); device.addPathToDestination(3, makePath(new Integer[]{1, 3})); device.addPathToDestination(4, makePath(new Integer[]{1, 2, 4})); device.addPathToDestination(4, makePath(new Integer[]{1, 3, 4})); System.out.println(device.toString()); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("SourceRoutingSwitch<id="); builder.append(getIdentifier()); builder.append(", connected="); builder.append(connectedTo); builder.append(", routing: "); for (int i = 0; i < destinationToPaths.size(); i++) { builder.append("for "); builder.append(i); builder.append(" possible paths are "); builder.append(destinationToPaths.get(i)); builder.append("; "); } builder.append(">"); return builder.toString(); }
SourceRoutingSwitch extends NetworkDevice { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("SourceRoutingSwitch<id="); builder.append(getIdentifier()); builder.append(", connected="); builder.append(connectedTo); builder.append(", routing: "); for (int i = 0; i < destinationToPaths.size(); i++) { builder.append("for "); builder.append(i); builder.append(" possible paths are "); builder.append(destinationToPaths.get(i)); builder.append("; "); } builder.append(">"); return builder.toString(); } }
SourceRoutingSwitch extends NetworkDevice { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("SourceRoutingSwitch<id="); builder.append(getIdentifier()); builder.append(", connected="); builder.append(connectedTo); builder.append(", routing: "); for (int i = 0; i < destinationToPaths.size(); i++) { builder.append("for "); builder.append(i); builder.append(" possible paths are "); builder.append(destinationToPaths.get(i)); builder.append("; "); } builder.append(">"); return builder.toString(); } SourceRoutingSwitch(int identifier, TransportLayer transportLayer, int n, Intermediary intermediary); }
SourceRoutingSwitch extends NetworkDevice { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("SourceRoutingSwitch<id="); builder.append(getIdentifier()); builder.append(", connected="); builder.append(connectedTo); builder.append(", routing: "); for (int i = 0; i < destinationToPaths.size(); i++) { builder.append("for "); builder.append(i); builder.append(" possible paths are "); builder.append(destinationToPaths.get(i)); builder.append("; "); } builder.append(">"); return builder.toString(); } SourceRoutingSwitch(int identifier, TransportLayer transportLayer, int n, Intermediary intermediary); @Override void receive(Packet genericPacket); List<List<SourceRoutingPath>> getPathsList(); @Override void receiveFromIntermediary(Packet genericPacket); @Override String toString(); }
SourceRoutingSwitch extends NetworkDevice { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("SourceRoutingSwitch<id="); builder.append(getIdentifier()); builder.append(", connected="); builder.append(connectedTo); builder.append(", routing: "); for (int i = 0; i < destinationToPaths.size(); i++) { builder.append("for "); builder.append(i); builder.append(" possible paths are "); builder.append(destinationToPaths.get(i)); builder.append("; "); } builder.append(">"); return builder.toString(); } SourceRoutingSwitch(int identifier, TransportLayer transportLayer, int n, Intermediary intermediary); @Override void receive(Packet genericPacket); List<List<SourceRoutingPath>> getPathsList(); @Override void receiveFromIntermediary(Packet genericPacket); @Override String toString();  }