Initializing help system before first use

XPRMArray

  • All Implemented Interfaces:
    XPRMTyped


    public abstract class XPRMArray
    extends XPRMValue
    An array in Mosel.
    • 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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.
        Overrides:
        asArray in class  XPRMValue
        Returns:
        The list as a XPRMArray
      • 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
      • 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 - if true 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 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 array.
        Overrides:
        toString in class  java.lang.Object
        Returns:
        String describing the array content