public class ArrayWrapper
extends java.lang.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. -----------------------------------------------------------------------------
Modifier and Type | Field and Description |
---|---|
java.lang.Class |
componentType |
int |
dimensions
Stores the total number of dimensions.
|
int |
items
Stores the total size (maximum number of entries) of the entire array.
|
int[] |
sizeOfDimension
Array of
int which stores the size (maximum number of entries) of the appropriate dimension. |
static java.lang.String |
version
Version string indicating version of this class (majorVersion*100+minorVersion
concatenated with a dot and the sorted date of last change.
|
Constructor and Description |
---|
ArrayWrapper(java.lang.Object objArray)
Creates and returns an instance of this class, allowing easier access to Java arrays.
|
Modifier and Type | Method and Description |
---|---|
int |
dimension(int i)
Returns the size of the given dimension.
|
java.lang.Object |
get(int[] idxArr)
Get a value (item, element) from the array at the given position.
|
java.lang.Object[] |
makearray(boolean bSupplier,
boolean bRexxStyle)
Modelled after Object Rexx
MAKEARRAY method of the array class. |
void |
put(java.lang.Object valueObj,
int[] idxArr)
Put a value (item, element) into the array object at the given position.
|
Supplier |
supplier()
Creates a supplier object for allowing to enumerate the array together with
the appropriate indices (Java style: index starts with
0 and is
enclosed in square brackets). |
Supplier |
supplier(boolean bRexxStyle)
Creates a supplier object for allowing to enumerate the array together with
the appropriate indices.
|
RexxProxy |
supplier(RexxProxy clzSupplier)
Creates a Rexx supplier object (from the supplied ooRexx .Supplier class object)
for allowing to enumerate the array together with the appropriate indices.
|
public static java.lang.String version
public int dimensions
public int[] sizeOfDimension
int
which stores the size (maximum number of entries) of the appropriate dimension.public int items
public java.lang.Class componentType
public ArrayWrapper(java.lang.Object objArray) throws java.lang.ClassNotFoundException, org.apache.bsf.BSFException
get(int[] idxArr)
, put(Object valueObj, int[] idxArr)
,
supplier()
, supplier(boolean bRexxStyle)
and
( boolean bSupplier, boolean bRexxStyle )
are modelled after ooRexx (eg. cf. ooRexx class
Array
).objArray
- the array object for which an ArrayWrapper instance is soughtjava.lang.ClassNotFoundException
org.apache.bsf.BSFException
public int dimension(int i)
i
- indicates the dimension of interest (Java index, i.e. first dimension to be
indicated/indexed with the value 0
).public java.lang.Object get(int[] idxArr)
idxArr
- a one-dimensional array of int
s determining the location in the array.public void put(java.lang.Object valueObj, int[] idxArr)
idxArr
- a one-dimensional array of int
s determining the location in the array.valueObj
- the Object to store; in the case of primitives the appropriate conversions
takes place, curtesy of Array
.public Supplier supplier()
0
and is
enclosed in square brackets).Supplier
, allowing for enumerating the contents of the array.public Supplier supplier(boolean bRexxStyle)
bRexxStyle
- determines whether the index value is [Object] Rexx
style (index starts with 1
, multiple indices are separated by a comma)
or Java style (index starts with 0
, indices are enclosed in square brackets)Supplier
, allowing for enumerating the contents of the array.public RexxProxy supplier(RexxProxy clzSupplier) throws org.apache.bsf.BSFException
clzSupplier
- the ooRexx "Supplier" class object to be used for creating
a genuine ooRexx supplier (to allow ooRexx 5.0 new "DO WITH" to work)RexxProxy
)org.apache.bsf.BSFException
public java.lang.Object[] makearray(boolean bSupplier, boolean bRexxStyle)
MAKEARRAY
method of the array class. This
method is executed synchronized.bSupplier
- boolean value to indicate whether a supplier
array (containing the appropriate indices as Strings) is to be prepared and returned (if set to true
).bRexxStyle
- boolean value to indicate whether using Rexx (index starts at: 1
) or Java (index starts at: 0
) style for creating the indices for a supplier
.