org.objectweb.kilim.description
Class ArraySource
java.lang.Object
org.objectweb.kilim.description.TemplateElementImpl
org.objectweb.kilim.description.InlinedElement
org.objectweb.kilim.description.ArraySource
- All Implemented Interfaces:
- BasicElement, java.lang.Cloneable, TemplateElement
- public class ArraySource
- extends InlinedElement
- Author:
- horn
Describes an Array of source elements (i.e. elements which provide a value).
Fields inherited from class org.objectweb.kilim.description.InlinedElement |
|
Method Summary |
void |
addElement(BasicElement value)
extends an array by adding a new element in the array. |
private void |
checkTypeName(java.lang.String aTypeName)
performs a simple syntactical check of the type name:
The name must be of the form : IDENT([])*. |
int |
getCurrentSize()
returns the current size of the array. |
BasicElement |
getElement(int aIndex)
returns the element stored at a given position. |
java.util.Iterator |
getElements()
returns the elements of the array as an iterator. |
int |
getKind()
returns the element kind. |
java.lang.String |
getTypeName()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
arrayElements
private java.util.ArrayList arrayElements
typeName
private java.lang.String typeName
ArraySource
public ArraySource(java.lang.String aTypeName,
TemplateDescription aTemplate)
throws KilimException
- The public constructor of an array source.
- Parameters:
aTypeName
- : a type is defined here through its name (via a simple String and not via a Type).
No semantical check is performed making it possible to use arbitrary types (java types, for example).
A simple syntactical check is done however : name must be of the form : IDENT([])*
examples of correct type names are : int[ ], toto[ ][ ].aTemplate
- : the template containing the array definition.
- Throws:
KilimException
- : generated in case of bad syntactical form.
checkTypeName
private void checkTypeName(java.lang.String aTypeName)
throws KilimException
- performs a simple syntactical check of the type name:
The name must be of the form : IDENT([])*. examples of correct type names are : int[], toto[][].
- Throws:
KilimException
getKind
public int getKind()
- Description copied from interface:
BasicElement
- returns the element kind.
- Returns:
- int
- See Also:
BasicElement.getKind()
getCurrentSize
public int getCurrentSize()
- returns the current size of the array.
- Returns:
- int.
addElement
public void addElement(BasicElement value)
throws KilimException
- extends an array by adding a new element in the array.
- Parameters:
value
- : must be a basic template element
- Throws:
KilimException
- : generated when the argument is null or when the argument does not provide
a value.
getElement
public BasicElement getElement(int aIndex)
throws KilimException
- returns the element stored at a given position.
- Parameters:
aIndex
- : index in the array
- Returns:
- BasicElement : the element at the indicated position.
- Throws:
KilimException
- : generated for illegal values of index (i.e. negative values, or values exceding the size of the array).
getElements
public java.util.Iterator getElements()
- returns the elements of the array as an iterator.
- Returns:
- Iterator
getTypeName
public java.lang.String getTypeName()
- See Also:
org.objectweb.kilim.description.Array#getType()