Initializing help system before first use

XPRMSet

  • All Implemented Interfaces:
    XPRMTyped


    public abstract class XPRMSet
    extends XPRMValue
    A set in Mosel.
    • Method Detail

      • asSet

        public final XPRMSet asSet()
        Description copied from class: XPRMValue
        A set. This function is defined if the actual object is a set.
        Overrides:
        asSet in class  XPRMValue
        Returns:
        The set as a XPRMSet
      • 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:
        true if the set has been created
      • isRange

        public final boolean isRange()
        Check whether the set is a range set.
        Returns:
        true ifthe set is a range set
      • isDynamic

        public final boolean isDynamic()
        Check whether the set is dynamic.
        Returns:
        true if 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:
        true if 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:
        true if 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: XPRMTyped
        Type code. The code is one of the TYP_* 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 the STR_* 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 set.
        Overrides:
        toString in class  java.lang.Object
        Returns:
        String describing the set content