org.jmodelica.modelica.compiler.Index Class Reference

Represents the index/indices of a single cell in an (possibly multi-dimensional) array. More...

Inheritance diagram for org.jmodelica.modelica.compiler.Index:

org.jmodelica.modelica.compiler.Indices.Indices.IIndex

List of all members.

Public Member Functions

 Index (int[] ind)
 Construct an Index representing the indices given in ind.
int[] index ()
 Returns the indices that specify this cell.
int ndims ()
 Returns the number of dimensions of this Index.
int first ()
 Returns the index for the first dimension.
int last ()
 Returns the index for the last dimension.
int get (int i)
 Returns the index for the ith dimension (zero-based).
void set (int i, int index)
 Sets the index for the ith dimension (zero-based).
boolean equals (Object i)
 Compare two Index for equality.
int hashCode ()
 Calculate hash code.
Index subIndex (int level)
 Creates a new Index that describes the last ndims() - level dimensions of this Index.
Index adjusted (int dim, int adj, int ndims)
 Creates a new Index that is a copy of this Index, but with adj added to dimension dim and promoted to ndims dimensions by adding ones to the end.
FArraySubscripts createFArraySubscripts ()
 Create a new FArraySubscripts object describing this index.
Index clone ()
 Copies this Index.
Index expand (Index i)
 Return an Index that is the result of appending i to this Index.
String toString ()
 Return a string representation on the form "[i1, i2, i3]".
String toUnclosedString ()
 Return a string representation on the form "i1, i2, i3".
int internal (Indices ind)
 Return the internal index in an Array of the cell this Index refers to.

Static Public Attributes

static final Index NULL = new Index(0)
static Index expanded = NULL

Protected Member Functions

 Index ()
 Construct an empty Index.
 Index (int ndims)
 Construct an Index of ndims dimensions, pointing at the spot before the first cell.

Protected Attributes

int[] index


Detailed Description

Represents the index/indices of a single cell in an (possibly multi-dimensional) array.

Index objects are reused to a high degree. Always use clone() when retaining an Index object. class :0


Constructor & Destructor Documentation

org.jmodelica.modelica.compiler.Index.Index ( int[]  ind  ) 

Construct an Index representing the indices given in ind.

org.jmodelica.modelica.compiler.Index.Index (  )  [protected]

Construct an empty Index.

org.jmodelica.modelica.compiler.Index.Index ( int  ndims  )  [protected]

Construct an Index of ndims dimensions, pointing at the spot before the first cell.


Member Function Documentation

Index org.jmodelica.modelica.compiler.Index.adjusted ( int  dim,
int  adj,
int  ndims 
)

Creates a new Index that is a copy of this Index, but with adj added to dimension dim and promoted to ndims dimensions by adding ones to the end.

The new Index will not be bound to any Indices object.

Index org.jmodelica.modelica.compiler.Index.clone (  ) 

Copies this Index.

Always use clone() when saving an Index.

FArraySubscripts org.jmodelica.modelica.compiler.Index.createFArraySubscripts (  ) 

Create a new FArraySubscripts object describing this index.

boolean org.jmodelica.modelica.compiler.Index.equals ( Object  i  ) 

Compare two Index for equality.

Index org.jmodelica.modelica.compiler.Index.expand ( Index  i  ) 

Return an Index that is the result of appending i to this Index.

Parameters:
i the Index to append.

int org.jmodelica.modelica.compiler.Index.first (  ) 

Returns the index for the first dimension.

int org.jmodelica.modelica.compiler.Index.get ( int  i  ) 

Returns the index for the ith dimension (zero-based).

int org.jmodelica.modelica.compiler.Index.hashCode (  ) 

Calculate hash code.

Creates perfect hash when ndims() <= 3 and all indices are <= 1023.

Returns the indices that specify this cell.

int org.jmodelica.modelica.compiler.Index.internal ( Indices  ind  ) 

Return the internal index in an Array of the cell this Index refers to.

Only for use from Array.

Parameters:
indices the indices to resolve the internal index with

Reimplemented in org.jmodelica.modelica.compiler.Indices.Indices.IIndex.

int org.jmodelica.modelica.compiler.Index.last (  ) 

Returns the index for the last dimension.

int org.jmodelica.modelica.compiler.Index.ndims (  ) 

Returns the number of dimensions of this Index.

void org.jmodelica.modelica.compiler.Index.set ( int  i,
int  index 
)

Sets the index for the ith dimension (zero-based).

Index org.jmodelica.modelica.compiler.Index.subIndex ( int  level  ) 

Creates a new Index that describes the last ndims() - level dimensions of this Index.

Parameters:
level the first index to copy. Must be between 0 and ndims(), inclusive.

String org.jmodelica.modelica.compiler.Index.toString (  ) 

Return a string representation on the form "[i1, i2, i3]".

String org.jmodelica.modelica.compiler.Index.toUnclosedString (  ) 

Return a string representation on the form "i1, i2, i3".


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Fri Oct 7 14:50:38 2011 for JModelica.org by  doxygen 1.5.8