AnyLogic
Expand
Font size
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.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Modifier and TypeFieldDescription
static final StringDIMENSIONS_CONTAINER_CLASS_NAME
Deprecated.
final int[]indexes
An array of indexes included in this dimension.

Constructor Summary

ConstructorDescription
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.
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.
Dimension(String packageName, String name, Dimension superdim, int... indexes)
Creates a sub-dimension of another dimension.
Dimension(String packageName, String name, Dimension superdim, String indexes)
Creates a sub-dimension of another dimension.
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.

Method Summary

Modifier and TypeMethodDescription
intgetIndexByName(String name)
Returns the index having the specified textual name.
intgetIndexByPosition(int position)
Returns the index having the specified position in this dimension (from 0 to size()-1).
StringgetIndexName(int ind)
Returns the textual name of the given index, or its formatted integer value in case index name is not set.
StringgetIndexNameByPosition(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.
intgetIndexPosition(int ind)
Returns the position of an index in this dimension, starting from 0.
intgetIndexPositionByName(String name)
Returns the position of the index in this dimension (from 0 to size()-1) having the specified textual name.
StringgetName()
Returns the name of the dimension.
DimensiongetSuperDimension()
Returns super-dimension of this dimension or null if this is a top-level dimension.
static int[]parseRangeIndexes(String str)
Deprecated.
intsize()
Returns the number of indexes in the dimension.

Methods inherited from class java.lang.Object

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

Field Details

DIMENSIONS_CONTAINER_CLASS_NAME

@Deprecated
public static final 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 Details

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 to
name - the name of the dimension
indexes - the set of indexes (nonnegative integers)

Dimension

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 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(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 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(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 to
name - the name of the dimension
superdim - the super-dimension
indexes - the set of indexes (nonnegative integers)

Dimension

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 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 Details

parseRangeIndexes

@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

getName

public 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 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 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(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(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