org.jmodelica.modelica.compiler.Size Class Reference

An array size. More...

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

org.jmodelica.modelica.compiler.MutableSize

List of all members.

Public Member Functions

 Size (int[] size)
 Constructs a Size with the given lengths.
 Size (int s)
 Convenience constructor to create a on-dimensional size with the given length.
int ndims ()
 Get the number of dimensions.
int get (int i)
 Get length in the ith dimension.
int last ()
 Get length in the last dimension.
boolean has (int i)
 Check if this size has an ith dimension.
int numElements ()
 Returns the number of elements spanned by this Size.
FArraySubscripts flattenFArraySubscripts (FQName prefix)
 Create a new flattened FArraySubscripts object describing this size.
FArraySubscripts rangeFArraySubscripts ()
 Create a new FArraySubscripts object with ranges spanning this size.
boolean isUnknown ()
 Check if any lengths are unknown.
boolean isComplete ()
 Check if all lengths have a value (fix length or integer).
boolean isEmpty ()
 Check is the length in any dimension equals 0.
MutableSize mutableClone ()
 Create a copy of this size as a MutableSize.
Size promote (int dim)
 Create a copy of this with dim dimensions, if necessary adding dimensions of length 1 to the right side, or removing dimensions from the left side.
Size createKnown (FExp exp)
 Return a Size that have the same lengths as this size where they are known, and any that are unknown copied from the size of exp.
boolean equals (Object s)
 Check if another object is equal to this one.
int hashCode ()
 Calculate hash code.
boolean equivalent (Size s, boolean allowUnknown)
 Check if another size is equivalent to this one.
boolean equivalentExcept (Size s, boolean allowUnknown, int dim)
 Check if another size is equivalent to this one, except in a given dimension.
boolean equivalentDim (Size s, boolean allowUnknown, int myDim, int itsDim)
 Check if a specific dimension of another size is equivalent to a specific dimension of this one.
String toString ()
 Returns a string representation on the form "[l1, l2, l3]".
String toUnclosedString ()
 Returns a string representation on the form "l1, l2, l3".
Size contract (int left, int right)
 Creates a new Size that is a copy of this one, but with dimensions removed from each side.
Size contractLeft (int n)
 Creates a new Size that is a copy of this one, but with dimensions removed from the left side.
Size contractRight (int n)
 Creates a new Size that is a copy of this one, but with dimensions removed from the right side.
Size expand (int s)
 Creates a new Size that is a copy of this one, but with one more dimension on the left side.
Size expand (Size s)
 Creates a new Size that is a concatenation of s and this size.
FExp createSizeFExp (int d, Map< ASTNode, FExp > varMap)
 Create an FExp that describes the length of dimension d, given the supplied variable values.
FSubscript createExpandedFSubscript (int d)
 Create an FSubscript that spans the length of dimension d.
FExp createFExp ()
 Create an FExp that describes this size.
FExp createFExp (int d)
 Create an FExp that describes the length of dimension d.
FExp createNumElementsFExp ()
 Create an FExp that describes the number of elements of this size.
FExp createDummyFExp (Map< ASTNode, FExp > varMap)
 Create a dummy expression that has the size described by this Size.
FExp createZeroFExp ()
 Create a zero expression of this size.
Size flatten (FQName prefix, FFunctionVariable fv)
void updateFUnknownSizeExps (AbstractFVariable var)
void printArrayDeclEnd_C (Printer p, PrintStream str, String indent, FExp src)

Static Public Attributes

static final int UNKNOWN = -1
 Used for unknown lengths.
static final Size SCALAR = new Size()
 Used to represent the size of scalar expressions.

Protected Member Functions

FSubscript flattenFSubscript (int i, FQName prefix)
 Create a new flattened FSubscript for dimension i.
FSubscript rangeFSubscript (int i)
 Create a new FSubscript for dimension i.
boolean hasValue (int dim)
 Check if the lengths in the given dimension has a value (fix length or integer).
Size clone ()
 Create a copy of this size.
