ptolemy.caltrop.ddi
Class DFInputChannel

java.lang.Object
  extended by ptolemy.caltrop.ddi.DFInputChannel
All Implemented Interfaces:
caltrop.interpreter.InputChannel

 class DFInputChannel
extends java.lang.Object
implements caltrop.interpreter.InputChannel

Since:
Ptolemy II 4.0
Version:
$Id: DFInputChannel.java 38798 2005-07-08 20:00:01Z cxh $
Author:
Jörn W. Janneck
Accepted Rating:
Red (cxh)
Proposed Rating:
Yellow (neuendor)

Field Summary
private  java.util.List buffer
           
private  int channel
           
private  TypedIOPort port
           
private  int tokensRead
           
 
Constructor Summary
DFInputChannel(TypedIOPort port, int channel)
           
 
Method Summary
 void commit()
          Commit reads of this channel.
 java.lang.Object get(int n)
          Get the given token from this input channel.
 boolean hasAvailable(int n)
          Return true if the given number of tokens are available to be immediately read from the channel.
 void rollback()
          Rollback any reads from this channel, allowing the tokens to be read again.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

port

private TypedIOPort port

channel

private int channel

tokensRead

private int tokensRead

buffer

private java.util.List buffer
Constructor Detail

DFInputChannel

public DFInputChannel(TypedIOPort port,
                      int channel)
Method Detail

get

public java.lang.Object get(int n)
Get the given token from this input channel. If necessary, consume tokens from the associated Ptolemy input port to make the given token available.

Specified by:
get in interface caltrop.interpreter.InputChannel

commit

public void commit()
Commit reads of this channel. Any tokens read since the last invocation of the rollback method are lost andd no longer available for reading.

Specified by:
commit in interface caltrop.interpreter.InputChannel

rollback

public void rollback()
Rollback any reads from this channel, allowing the tokens to be read again.

Specified by:
rollback in interface caltrop.interpreter.InputChannel

hasAvailable

public boolean hasAvailable(int n)
Return true if the given number of tokens are available to be immediately read from the channel.

Specified by:
hasAvailable in interface caltrop.interpreter.InputChannel

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object