uk.ac.ic.doc.automed.reps
Class TemplateArgumentSequence

java.lang.Object
  |
  +--uk.ac.ic.doc.automed.reps.TemplateArgumentSequence

public class TemplateArgumentSequence
extends java.lang.Object

The class to create compile-time argument sequences (sequences used in template transformation's definitions)

See Also:
CompositeTransformation,

A TemplateArgumentSequence object represents a sequence of TemplateArgument objects, i,e, compile-time arguments. TemplateArgument objects can be created using the createArgument methods defined in this class. Compile-time arguments can have specific values ({@link uk.ac.ic.doc.automed.reps.TemplateArgumentSequence.createArgument(int, String)}), can refer to already created arguments ({@link uk.ac.ic.doc.automed.reps.TemplateArgumentSequence.createArgument(int, TemplateArgument)}), can refer to arguments that will be instantiated at run-time ({@link uk.ac.ic.doc.automed.reps.TemplateArgumentSequence.createArgument(int, TemplateArgumentSequence, int)}) and to arguments in the run-time environment ({@link uk.ac.ic.doc.automed.reps.TemplateArgumentSequence.createArgument(int, int)}). For more information on how to create TemplateArgument objects see the {@link uk.ac.ic.doc.automed.reps.CompositeTransformation} API documentation.


Constructor Summary
TemplateArgumentSequence()
          Constructs a new TemplateArgumentSequence without any TemplateArgument objects.
 
Method Summary
 TemplateArgument createArgument(int position, int ref)
          Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence.
 TemplateArgument createArgument(int position, java.lang.String value)
          Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence.
 TemplateArgument createArgument(int position, TemplateArgument ref)
          Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence.
 TemplateArgument createArgument(int position, TemplateArgumentSequence ref, int refPosition)
          Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence.
 TemplateArgument getArgumentAt(int position)
          Returns a particular TemplateArgument in this TemplateArgumentSequence.
 TemplateArgument[] getArguments()
          Returns an array of all the TemplateArguments in this TemplateArgumentSequence.
 int getSequenceId()
          Returns the sequence ID of this TemplateArgumentSequence.
static TemplateArgumentSequence getTemplateArgumentSequence(int sequenceId)
          Returns the reference to the TemplateArgumentSequence with the given ID.
static TemplateArgumentSequence[] getTemplateArgumentSequences()
          Returns an array of all TemplateArgumentSequence objects that have TemplateArgument objects.
 void print()
           
 void remove()
          Removes this TemplateArgumentSequence.
 void removeArgument(int position)
          Removes a particular argument from this TemplateArgumentSequence.
static void removeTemplateArgumentSequence(int sequenceId)
          Removes a TemplateArgumentSequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateArgumentSequence

public TemplateArgumentSequence()
Constructs a new TemplateArgumentSequence without any TemplateArgument objects.

Method Detail

removeTemplateArgumentSequence

public static void removeTemplateArgumentSequence(int sequenceId)
                                           throws TemplateTransformationRepositoryException,
                                                  RepositoryAccessException
Removes a TemplateArgumentSequence.

Parameters:
sequenceId - ID of the sequence of arguments to remove.
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.removeArguments(int) and remove()
RepositoryAccessException - if the repositories cannot be accessed

remove

public void remove()
            throws TemplateTransformationRepositoryException,
                   RepositoryAccessException
Removes this TemplateArgumentSequence.

Throws:
TemplateTransformationRepositoryException - see TemplateArgument.remove()
RepositoryAccessException - if the repositories cannot be accessed

getTemplateArgumentSequences

public static TemplateArgumentSequence[] getTemplateArgumentSequences()
                                                               throws RepositoryAccessException,
                                                                      AutoRepException
Returns an array of all TemplateArgumentSequence objects that have TemplateArgument objects. Returns null if no argument sequences exists in the TTR.

Returns:
an array of all TemplateArgumentSequence objects.
Throws:
RepositoryAccessException - if the repositories cannot be accessed
AutoRepException - see getTemplateArgumentSequence(int)

getTemplateArgumentSequence

public static TemplateArgumentSequence getTemplateArgumentSequence(int sequenceId)
                                                            throws AutoRepException,
                                                                   RepositoryAccessException
Returns the reference to the TemplateArgumentSequence with the given ID.

Parameters:
sequenceId - ID of the argument sequence.
Returns:
the reference to the argument sequence with the given ID.
Throws:
RepositoryAccessException - if the repositories cannot be accessed
AutoRepException - if the sequenceId is illegal

getSequenceId

public int getSequenceId()
Returns the sequence ID of this TemplateArgumentSequence.


getArguments

public TemplateArgument[] getArguments()
Returns an array of all the TemplateArguments in this TemplateArgumentSequence.

Returns:
an array of all the TemplateArguments in this TemplateArgumentSequence.

createArgument

public TemplateArgument createArgument(int position,
                                       java.lang.String value)
                                throws TemplateTransformationRepositoryException,
                                       RepositoryAccessException
Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence. The created argument has a specific value value.

Parameters:
position - the position in the argument sequence
value - value of this argument.
Returns:
reference to the new TemplateArgument.
Throws:
TemplateTransformationRepositoryException - see TemplateArgument.TemplateArgument(int, String) and TemplateArgument.TemplateArgument(int, int, String)
RepositoryAccessException - if the repositories cannot be accessed

createArgument

public TemplateArgument createArgument(int position,
                                       TemplateArgumentSequence ref,
                                       int refPosition)
                                throws TemplateTransformationRepositoryException,
                                       AutoRepException,
                                       RepositoryAccessException
Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence. The created argument references a position (refPosition) in an argument sequence (ref). At run-time this position will store a valid run-time argument, so at run-time the value of this argument will be equal to the value of the referred argument.

Parameters:
position - the position in the argument sequence
ref - the TemplateArgumentSequence that the argument is refering
refPosition - the position in the refering TemplateArgumentSequence
Returns:
reference to the new TemplateArgument.
Throws:
TemplateTransformationRepositoryException - if the referenced TemplateArgumentSequence hasn't been initialised (doesn't contain TemplateArgument objects), see TemplateArgument.TemplateArgument(int, TemplateArgumentSequence, int) and TemplateArgument.TemplateArgument(int, int, TemplateArgumentSequence, int)
AutoRepException - see TemplateArgument.TemplateArgument(int, TemplateArgumentSequence, int) and TemplateArgument.TemplateArgument(int, int, TemplateArgumentSequence, int)
RepositoryAccessException - if the repositories cannot be accessed