void fillUnknownFrom (FExp exp)
 For each unknown length, copy the equivalent length from size of exp.
void copyFrom (int d1, FExp exp, int d2)
 Copy value of dimension d2 in other to dimension d1 in this.
String toString (int i)
 Returns a string representation of a single length.

Protected Attributes

int[] size


Detailed Description

An array size.

Can be multi-dimensional. class :0


Constructor & Destructor Documentation

org.jmodelica.modelica.compiler.Size.Size ( int[]  size  ) 

Constructs a Size with the given lengths.

org.jmodelica.modelica.compiler.Size.Size ( int  s  ) 

Convenience constructor to create a on-dimensional size with the given length.


Member Function Documentation

Size org.jmodelica.modelica.compiler.Size.clone (  )  [protected]

Create a copy of this size.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

Size org.jmodelica.modelica.compiler.Size.contract ( int  left,
int  right 
)

Creates a new Size that is a copy of this one, but with dimensions removed from each side.

If nothing is changed, this is returned.

Parameters:
left the number of dimensions to remove from the left side
right the number of dimensions to remove from the right side

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

Size org.jmodelica.modelica.compiler.Size.contractLeft ( int  n  ) 

Creates a new Size that is a copy of this one, but with dimensions removed from the left side.

If nothing is changed, this is returned.

Parameters:
n the number of dimensions of the new size

Size org.jmodelica.modelica.compiler.Size.contractRight ( int  n  ) 

Creates a new Size that is a copy of this one, but with dimensions removed from the right side.

If nothing is changed, this is returned.

Parameters:
n the number of dimensions of the new size

void org.jmodelica.modelica.compiler.Size.copyFrom ( int  d1,
FExp  exp,
int  d2 
) [protected]

Copy value of dimension d2 in other to dimension d1 in this.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

FExp org.jmodelica.modelica.compiler.Size.createDummyFExp ( Map< ASTNode, FExp varMap  ) 

Create a dummy expression that has the size described by this Size.

FSubscript org.jmodelica.modelica.compiler.Size.createExpandedFSubscript ( int  d  ) 

Create an FSubscript that spans the length of dimension d.

If nothing is known of the length of the dimension, an FColonSubscripts is created.

FExp org.jmodelica.modelica.compiler.Size.createFExp ( int  d  ) 

Create an FExp that describes the length of dimension d.

The resulting expression is not expanded like createSizeFExp().

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

FExp org.jmodelica.modelica.compiler.Size.createFExp (  ) 

Create an FExp that describes this size.

The resulting expression is not expanded like createSizeFExp().

Size org.jmodelica.modelica.compiler.Size.createKnown ( FExp  exp  ) 

Return a Size that have the same lengths as this size where they are known, and any that are unknown copied from the size of exp.

If the size of exp have more dimensions, the last part is assumed to match this size.

FExp org.jmodelica.modelica.compiler.Size.createNumElementsFExp (  ) 

Create an FExp that describes the number of elements of this size.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

FExp org.jmodelica.modelica.compiler.Size.createSizeFExp ( int  d,
Map< ASTNode, FExp varMap 
)

Create an FExp that describes the length of dimension d, given the supplied variable values.

Parameters:
varMap a map of variables to replace and expressions to replace them with

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

FExp org.jmodelica.modelica.compiler.Size.createZeroFExp (  ) 

Create a zero expression of this size.

boolean org.jmodelica.modelica.compiler.Size.equals ( Object  s  ) 

Check if another object is equal to this one.

boolean org.jmodelica.modelica.compiler.Size.equivalent ( Size  s,
boolean  allowUnknown 
)

Check if another size is equivalent to this one.

Parameters:
allowUnknown if true, consider unknown lengths equal to any length, otherwise consider unknown lengths to differ from all lengths, including other unknown lengths

boolean org.jmodelica.modelica.compiler.Size.equivalentDim ( Size  s,
boolean  allowUnknown,
int  myDim,
int  itsDim 
)

Check if a specific dimension of another size is equivalent to a specific dimension of this one.

