Package com.anylogic.engine
- java.lang.Object
- com.anylogic.engine.Dimension
- All Implemented Interfaces:
Serializable
public final class Dimension extends Object implements 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.
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
Modifier and Type | Field | Description |
---|---|---|
static final String | DIMENSIONS_CONTAINER_CLASS_NAME |
Deprecated.
|
final int[] | indexes |
An array of indexes included in this dimension.
|
Constructor | Description |
---|---|
Dimension |
Creates a top-level dimension with a given name and given set of integer
indexes not having names.
|
Dimension |
Creates a top-level dimension with a given name and given set of integer
indexes, each having a name.
|
Dimension |
Creates a sub-dimension of another dimension.
|
Dimension |
Creates a sub-dimension of another dimension.
|
Dimension |
Creates a top-level dimension with a given name and given set of integer
indexes not having names.
|
Modifier and Type | Method | Description |
---|---|---|
int | getIndexByName |
Returns the index having the specified textual name.
|
int | getIndexByPosition |
Returns the index having the specified position in this dimension
(from 0 to size()-1).
|
String | getIndexName |
Returns the textual name of the given index, or its formatted integer
value in case index name is not set.
|
String | getIndexNameByPosition |
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 |
Returns the position of an index in this dimension, starting from 0.
|
int | getIndexPositionByName |
Returns the position of the index in this dimension (from 0 to size()-1)
having the specified textual name.
|
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 |
Deprecated.
|
int | size() |
Returns the number of indexes in the dimension.
|
@Deprecated public static final String DIMENSIONS_CONTAINER_CLASS_NAME
Deprecated.
- See Also:
- Constant Field Values
public final transient int[] indexes
An array of indexes included in this dimension.
public Dimension(String packageName, 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 toname
- the name of the dimensionindexes
- the set of indexes (nonnegative integers)
public Dimension(String packageName, String name, 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 toname
- the name of the dimensionindexes
- the string with a set of ranges and indexes (nonnegative integers), e.g."1,3,90-100, 70"
public Dimension(String packageName, String name, int[] indexes, 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 toname
- the name of the dimensionindexes
- the set of indexes (nonnegative integers)indexnames
- index names, a name for each index
public Dimension(String packageName, 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 toname
- the name of the dimensionsuperdim
- the super-dimensionindexes
- the set of indexes (nonnegative integers)
public Dimension(String packageName, String name, Dimension superdim, 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 toname
- the name of the dimensionsuperdim
- the super-dimensionindexes
- the string with a set of ranges and indexes (nonnegative integers), e.g."1,3,90-100, 70"
@AnyLogicInternalCodegenAPI @Deprecated public static int[] parseRangeIndexes(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
public String getName()
Returns the name of the dimension.
- Returns:
- the name of the dimension
public int size()
Returns the number of indexes in the dimension.
- Returns:
- the number of indexes in the dimension
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
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
public 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
public 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 range0...size() - 1
)- Returns:
- the name of the index located at the given position
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
public int getIndexByName(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
public int getIndexPositionByName(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