added BitVector.setImmutable(), use it in Instruction.Shift()
[fleet.git] / src / edu / berkeley / fleet / api / Ship.java
1 package edu.berkeley.fleet.api;
2 import java.util.*;
3
4 /** A ship in a Fleet; each ship consists of a collection of <tt>Dock</tt>s */
5 public abstract class Ship implements Iterable<Dock> {
6
7     private final Fleet fleet;
8
9     public Ship(Fleet fleet) {
10         this.fleet = fleet;
11     }
12
13     /** return the Fleet that this Ship belongs to */
14     public Fleet  getFleet() { return fleet; }
15
16     /** returns the type of the ship ("Fetch", "Alu", etc) */
17     public abstract String getType();
18     
19     public abstract Iterator<Dock> iterator();
20
21     /** returns the dock on this ship having name "name" */
22     public abstract Dock getDock(String name);
23
24     /** the docks of a given type are numbered; this returns the ordinal number of this dock */
25     public abstract int getOrdinal();
26
27     public String toString() { return getType() + "[" + getOrdinal() + "]"; }
28 }