AnyLogic
Expand
Font size
  • java.lang.Object
    • com.anylogic.engine.Dimension
All Implemented Interfaces:
java.io.Serializable

public final class Dimension
extends java.lang.Object
implements java.io.Serializable
A dimension of a HyperArray - a set of non-negative integers (or identifiers mapped to non-negative integers) that are used as indexes in hyper arrays. An index cannot be included in a dimension more than once.
A dimension can be a sub-dimension of another dimension, in this case it contains a subset (or maybe a full set) of the super dimension indexes. The top level dimension in the dimension hierarchy does not have a super- dimension.
Optionally, you can provide names for indexes at a top-level dimension.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Fields 
static java.lang.String DIMENSIONS_CONTAINER_CLASS_NAME
Deprecated.
int[] indexes
An array of indexes included in this dimension.
Modifier and Type Field Description

Constructor Summary

Constructors 
Dimension​(java.lang.String packageName, java.lang.String name, int... indexes)
Creates a top-level dimension with a given name and given set of integer indexes not having names.
Dimension​(java.lang.String packageName, java.lang.String name, int[] indexes, java.lang.String[] indexnames)
Creates a top-level dimension with a given name and given set of integer indexes, each having a name.
Dimension​(java.lang.String packageName, java.lang.String name, Dimension superdim, int... indexes)
Creates a sub-dimension of another dimension.
Dimension​(java.lang.String packageName, java.lang.String name, Dimension superdim, java.lang.String indexes)
Creates a sub-dimension of another dimension.
Dimension​(java.lang.String packageName, java.lang.String name, java.lang.String indexes)
Creates a top-level dimension with a given name and given set of integer indexes not having names.
Constructor Description

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
int getIndexByName​(java.lang.String name)
Returns the index having the specified textual name.
int getIndexByPosition​(int position)
Returns the index having the specified position in this dimension (from 0 to size()-1).
java.lang.String getIndexName​(int ind)
Returns the textual name of the given index, or its formatted integer value in case index name is not set.
java.lang.String getIndexNameByPosition​(int position)
Returns the textual name of the index located at the given position, or formatted integer value of the index in case index name is not set.
int getIndexPosition​(int ind)
Returns the position of an index in this dimension, starting from 0.
int getIndexPositionByName​(java.lang.String name)
Returns the position of the index in this dimension (from 0 to size()-1) having the specified textual name.
java.lang.String getName()
Returns the name of the dimension.
Dimension getSuperDimension()
Returns super-dimension of this dimension or null if this is a top-level dimension.
static int[] parseRangeIndexes​(java.lang.String str)
Deprecated.
int size()
Returns the number of indexes in the dimension.
Modifier and Type Method Description

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

DIMENSIONS_CONTAINER_CLASS_NAME

@Deprecated
public static final java.lang.String DIMENSIONS_CONTAINER_CLASS_NAME
Deprecated.
See Also:
Constant Field Values

indexes

public final transient int[] indexes
An array of indexes included in this dimension.

Constructor Detail

Dimension

public Dimension​(java.lang.String packageName,
                 java.lang.String name,
                 int... indexes)
Creates a top-level dimension with a given name and given set of integer indexes not having names. Such dimension may not be a sub-dimension of another dimension.
Parameters:
packageName - the name of the model package this dimension belongs to
name - the name of the dimension
indexes - the set of indexes (nonnegative integers)

Dimension

public Dimension​(java.lang.String packageName,
                 java.lang.String name,
                 java.lang.String indexes)
Creates a top-level dimension with a given name and given set of integer indexes not having names. Such dimension may not be a sub-dimension of another dimension.
Parameters:
packageName - the name of the model package this dimension belongs to
name - the name of the dimension
indexes - the string with a set of ranges and indexes (nonnegative integers), e.g. "1,3,90-100, 70"

Dimension

public Dimension​(java.lang.String packageName,
                 java.lang.String name,
                 int[] indexes,
                 java.lang.String[] indexnames)
Creates a top-level dimension with a given name and given set of integer indexes, each having a name. Such dimension may not be a sub-dimension of another dimension.
Parameters:
packageName - the name of the model package this dimension belongs to
name - the name of the dimension
indexes - the set of indexes (nonnegative integers)
indexnames - index names, a name for each index

Dimension

public Dimension​(java.lang.String packageName,
                 java.lang.String name,
                 Dimension superdim,
                 int... indexes)
Creates a sub-dimension of another dimension. The indexes listed must be included in the super-dimension index set. For index names the this dimension will lookup its super dimension.
Parameters:
packageName - the name of the model package this dimension belongs to
name - the name of the dimension
superdim - the super-dimension
indexes - the set of indexes (nonnegative integers)

Dimension

public Dimension​(java.lang.String packageName,
                 java.lang.String name,
                 Dimension superdim,
                 java.lang.String indexes)
Creates a sub-dimension of another dimension. The indexes listed must be included in the super-dimension index set.
Parameters:
packageName - the name of the model package this dimension belongs to
name - the name of the dimension
superdim - the super-dimension
indexes - the string with a set of ranges and indexes (nonnegative integers), e.g. "1,3,90-100, 70"

Method Detail

parseRangeIndexes

@AnyLogicInternalCodegenAPI
@Deprecated
public static int[] parseRangeIndexes​(java.lang.String str)
Deprecated.
Parses range expression and returns the array of all indexes represented by this range
Parameters:
str - the range expression
Returns:
the array of all indexes represented by this range

getName

public java.lang.String getName()
Returns the name of the dimension.
Returns:
the name of the dimension

size

public int size()
Returns the number of indexes in the dimension.
Returns:
the number of indexes in the dimension

getSuperDimension

public Dimension getSuperDimension()
Returns super-dimension of this dimension or null if this is a top-level dimension.
Returns:
super-dimension of this dimension or null

getIndexPosition

public int getIndexPosition​(int ind)
Returns the position of an index in this dimension, starting from 0.
Parameters:
ind - the index
Returns:
the position of the index

getIndexName

public java.lang.String getIndexName​(int ind)
Returns the textual name of the given index, or its formatted integer value in case index name is not set.
Parameters:
ind - the index
Returns:
the name of the index

getIndexNameByPosition

public java.lang.String getIndexNameByPosition​(int position)
Returns the textual name of the index located at the given position, or formatted integer value of the index in case index name is not set.
Parameters:
position - the position of the index (in the range 0...size() - 1)
Returns:
the name of the index located at the given position

getIndexByPosition

public int getIndexByPosition​(int position)
Returns the index having the specified position in this dimension (from 0 to size()-1).
Parameters:
position - the position of the index in this dimension
Returns:
the index

getIndexByName

public int getIndexByName​(java.lang.String name)
Returns the index having the specified textual name.
Parameters:
name - the name of the index
Returns:
the index, or -1 if not found

getIndexPositionByName

public int getIndexPositionByName​(java.lang.String name)
Returns the position of the index in this dimension (from 0 to size()-1) having the specified textual name.
Parameters:
name - the name of the index
Returns:
the position of the index (in the range 0...size() - 1), or -1 if not found
How can we improve this article?