createArgument

public TemplateArgument createArgument(int position,
                                       TemplateArgument ref)
                                throws TemplateTransformationRepositoryException,
                                       AutoRepException,
                                       RepositoryAccessException
Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence. The created argument has the value of the argument it refers (ref).

Parameters:
position - the position in the argument sequence
ref - the TemplateArgument that this argument is refering
Returns:
reference to the new TemplateArgument.
Throws:
TemplateTransformationRepositoryException - see TemplateArgument.TemplateArgument(int, TemplateArgument) and TemplateArgument.TemplateArgument(int, int, TemplateArgument)
AutoRepException - see TemplateArgument.TemplateArgument(int, TemplateArgumentSequence, int) and TemplateArgument.TemplateArgument(int, TemplateArgument)
RepositoryAccessException - if the repositories cannot be accessed

createArgument

public TemplateArgument createArgument(int position,
                                       int ref)
                                throws TemplateTransformationRepositoryException,
                                       RepositoryAccessException
Constructs a new TemplateArgument and adds it to this TemplateArgumentSequence. The created argument refers to an argument of the run-time environment. The refered argument is stored in position ref of the run-time environment.

Parameters:
position - the position in the argument sequence
ref - the position in the composite transformation's arguments that the argument is refering
Returns:
reference to the new TemplateArgument.
Throws:
TemplateTransformationRepositoryException - see TemplateArgument.TemplateArgument(int, int) and TemplateArgument.TemplateArgument(int, int, int)
RepositoryAccessException - if the repositories cannot be accessed

getArgumentAt

public TemplateArgument getArgumentAt(int position)
                               throws AutoRepException
Returns a particular TemplateArgument in this TemplateArgumentSequence.

Parameters:
position - the position in the argument sequence.
Returns:
the TemplateArgument specified by the given position
Throws:
AutoRepException - if the specified position doesn't exist in this TemplateArgumentSequence

removeArgument

public void removeArgument(int position)
                    throws TemplateTransformationRepositoryException,
                           AutoRepException,
                           RepositoryAccessException
Removes a particular argument from this TemplateArgumentSequence.

Parameters:
position - the position to be removed from the argument sequence.
Throws:
AutoRepException - see getArgumentAt(int)
TemplateTransformationRepositoryException - see TemplateArgument.remove()
RepositoryAccessException - if the repositories cannot be accessed

print

public void print()
           throws TemplateTransformationRepositoryException,
                  RepositoryAccessException
TemplateTransformationRepositoryException
RepositoryAccessException