XPRMSet
- java.lang.Object
-
- com.dashoptimization.XPRMValue
-
- com.dashoptimization.XPRMSet
-
-
Field Summary
-
Fields inherited from interface com.dashoptimization.XPRMTyped
GRP_DYN, GRP_GEN, MSK_FIX, MSK_GRP, MSK_STR, MSK_TYP, STR_ARRAY, STR_CONST, STR_CSREF, 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 XPRMSetasSet()A set.XPRMValueget(int index)Get the element associated to the given index.booleangetAsBoolean(int index)Get the element associated to the given index (set of Booleans).intgetAsInteger(int index)Get the element associated to the given index (set of integers).doublegetAsReal(int index)Get the element associated to the given index (set of reals).java.lang.StringgetAsString(int index)Get the element associated to the given index (set of strings).intgetFirstIndex()Get the index of the first element in the set.intgetIndex(boolean b)Get the index of the given element (set of Booleans).intgetIndex(double r)Get the index of the given element (set of reals).intgetIndex(int i)Get the index of the given element (set of integers).intgetIndex(java.lang.String s)Get the index of the given element (set of strings).abstract intgetIndex(XPRMValue v)Get the index of the given element.intgetLastIndex()Get the index of the last element in the set.intgetSize()Get set size.intgetStructCode()Structure code.java.lang.StringgetStructName()String representation of structure.intgetTypeCode()Type code.java.lang.StringgetTypeName()String representation of type.booleanisDynamic()Check whether the set is dynamic.booleanisEmpty()Check whether the set is empty.booleanisFixed()Check whether the set is fixed.booleanisInitialised()Check whether the set has been initialised.booleanisRange()Check whether the set is a range set.java.lang.StringtoString()Generate a string representation of the content of the set.
-
-
-
Method Detail
-
asSet
public final XPRMSet asSet()
Description copied from class:XPRMValueA set. This function is defined if the actual object is a set.
-
isInitialised
public final boolean isInitialised()
Check whether the set 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:
-
trueif the set has been created
-
isRange
public final boolean isRange()
Check whether the set is a range set.- Returns:
-
trueifthe set is a range set
-
isDynamic
public final boolean isDynamic()
Check whether the set is dynamic.- Returns:
-
trueif the set is dynamic
-
isFixed
public final boolean isFixed()
Check whether the set is fixed. A dynamic set is "fixed" when it is used to index an array: it may be extended by receiving new elements but it cannot be re-assigned or reduced.- Returns:
-
trueif the set is fixed
-
getSize
public final int getSize()
Get set size.- Returns:
- Number of elements in the set
-
isEmpty
public final boolean isEmpty()
Check whether the set is empty.- Returns:
-
trueif the set contains no element
-
getFirstIndex
public final int getFirstIndex()
Get the index of the first element in the set. From the library, set elements are accessed using an index.- Returns:
- Index of the first element
-
getLastIndex
public final int getLastIndex()
Get the index of the last element in the set. From the library, set elements are accessed using an index.- Returns:
- Index of the last element
-
getIndex
public abstract int getIndex(XPRMValue v)
Get the index of the given element.- Parameters:
-
v- element to search - Returns:
- Index of the given element or a negative value if the set does not contain this element
-
getIndex
public int getIndex(int i)
Get the index of the given element (set of integers).- Parameters:
-
i- element to search - Returns:
- Index of the given element or a negative value if the set does not contain this element
-
getIndex
public int getIndex(double r)
Get the index of the given element (set of reals).- Parameters:
-
r- element to search - Returns:
- Index of the given element or a negative value if the set does not contain this element
-
getIndex
public int getIndex(boolean b)
Get the index of the given element (set of Booleans).- Parameters:
-
b- element to search - Returns:
- Index of the given element or a negative value if the set does not contain this element
-
getIndex
public int getIndex(java.lang.String s)
Get the index of the given element (set of strings).- Parameters:
-
s- element to search - Returns:
- Index of the given element or a negative value if the set does not contain this element
-
get
public final XPRMValue get(int index)
Get the element associated to the given index.- Parameters:
-
index- index of the element to retrieve - Returns:
- Element associated to the given index
- Throws:
-
java.util.NoSuchElementException- If the index corresponds to no element in the set.
-
getAsInteger
public int getAsInteger(int index)
Get the element associated to the given index (set of integers).- Parameters:
-
index- index of the element to retrieve - Returns:
- Element associated to the given index
- Throws:
-
java.util.NoSuchElementException- If the index corresponds to no element in the set.
-
getAsReal
public double getAsReal(int index)
Get the element associated to the given index (set of reals).- Parameters:
-
index- index of the element to retrieve - Returns:
- Element associated to the given index
- Throws:
-
java.util.NoSuchElementException- If the index corresponds to no element in the set.
-
getAsBoolean
public boolean getAsBoolean(int index)
Get the element associated to the given index (set of Booleans).- Parameters:
-
index- index of the element to retrieve - Returns:
- Element associated to the given index
- Throws:
-
java.util.NoSuchElementException- If the index corresponds to no element in the set.
-
getAsString
public java.lang.String getAsString(int index)
Get the element associated to the given index (set of strings).- Parameters:
-
index- index of the element to retrieve - Returns:
- Element associated to the given index
- Throws:
-
java.util.NoSuchElementException- If the index corresponds to no element in the set.
-
getTypeCode
public final int getTypeCode()
Description copied from interface:XPRMTypedType code. The code is one of theTYP_*values.- Returns:
- Encoded type
-
getTypeName
public final java.lang.String getTypeName()
Description copied from interface:XPRMTypedString representation of type.- Returns:
- Type name
-
getStructCode
public final int getStructCode()
Description copied from interface:XPRMTypedStructure code. The code is one of theSTR_*values.- Returns:
- Encoded structure
-
getStructName
public final java.lang.String getStructName()
Description copied from interface:XPRMTypedString representation of structure.- Returns:
- Structure name
-
toString
public final java.lang.String toString()
Generate a string representation of the content of the set.- Overrides:
-
toStringin classjava.lang.Object - Returns:
- String describing the set content
-
-
