1 package edu.berkeley.fleet.interpreter;
2 import edu.berkeley.fleet.api.*;
3 import edu.berkeley.fleet.two.*;
7 /** a ship, which belongs to a fleet and which may have many ports */
8 abstract class InterpreterShip extends FleetTwoShip {
10 /** You should instantiate a bunch of Inboxes and Outboxes in your constructor */
11 public InterpreterShip(Interpreter fleet, ShipDescription sd) {
15 private HashMap<String,InterpreterDock> ports = new HashMap<String,InterpreterDock>();
16 public Iterator<Dock> iterator() { return (Iterator<Dock>)(Object)ports.values().iterator(); }
19 * Override this method, check inboxes for the data you need, and
20 * if you find it, deposit results in an outbox; we'll take care
23 public abstract void service();
25 public final void _service() {
26 for(InterpreterDock p : ports.values()) p.service();
30 protected void addDock(String name, InterpreterDock port) {
31 ports.put(name, port);
35 for(InterpreterDock p : ports.values())
39 public Interpreter getInterpreter() { return (Interpreter)getFleet(); }