org.objectweb.kilim.description
Class ArraySource

java.lang.Object
  extended byorg.objectweb.kilim.description.TemplateElementImpl
      extended byorg.objectweb.kilim.description.InlinedElement
          extended byorg.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).

Field Summary
private  java.util.ArrayList arrayElements
           
private  java.lang.String typeName
           
 
Fields inherited from class org.objectweb.kilim.description.InlinedElement
 
Fields inherited from class org.objectweb.kilim.description.TemplateElementImpl
 
Constructor Summary
ArraySource(java.lang.String aTypeName, TemplateDescription aTemplate)
          The public constructor of an array source.
 
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 org.objectweb.kilim.description.InlinedElement
getLocalName, getStatus, isEventSource, performsAction, providesValue, setLocalName, setStatus
 
Methods inherited from class org.objectweb.kilim.description.TemplateElementImpl
clone, getContainingTemplate, getTemplateDefHierarchy, setContainingTemplate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.kilim.description.TemplateElement
clone, getContainingTemplate, getTemplateDefHierarchy, setContainingTemplate
 

Field Detail

arrayElements

private java.util.ArrayList arrayElements

typeName

private java.lang.String typeName
Constructor Detail

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.
Method Detail

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