Parameters:
allowUnknown if true, consider unknown lengths equal to any length
myDim the dimension in this Size to compare
itsDim the dimension in the other Size to compare

boolean org.jmodelica.modelica.compiler.Size.equivalentExcept ( Size  s,
boolean  allowUnknown,
int  dim 
)

Check if another size is equivalent to this one, except in a given dimension.

Parameters:
allowUnknown if true, consider unknown lengths equal to any length
dim dimension not to check

Size org.jmodelica.modelica.compiler.Size.expand ( Size  s  ) 

Creates a new Size that is a concatenation of s and this size.

s is added on the left side.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

Size org.jmodelica.modelica.compiler.Size.expand ( int  s  ) 

Creates a new Size that is a copy of this one, but with one more dimension on the left side.

Parameters:
s the length of the new dimension

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

void org.jmodelica.modelica.compiler.Size.fillUnknownFrom ( FExp  exp  )  [protected]

For each unknown length, copy the equivalent length from size of exp.

If the size of exp have more dimensions, the last part is assumed to match this size.

Size org.jmodelica.modelica.compiler.Size.flatten ( FQName  prefix,
FFunctionVariable  fv 
)

FArraySubscripts org.jmodelica.modelica.compiler.Size.flattenFArraySubscripts ( FQName  prefix  ) 

Create a new flattened FArraySubscripts object describing this size.

FSubscript org.jmodelica.modelica.compiler.Size.flattenFSubscript ( int  i,
FQName  prefix 
) [protected]

Create a new flattened FSubscript for dimension i.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

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

Get length in the ith dimension.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

boolean org.jmodelica.modelica.compiler.Size.has ( int  i  ) 

Check if this size has an ith dimension.

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

Calculate hash code.

boolean org.jmodelica.modelica.compiler.Size.hasValue ( int  dim  )  [protected]

Check if the lengths in the given dimension has a value (fix length or integer).

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

boolean org.jmodelica.modelica.compiler.Size.isComplete (  ) 

Check if all lengths have a value (fix length or integer).

boolean org.jmodelica.modelica.compiler.Size.isEmpty (  ) 

Check is the length in any dimension equals 0.

boolean org.jmodelica.modelica.compiler.Size.isUnknown (  ) 

Check if any lengths are unknown.

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

Get length in the last dimension.

MutableSize org.jmodelica.modelica.compiler.Size.mutableClone (  ) 

Create a copy of this size as a MutableSize.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

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

Get the number of dimensions.

int org.jmodelica.modelica.compiler.Size.numElements (  ) 

Returns the number of elements spanned by this Size.

Only valid if all dimensions are known or currently evaluable.

void org.jmodelica.modelica.compiler.Size.printArrayDeclEnd_C ( Printer  p,
PrintStream  str,
String  indent,
FExp  src 
)

Size org.jmodelica.modelica.compiler.Size.promote ( int  dim  ) 

Create a copy of this with dim dimensions, if necessary adding dimensions of length 1 to the right side, or removing dimensions from the left side.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

FArraySubscripts org.jmodelica.modelica.compiler.Size.rangeFArraySubscripts (  ) 

Create a new FArraySubscripts object with ranges spanning this size.

FSubscript org.jmodelica.modelica.compiler.Size.rangeFSubscript ( int  i  )  [protected]

Create a new FSubscript for dimension i.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

String org.jmodelica.modelica.compiler.Size.toString ( int  i  )  [protected]

Returns a string representation of a single length.

Reimplemented in org.jmodelica.modelica.compiler.MutableSize.

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

Returns a string representation on the form "[l1, l2, l3]".

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

Returns a string representation on the form "l1, l2, l3".

void org.jmodelica.modelica.compiler.Size.updateFUnknownSizeExps ( AbstractFVariable  var  ) 


Member Data Documentation

Used to represent the size of scalar expressions.

Used for unknown lengths.


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

Generated on Fri Oct 7 14:51:09 2011 for JModelica.org by  doxygen 1.5.8