works
[fleet.git] / testCode / edu / berkeley / fleet / api / Dock.java
1 package edu.berkeley.fleet.api;
2 import java.util.*;
3
4 /** A dock on a ship */
5 public abstract class Dock {
6
7     private final Ship ship;
8
9     public Dock(Ship ship) {
10         this.ship = ship;
11     }
12
13     /** return the Ship to which this Dock belongs */
14     public Ship getShip() { return ship; }
15
16     /** the descriptive name of this dock (relative to its ship) */
17     public abstract String getName();
18
19     /** returns true if this is an input dock */
20     public abstract boolean isInputDock();
21
22     /** returns true if this is an output dock */
23     public abstract boolean isOutputDock();
24
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);
27
28     /** the data destination of this dock */
29     public abstract Destination getDataDestination();
30
31     /** the instruction destination of this dock */
32     public abstract Destination getInstructionDestination();
33
34     /** 
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()
39      */
40     public abstract int getInstructionFifoSize();
41
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);
45     }
46
47     public String toString() { return getShip()+"."+getName(); }
48 }