From: <jhs...@us...> - 2009-01-28 09:33:40
|
Revision: 120 http://flexotask.svn.sourceforge.net/flexotask/?rev=120&view=rev Author: jhspring Date: 2009-01-28 09:33:37 +0000 (Wed, 28 Jan 2009) Log Message: ----------- added support for peek() and peek(index) Modified Paths: -------------- trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskInputPort.java trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskInputPortImpl.java Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskInputPort.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskInputPort.java 2009-01-28 09:32:50 UTC (rev 119) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/FlexotaskInputPort.java 2009-01-28 09:33:37 UTC (rev 120) @@ -27,4 +27,19 @@ * @return the most recent value on the port */ public Object getValue(); + + /** + * Retrieves the most recent value of the InputPort or the buffer, if the + * buffer is present. The value is not removed. + * @return the value. + */ + public Object peek(); + + /** + * Retrieves the most recent value of the InputPort or the n'th value of the + * buffer, if the buffer is present, without removing it. + * @param index the n'th value to be retrieved + * @return the value. + */ + public Object peek(int index); } Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskInputPortImpl.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskInputPortImpl.java 2009-01-28 09:32:50 UTC (rev 119) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/system/FlexotaskInputPortImpl.java 2009-01-28 09:33:37 UTC (rev 120) @@ -59,10 +59,11 @@ } /** - * Non-public method used by ConnectionDrivers to retrieve the value + * Retrieves the most recent value of the InputPort or the buffer, if the + * buffer is present. The value is not removed. * @return the value. */ - Object peek() { + public Object peek() { if (buffer != null) return buffer.peekFirst(); else @@ -70,10 +71,12 @@ } /** - * Non-public method used by ConnectionDrivers to retrieve the value + * Retrieves the most recent value of the InputPort or the n'th value of the + * buffer, if the buffer is present, without removing it. + * @param index the n'th value to be retrieved * @return the value. */ - Object peek(int index) { + public Object peek(int index) { if (buffer != null) return buffer.peekIndex(index); else if (index != 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |