1 package edu.berkeley.fleet.api;
4 /** A dock on a ship */
5 public abstract class Dock {
7 private final Ship ship;
9 public Dock(Ship ship) {
13 /** return the Ship to which this Dock belongs */
14 public Ship getShip() { return ship; }
16 /** the descriptive name of this dock (relative to its ship) */
17 public abstract String getName();
19 /** returns true if this is an input dock */
20 public abstract boolean isInputDock();
22 /** returns true if this is an output dock */
23 public abstract boolean isOutputDock();
25 /** returns the <tt>Path</tt> from this dock to <tt>dest</tt>, carrying the signal specified or none if null */
26 public abstract Path getPath(Destination dest, BitVector signal);
28 /** the data destination of this dock */
29 public abstract Destination getDataDestination();
31 /** the instruction destination of this dock */
32 public abstract Destination getInstructionDestination();
35 * The maximum number of instructions we can put in the Dock
36 * instruction fifo, or Integer.MAX_VALUE if unbounded; note that
37 * this does not include the epilogue fifo -- that can be
38 * determined with getInstructionDestination().getFifoLength()
40 public abstract int getInstructionFifoSize();
42 /** get a constant associated with a dock; returns null if none found */
43 public BitVector getConstant(String constantName) {
44 throw new RuntimeException("unknown constant \""+constantName+"\" on dock " + this);
47 public String toString() { return getShip()+"."+getName(); }