org.rexxla.bsf.engines.rexx
Class Supplier

java.lang.Object
  extended byorg.rexxla.bsf.engines.rexx.Supplier
All Implemented Interfaces:
java.util.Enumeration

public class Supplier
extends java.lang.Object
implements java.util.Enumeration

Class modelled after the ooRexx class "Supplier". Needs the ArrayWrapper class. Allows iterating over an array (regardless of its dimension). In the case an entry of the array is null, that entry is not reflected in the supplier object.

Since:
2003-02-08 by rgf
Version:
1.1.1, 2005-06-02
Author:
Rony G. Flatscher

Constructor Summary
Supplier(java.lang.Object arrObject)
          Creates an instance of the class using the ArrayWrapper class.
Supplier(java.lang.Object[] values, java.lang.Object[] indices)
          Creates an instance of the class.
Supplier(java.lang.Object arrObject, boolean bRexxStyle)
          Creates an instance of the class using the ArrayWrapper class.
 
Method Summary
 boolean available()
          Tests whether an index/value pair is available.
 boolean hasMoreElements()
          Implements the interface java.util.Enumeration.hasMoreElements().
 java.lang.Object index()
          Returns the index part of the supplier object.
 java.lang.Object item()
          Returns the item (value) part of the supplier object.
 void next()
          Move to the next item/value pair, if any.
 java.lang.Object nextElement()
          Implements the interface java.util.Enumeration.nextElement().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Supplier

public Supplier(java.lang.Object arrObject,
                boolean bRexxStyle)
Creates an instance of the class using the ArrayWrapper class.

Parameters:
arrObject - an array (of any dimension)
bRexxStyle - true format index-part in Object Rexx style (indexing starts with 1 and multiple indices are delimited with commas), false format index-part in Java style (indexing starts with 0 and multiple indices are delimited by enclosing each index in square brackets)

Supplier

public Supplier(java.lang.Object arrObject)
Creates an instance of the class using the ArrayWrapper class. Uses the Java style of indexing for the index part of the supplier object.

Parameters:
arrObject - an array (of any dimension)

Supplier

public Supplier(java.lang.Object[] values,
                java.lang.Object[] indices)
Creates an instance of the class.

Parameters:
values - a single-dimensioned array containing the values (items)
indices - a single-dimensioned array containing the indices of v
Method Detail

available

public boolean available()
Tests whether an index/value pair is available.

Returns:
true, if an index/value pair is available, false else.

next

public void next()
Move to the next item/value pair, if any.


item

public java.lang.Object item()
Returns the item (value) part of the supplier object.

Returns:
the item (value) part of the supplier object

index

public java.lang.Object index()
Returns the index part of the supplier object.

Returns:
the index part of the supplier object

hasMoreElements

public boolean hasMoreElements()
Implements the interface java.util.Enumeration.hasMoreElements().

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
                             throws java.util.NoSuchElementException
Implements the interface java.util.Enumeration.nextElement().

Specified by:
nextElement in interface java.util.Enumeration
Throws:
java.util.NoSuchElementException - raised, if using the Enumerator interface and moving beyond the end of the supplier object.