1 package edu.berkeley.fleet;
3 /** anything that has a destination address on the switch fabric */
4 public abstract class Port {
6 private final String name;
7 private final Ship ship;
9 public Port(Ship ship, String name) {
12 ship.addPort(name, this);
15 protected boolean special = false;
16 protected boolean noInbox = false;
17 protected boolean noChannelDef = false;
19 public boolean special() { return special; }
20 public boolean noInbox() { return noInbox; }
21 public boolean noChannelDef() { return noChannelDef; }
23 /** adds one token to the port from the switch fabric side */
24 void addTokenFromFabric() { /*throw new RuntimeException("this should never happen!");*/ addDataFromFabric(0); }
26 /** adds the included datum to the port from the switch fabric side */
27 void addDataFromFabric(int datum) { throw new RuntimeException("this should never happen!"); }
29 /** adds one token to the port from the ship side */
30 public void addTokenFromShip() { /*throw new RuntimeException("this should never happen!");*/ addDataFromShip(0); }
32 /** adds the included datum to the port from the switch fabric side */
33 public void addDataFromShip(int datum) { throw new RuntimeException("this should never happen!"); }
35 public Ship getShip() { return ship; }
37 public Fleet getFleet() { return getShip().getFleet(); }
39 public String toString() { return ship+"."+name; }
41 abstract void shutdown();
43 public String getName() { return name; }