XPRMArray
- java.lang.Object
-
- com.dashoptimization.XPRMValue
-
- com.dashoptimization.XPRMArray
-
-
Field Summary
-
Fields inherited from interface com.dashoptimization.XPRMTyped
GRP_DYN, GRP_GEN, MSK_FIN, MSK_GRP, MSK_STR, MSK_TYP, STR_ARRAY, STR_CONST, STR_LIST, STR_MEM, STR_NTYP, STR_PROB, STR_PROC, STR_REC, STR_REF, STR_SET, STR_UTYP, TYP_BOOL, TYP_EXTN, TYP_INT, TYP_LINCTR, TYP_MPVAR, TYP_NOT, TYP_REAL, TYP_STRING
-
-
Method Summary
Modifier and Type Method and Description XPRMArray
asArray()
An array.XPRMValue
get(int ndx)
Get the cell content associated to the given index (1 dim.XPRMValue
get(int[] ndx)
Get the cell content associated to the given index.XPRMValue
get(int ndx1, int ndx2)
Get the cell content associated to the given index (2 dim.XPRMValue
get(int ndx1, int ndx2, int ndx3)
Get the cell content associated to the given index (3 dim.boolean
getAsBoolean(int ndx)
Get the cell content associated to the given index (1 dim.boolean
getAsBoolean(int[] ndx)
Get the cell content associated to the given index (array of Booleans).boolean
getAsBoolean(int n1, int n2)
Get the cell content associated to the given index (2 dim.boolean
getAsBoolean(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim.int
getAsInteger(int ndx)
Get the cell content associated to the given index (1 dim.int
getAsInteger(int[] ndx)
Get the cell content associated to the given index (array of integers).int
getAsInteger(int n1, int n2)
Get the cell content associated to the given index (2 dim.int
getAsInteger(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim.double
getAsReal(int ndx)
Get the cell content associated to the given index (1 dim.double
getAsReal(int[] ndx)
Get the cell content associated to the given index (array of reals).double
getAsReal(int n1, int n2)
Get the cell content associated to the given index (2 dim.double
getAsReal(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim.java.lang.String
getAsString(int ndx)
Get the cell content associated to the given index (1 dim.java.lang.String
getAsString(int[] ndx)
Get the cell content associated to the given index (array of strings).java.lang.String
getAsString(int n1, int n2)
Get the cell content associated to the given index (2 dim.java.lang.String
getAsString(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim.int
getDimension()
Get array dimension.int[]
getFirstIndex()
Get the index of the first cell of the array.int[]
getFirstTEIndex()
Get the index of the first defined cell of the array.XPRMSet[]
getIndexSets()
Get the sets indexing the array.int[]
getLastIndex()
Get the index of the last cell of the array.java.lang.String
getSignature()
Get array signature (requirement only).int
getSize()
Get array size.int
getStructCode()
Structure code.java.lang.String
getStructName()
String representation of structure.int
getTypeCode()
Type code.java.lang.String
getTypeName()
String representation of type.XPRMArrayIndices
indices(boolean trueIndices)
Get an iterator to enumerate all valid indices of the array.boolean
isDynamic()
Check whether the array is dynamic.boolean
isEmpty()
Check whether the array is empty.boolean
isInitialised()
Check whether the array has been initialised.boolean
nextIndex(int[] indices)
Update the given index to point to the next cell in the array.boolean
nextTEIndex(int[] indices)
Update the given index to point to the next defined cell in the array.java.lang.String
toString()
Generate a string representation of the content of the array.
-
-
-
Method Detail
-
asArray
public final XPRMArray asArray()
Description copied from class:XPRMValue
An array. This function is defined if the actual object is an array.
-
isInitialised
public final boolean isInitialised()
Check whether the array has been initialised. Objects are initialised during model execution. Trying to access a Mosel object that has not been created will result on an exception.- Returns:
-
true
if the array has been created
-
isDynamic
public final boolean isDynamic()
Check whether the array is dynamic.- Returns:
-
true
if the array is dynamic
-
getSize
public final int getSize()
Get array size.- Returns:
- Number of cells in the array
-
getDimension
public final int getDimension()
Get array dimension.- Returns:
- Number indices required to access a cell
-
getSignature
public final java.lang.String getSignature()
Get array signature (requirement only). Required arrays are specified by their type and signature. The signature is the list of names of the indexing sets stored in a text string (e.g."S1,S2,S3")
.- Returns:
- Index sets names as a text string
-
isEmpty
public final boolean isEmpty()
Check whether the array is empty.- Returns:
-
true
if the array contains no cell
-
getIndexSets
public final XPRMSet[] getIndexSets()
Get the sets indexing the array.- Returns:
-
An array of
XPRMSet
of sizegetDimension()
-
getFirstIndex
public final int[] getFirstIndex()
Get the index of the first cell of the array.- Returns:
-
An array of size
getDimension()
pointing to the first cell in the array
-
getFirstTEIndex
public final int[] getFirstTEIndex()
Get the index of the first defined cell of the array. Dynamic arrays do not necessarily have a defined cell for each index.- Returns:
-
An array of size
getDimension()
pointing to the first defined cell in the array
-
getLastIndex
public final int[] getLastIndex()
Get the index of the last cell of the array.- Returns:
-
An array of size
getDimension()
pointing to the last cell in the array
-
indices
public final XPRMArrayIndices indices(boolean trueIndices)
Get an iterator to enumerate all valid indices of the array.- Parameters:
-
trueIndices
- iftrue
enumerate only indices for defined cells - Returns:
- An indices iterator
-
nextIndex
public final boolean nextIndex(int[] indices)
Update the given index to point to the next cell in the array.- Parameters:
-
indices
- array of indices - Returns:
-
false
if the provided index points to the last cell in the array
-
nextTEIndex
public final boolean nextTEIndex(int[] indices)
Update the given index to point to the next defined cell in the array.- Parameters:
-
indices
- array of indices - Returns:
-
false
if the provided index points to the last defined cell in the array
-
get
public final XPRMValue get(int[] ndx)
Get the cell content associated to the given index.- Parameters:
-
ndx
- array of indices - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
get
public final XPRMValue get(int ndx)
Get the cell content associated to the given index (1 dim. array).- Parameters:
-
ndx
- index - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of bounds.
-
get
public final XPRMValue get(int ndx1, int ndx2)
Get the cell content associated to the given index (2 dim. array).- Parameters:
-
ndx1
- index for the first dimension -
ndx2
- index for the second dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
get
public final XPRMValue get(int ndx1, int ndx2, int ndx3)
Get the cell content associated to the given index (3 dim. array).- Parameters:
-
ndx1
- index for the first dimension -
ndx2
- index for the second dimension -
ndx3
- index for the third dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsInteger
public int getAsInteger(int[] ndx)
Get the cell content associated to the given index (array of integers).- Parameters:
-
ndx
- array of indices - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsInteger
public int getAsInteger(int ndx)
Get the cell content associated to the given index (1 dim. array of integers).- Parameters:
-
ndx
- index - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of bounds.
-
getAsInteger
public int getAsInteger(int n1, int n2)
Get the cell content associated to the given index (2 dim. array of integers).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsInteger
public int getAsInteger(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim. array of integers).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension -
n3
- index for the third dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsReal
public double getAsReal(int[] ndx)
Get the cell content associated to the given index (array of reals).- Parameters:
-
ndx
- array of indices - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsReal
public double getAsReal(int ndx)
Get the cell content associated to the given index (1 dim. array of reals).- Parameters:
-
ndx
- index - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of bounds.
-
getAsReal
public double getAsReal(int n1, int n2)
Get the cell content associated to the given index (2 dim. array of reals).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsReal
public double getAsReal(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim. array of reals).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension -
n3
- index for the third dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsBoolean
public boolean getAsBoolean(int[] ndx)
Get the cell content associated to the given index (array of Booleans).- Parameters:
-
ndx
- array of indices - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsBoolean
public boolean getAsBoolean(int ndx)
Get the cell content associated to the given index (1 dim. array of Booleans).- Parameters:
-
ndx
- index - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of bounds.
-
getAsBoolean
public boolean getAsBoolean(int n1, int n2)
Get the cell content associated to the given index (2 dim. array of Booleans).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsBoolean
public boolean getAsBoolean(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim. array of Booleans).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension -
n3
- index for the third dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsString
public java.lang.String getAsString(int[] ndx)
Get the cell content associated to the given index (array of strings).- Parameters:
-
ndx
- array of indices - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsString
public java.lang.String getAsString(int ndx)
Get the cell content associated to the given index (1 dim. array of strings).- Parameters:
-
ndx
- index - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of bounds.
-
getAsString
public java.lang.String getAsString(int n1, int n2)
Get the cell content associated to the given index (2 dim. array of strings).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getAsString
public java.lang.String getAsString(int n1, int n2, int n3)
Get the cell content associated to the given index (3 dim. array of strings).- Parameters:
-
n1
- index for the first dimension -
n2
- index for the second dimension -
n3
- index for the third dimension - Returns:
- Cell associated to the given index
- Throws:
-
java.lang.ArrayIndexOutOfBoundsException
- If one of the indices is out of bounds.
-
getTypeCode
public final int getTypeCode()
Description copied from interface:XPRMTyped
Type code. The code is one of theTYP_*
values.- Returns:
- Encoded type
-
getTypeName
public final java.lang.String getTypeName()
Description copied from interface:XPRMTyped
String representation of type.- Returns:
- Type name
-
getStructCode
public final int getStructCode()
Description copied from interface:XPRMTyped
Structure code. The code is one of theSTR_*
values.- Returns:
- Encoded structure
-
getStructName
public final java.lang.String getStructName()
Description copied from interface:XPRMTyped
String representation of structure.- Returns:
- Structure name
-
toString
public final java.lang.String toString()
Generate a string representation of the content of the array.- Overrides:
-
toString
in classjava.lang.Object
- Returns:
- String describing the array content
-
-
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.