Merge marina project in subdirectory marina/
[fleet.git] / marina / testCode / edu / berkeley / fleet / two / DockDescription.java
1 package edu.berkeley.fleet.two;
2 import edu.berkeley.fleet.api.*;
3 import java.io.*;
4 import java.util.*;
5
6 /** NOT YET FINALIZED: A description of a dock on a ship */
7 public class DockDescription {
8
9     private final ShipDescription ship;
10     private final String name;
11     private final boolean inbox;
12     private final boolean left;
13     private final boolean isDockless;
14     private final HashMap<String,BitVector> constants = new HashMap<String,BitVector>();
15
16     DockDescription(ShipDescription ship, String name, boolean left, boolean inbox) {
17         this(ship, name, left, inbox, false);
18     }
19     DockDescription(ShipDescription ship, String name, boolean left, boolean inbox, boolean isDockless) {
20         this.left = left;
21         this.ship = ship;
22         this.name = name;
23         this.inbox = inbox;
24         this.isDockless = isDockless;
25     }
26
27     public String  getName() { return name; }
28     public boolean isInputDock() { return inbox; }
29     public boolean isOutputDock() { return !inbox; }
30     public boolean isDockless() { return isDockless; }
31
32     /** Indicates if this dock should be drawn on the "left hand side" of the ship for visual purposes */
33     boolean isLeft() { return left; }
34
35     /** Searches the dock-specific constants first, then ship-wide constants */
36     public BitVector getConstant(String name) {
37         BitVector ret = constants.get(name);
38         if (ret == null) ret = ship.getConstant(name);
39         return ret;
40     }
41
42     void addConstant(String s, BitVector c) { constants.put(s, c); }
43 }