Package org.rexxla.bsf.engines.rexx
Class Supplier
java.lang.Object
org.rexxla.bsf.engines.rexx.Supplier
- All Implemented Interfaces:
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.
------------------------ Apache Version 2.0 license -------------------------
Copyright (C) 2001-2021 Rony G. Flatscher
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
----------------------------------------------------------------------------- - Version:
- 1.06, 20210209
- Author:
- Rony G. Flatscher (WU-Wien/Wirtschaftsuniversität Wien, http://www.wu-wien.ac.at/english)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of the class using theArrayWrapperclass.Creates an instance of the class.Creates an instance of the class using theArrayWrapperclass. -
Method Summary
Modifier and TypeMethodDescriptionObject[]Returns single dimensioned (Java) array object containing the remaining indexes.Object[]allItems()Returns single dimensioned (Java) array object containing the remaining items.booleanTests whether an index/value pair is available.booleanImplements the interfacejava.util.Enumeration.hasMoreElements().index()Returns the index part of the supplier object.item()Returns the item (value) part of the supplier object.voidnext()Move to the next item/value pair, if any.Implements the interfacejava.util.Enumeration.nextElement().supplier()Returns the Supplier object itself.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Enumeration
asIterator
-
Field Details
-
version
Version string indicating version of this class (majorVersion*100+minorVersion concatenated with a dot and the sorted date of last change.
-
-
Constructor Details
-
Supplier
public Supplier(Object arrObject, boolean bRexxStyle) throws ClassNotFoundException, org.apache.bsf.BSFException Creates an instance of the class using theArrayWrapperclass.- Parameters:
arrObject- an array (of any dimension)bRexxStyle-trueformat index-part in Object Rexx style (indexing starts with1and multiple indices are delimited with commas),falseformat index-part in Java style (indexing starts with0and multiple indices are delimited by enclosing each index in square brackets)- Throws:
ClassNotFoundExceptionorg.apache.bsf.BSFException
-
Supplier
Creates an instance of the class using theArrayWrapperclass. Uses the Java style of indexing for the index part of the supplier object.- Parameters:
arrObject- an array (of any dimension)- Throws:
ClassNotFoundExceptionorg.apache.bsf.BSFException
-
Supplier
Creates an instance of the class.- Parameters:
values- a single-dimensioned array containing the values (items)indices- a single-dimensioned array containing the indices ofv
-
-
Method Details
-
allIndexes
Returns single dimensioned (Java) array object containing the remaining indexes. Like in ooRexx 3.2.0 the array will only contain all elements starting from the current pointed to element on (i.e., index/item pairs already processed will not show up in the returned array object). The supplier object itself is considered to be exhausted from this time on, such thatavailable()will returnfalse
.- Returns:
- single dimensioned array object containing the remaining indexes.
-
allItems
Returns single dimensioned (Java) array object containing the remaining items. Like in ooRexx 3.2.0 the array will only contain all elements starting from the current pointed to element on (i.e., index/item pairs already processed will not show up in the returned array object). The supplier object itself is considered to be exhausted from this time on, such thatavailable()will returnfalse
.- Returns:
- single dimensioned array object containing the remaining items.
-
available
public boolean available()Tests whether an index/value pair is available.- Returns:
true, if an index/value pair is available,falseelse.
-
next
public void next()Move to the next item/value pair, if any. -
item
Returns the item (value) part of the supplier object.- Returns:
- the item (value) part of the supplier object
-
index
Returns the index part of the supplier object.- Returns:
- the index part of the supplier object
-
supplier
Returns the Supplier object itself.- Returns:
- this Supplier object
-
hasMoreElements
public boolean hasMoreElements()Implements the interfacejava.util.Enumeration.hasMoreElements().- Specified by:
hasMoreElementsin interfaceEnumeration
-
nextElement
Implements the interfacejava.util.Enumeration.nextElement().- Specified by:
nextElementin interfaceEnumeration- Throws:
NoSuchElementException- raised, if using the Enumerator interface and moving beyond the end of the supplier object.
-