ObjectFleet
public abstract class Fleet
An instance of Fleet; each Fleet consists of a collection of Ships.
Note about instruction representation: it is very
important to understand that the binary representation of an
instruction includes a path from the dock which will
dispatch the instruction to the dock which will
execute the instruction. Therefore, an instruction cannot
be converted to binary form without supplying a
dispatching dock so the necessary path can be computed.
Moreover: because a given string of bits uniquely describes
a path only if given along with a starting point, instructions
cannot be converted from binary format without knowing the
dispatch dock from which they are meant to be dispatched. This
is why the readInstruction and writeInstruction
methods take a "dispatchFrom" argument.
| Constructor Summary | |
|---|---|
Fleet()
|
|
| Method Summary | |
|---|---|
abstract Instruction |
decodeInstruction(BitVector instruction,
Dock dispatchFrom)
Decodes an instruction from a BitVector |
abstract BitVector |
encodeInstruction(Instruction instruction,
Dock dispatchFrom)
Encodes an instruction as a BitVector |
abstract int |
getSetWidth()
the width of the immediate field in the "set data latch" instruction |
abstract int |
getShiftWidth()
the width of the immediate field in the "shift data latch" instruction |
abstract Ship |
getShip(String type,
int ordinal)
A ship is uniquely identified by its type (a string) and its ordinal; for example, Fifo[7]. |
abstract int |
getWordWidth()
the natural word width of this machine |
abstract Iterator<Ship> |
iterator()
|
FleetProcess |
run(Instruction[] program)
If supported, run the given code and create a FleetProcess to interact with it. |
| Methods inherited from class Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Fleet()
| Method Detail |
|---|
public abstract Iterator<Ship> iterator()
iterator in interface Iterable<Ship>
public abstract Ship getShip(String type,
int ordinal)
public abstract int getWordWidth()
public abstract int getShiftWidth()
public abstract int getSetWidth()
public abstract BitVector encodeInstruction(Instruction instruction,
Dock dispatchFrom)
public abstract Instruction decodeInstruction(BitVector instruction,
Dock dispatchFrom)
public FleetProcess run(Instruction[] program)