public final class LastTargetInterface
extends java.lang.Object
Target.LAST target.
Provides read and write on the pipe of the port that was last read from or written to. This is set whenever a read or write operation on a real port completes.
Since this is not set upon startup, there needs to be a default behavior,
that being it behaves exactly like Target.NIL.
| Constructor and Description |
|---|
LastTargetInterface(Machine machine,
ExecutionModule module,
Face face) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginRead()
Begin a reading operation on the target.
|
protected void |
beginRead(Port port) |
protected void |
beginWrite(Port port,
short value) |
boolean |
beginWrite(short value)
Begin a writing operation on the target.
|
protected void |
cancelRead(Port port) |
protected void |
cancelWrite(Port port) |
boolean |
canTransfer()
Whether the target can transfer data, i.e.
|
protected boolean |
canTransfer(Port port) |
protected Machine |
getMachine() |
protected MachineState |
getState() |
boolean |
isReading()
Whether the target is currently being read from.
|
protected boolean |
isReading(Port port) |
boolean |
isWriting()
Whether the target is currently being written to.
|
protected boolean |
isWriting(Port port) |
short |
read()
Finish a read operation by fetching the data made available from the
represented target.
|
protected short |
read(Port port) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonBeforeWriteCompletepublic LastTargetInterface(Machine machine, ExecutionModule module, Face face)
public boolean beginWrite(short value)
TargetInterface
Make sure not to call this if the target is already being written to, or
an exception will be thrown. Use TargetInterface.isWriting() to check for this.
value - the value to write to the target.public boolean isWriting()
TargetInterface
This is true as soon as TargetInterface.beginWrite(short) was called and
until TargetInterface.read() was called to finish or cancel the operation,
unless the operation was completed synchronously, in which case
TargetInterface.beginWrite(short) returned true.
public void beginRead()
TargetInterface
Make sure not to call this if the target is already being read from, or
an exception will be thrown. Use TargetInterface.isReading() to check for this.
public boolean isReading()
TargetInterface
This is true as soon as TargetInterface.beginRead() was called and
until TargetInterface.read() was called to finish the operation.
public boolean canTransfer()
TargetInterfaceTargetInterface.read() can be called.
Note that this is not equivalent to TargetInterface.isReading() &&
TargetInterface.isWriting(). Depending on the target type, this may be
only true in the first update after that has been true and
later, but it may also be true right away or always.
public short read()
TargetInterface
Make sure not to call this if the target is not in the correct state, or
an exception will be thrown. use TargetInterface.canTransfer() to check for this.
public java.lang.String toString()
toString in class java.lang.Objectprotected final void beginWrite(Port port, short value)
protected final void cancelWrite(Port port)
protected final boolean isWriting(Port port)
protected final void beginRead(Port port)
protected final void cancelRead(Port port)
protected final boolean isReading(Port port)
protected final boolean canTransfer(Port port)
protected final short read(Port port)
protected Machine getMachine()
protected MachineState getState()