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

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

public class TemplateArgument
extends java.lang.Object

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

See Also:
TemplateArgumentSequence,

A TemplateArgument object represents an argument in a template transformation's definition. TemplateArgument objects belong to a TemplateArgumentSequence and can be created through the sequence object. Compile-time arguments can have specific values, can refer to other arguments or refer to arguments in the run-time environment.


Constructor Summary
protected TemplateArgument(int position, int reference)
          Constructs a new TemplateArgument that refers to a composite transformation's arguments and creates a new sequence of arguments.
protected TemplateArgument(int sequenceId, int position, int reference)
          Constructs a new TemplateArgument that refers to a composite transformation's arguments.
protected TemplateArgument(int sequenceId, int position, java.lang.String value)
          Constructs a new TemplateArgument storing the specified value.
protected TemplateArgument(int sequenceId, int position, TemplateArgument reference)
          Constructs a new TemplateArgument that refers to another TemplateArgument
protected TemplateArgument(int sequenceId, int position, TemplateArgumentSequence reference, int refPosition)
          Constructs a new TemplateArgument that refers to another argument
protected TemplateArgument(int position, java.lang.String value)
          Constructs a new TemplateArgument storing the specified value and creates a new sequence of arguments.
protected TemplateArgument(int position, TemplateArgument reference)
          Constructs a new TemplateArgument that refers to another TemplateArgument and creates a new argument sequence
protected TemplateArgument(int position, TemplateArgumentSequence reference, int refPosition)
          Constructs a new TemplateArgument that refers to another argument and creates a new argument sequence
 
Method Summary
protected static java.util.ArrayList getArgumentsForSequence(int sequenceId)
          Returns all the TemplateArgument objects of the specified sequence of arguments.
 int getPosition()
          Returns the position of this TemplateArgument.
 int getPositionInReferencedArgumentSequence()
          Returns the position in the referenced arguments sequence.
 TemplateArgumentSequence getReferencedArgumentSequence()
          Returns the TemplateArgumentSequence this TemplateArgument refers to.
 int getSequenceId()
          Returns the sequence identifier of this TemplateArgument.
 java.lang.String getValue()
          Returns this TemplateArgument's value field.
 void print()
           
protected  void remove()
          Removes this TemplateArgument from the TTR.
 void setReference(int reference)
          Sets the TemplateArgument to refer to the transformation's arguments.
 void setReference(TemplateArgument reference)
          Sets this TemplateArgument to refer to another TemplateArgument.
 void setReference(TemplateArgumentSequence reference, int refPosition)
          Sets this TemplateArgument to refer to the specified position in the specified TemplateArgumentSequence.
 void setValue(java.lang.String value)
          Sets the value of this TemplateArgument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateArgument

protected TemplateArgument(int sequenceId,
                           int position,
                           java.lang.String value)
                    throws TemplateTransformationRepositoryException,
                           RepositoryAccessException
Constructs a new TemplateArgument storing the specified value.

Parameters:
sequenceId - ID of the argument sequence this argument belongs to
position - the position of this argument in the sequence
value - value of the argument
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createArgument(int, int, int, int, String)
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int position,
                           java.lang.String value)
                    throws TemplateTransformationRepositoryException,
                           RepositoryAccessException
Constructs a new TemplateArgument storing the specified value and creates a new sequence of arguments.

Parameters:
position - the position of this argument in the sequence
value - value of the argument
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createFirstArgument(int, int, int, String)
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int sequenceId,
                           int position,
                           TemplateArgumentSequence reference,
                           int refPosition)
                    throws TemplateTransformationRepositoryException,
                           AutoRepException,
                           RepositoryAccessException
Constructs a new TemplateArgument that refers to another argument

Parameters:
sequenceId - ID of the argument sequence this argument belongs to
position - the position of this TemplateArgument in the sequence
reference - the TemplateArgumentSequence this TemplateArgument refers to
refPosition - the position in the refering TemplateArgumentSequence
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createArgument(int, int, int, int, String)
AutoRepException - if the TemplateArgumentSequence object is null
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int position,
                           TemplateArgumentSequence reference,
                           int refPosition)
                    throws TemplateTransformationRepositoryException,
                           AutoRepException,
                           RepositoryAccessException
Constructs a new TemplateArgument that refers to another argument and creates a new argument sequence

Parameters:
position - the position of this TemplateArgument in the sequence
reference - the TemplateArgumentSequence this TemplateArgument refers to
refPosition - the position in the refering TemplateArgumentSequence
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createFirstArgument(int, int, int, String)
AutoRepException - if the TemplateArgumentSequence object is null
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int sequenceId,
                           int position,
                           TemplateArgument reference)
                    throws TemplateTransformationRepositoryException,
                           AutoRepException,
                           RepositoryAccessException
Constructs a new TemplateArgument that refers to another TemplateArgument

Parameters:
sequenceId - ID of the argument sequence this argument belongs to
position - the position of this TemplateArgument in the sequence
reference - the TemplateArgument this TemplateArgument refers to
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createArgument(int, int, int, int, String)
AutoRepException - if the TemplateArgument object is null
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int position,
                           TemplateArgument reference)
                    throws TemplateTransformationRepositoryException,
                           AutoRepException,
                           RepositoryAccessException
Constructs a new TemplateArgument that refers to another TemplateArgument and creates a new argument sequence

Parameters:
position - the position of this TemplateArgument in the sequence
reference - the TemplateArgument this TemplateArgument refers to
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createFirstArgument(int, int, int, String)
AutoRepException - if the TemplateArgument object is null
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int sequenceId,
                           int position,
                           int reference)
                    throws TemplateTransformationRepositoryException,
                           RepositoryAccessException
Constructs a new TemplateArgument that refers to a composite transformation's arguments.

Parameters:
reference - position in the transformation's sequence of arguments
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createArgument(int, int, int, int, String)
RepositoryAccessException - if the repositories cannot be accessed

TemplateArgument

protected TemplateArgument(int position,
                           int reference)
                    throws TemplateTransformationRepositoryException,
                           RepositoryAccessException
Constructs a new TemplateArgument that refers to a composite transformation's arguments and creates a new sequence of arguments.

Parameters:
reference - position in the transformation's sequence of arguments
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.createFirstArgument(int, int, int, String)
RepositoryAccessException - if the repositories cannot be accessed
Method Detail

getValue

public java.lang.String getValue()
                          throws TemplateTransformationRepositoryException,
                                 RepositoryAccessException
Returns this TemplateArgument's value field.

Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getArgumentsValue(int, int)
RepositoryAccessException - if the repositories cannot be accessed

getReferencedArgumentSequence

public TemplateArgumentSequence getReferencedArgumentSequence()
                                                       throws RepositoryAccessException,
                                                              TemplateTransformationRepositoryException
Returns the TemplateArgumentSequence this TemplateArgument refers to. Returns null if no TemplateArgumentSequence is referred.

Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getArgumentsArgIdRef(int, int)
RepositoryAccessException - if the repositories cannot be accessed

getPositionInReferencedArgumentSequence

public int getPositionInReferencedArgumentSequence()
                                            throws TemplateTransformationRepositoryException,
                                                   RepositoryAccessException
Returns the position in the referenced arguments sequence. This can be a TemplateArgumentSequence or a composite transformations' argument sequence.

Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.getArgumentsArgPosRef(int, int)
RepositoryAccessException - if the repositories cannot be accessed

setReference

public void setReference(TemplateArgument reference)
                  throws TemplateTransformationRepositoryException,
                         AutoRepException,
                         RepositoryAccessException
Sets this TemplateArgument to refer to another TemplateArgument.

Parameters:
reference - the TemplateArgument this TemplateArgument refers to
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setArgumentsArgIdRef(int, int, int) and TemplateTransformationRepository.setArgumentsArgPosRef(int, int, int)
AutoRepException - if TemplateArgument is null
RepositoryAccessException - if the repositories cannot be accessed

setReference

public void setReference(TemplateArgumentSequence reference,
                         int refPosition)
                  throws TemplateTransformationRepositoryException,
                         AutoRepException,
                         RepositoryAccessException
Sets this TemplateArgument to refer to the specified position in the specified TemplateArgumentSequence.

Parameters:
reference - the TemplateArgumentSequence this TemplateArgument refers to
refPosition - the position in the refering TemplateArgumentSequence
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setArgumentsArgIdRef(int, int, int) and TemplateTransformationRepository.setArgumentsArgPosRef(int, int, int)
AutoRepException - if TemplateArgument is null
RepositoryAccessException - if the repositories cannot be accessed

setValue

public void setValue(java.lang.String value)
              throws TemplateTransformationRepositoryException,
                     RepositoryAccessException
Sets the value of this TemplateArgument. The StatemenArgument won't reference another argument

Parameters:
value - the value of this TemplateArgument
Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setArgumentsArgIdRef(int, int, int) and TemplateTransformationRepository.setArgumentsArgPosRef(int, int, int) and TemplateTransformationRepository.setArgumentsValue(int, int, String)
RepositoryAccessException - if the repositories cannot be accessed

setReference

public void setReference(int reference)
                  throws TemplateTransformationRepositoryException,
                         RepositoryAccessException
Sets the TemplateArgument to refer to the transformation's arguments.

Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.setArgumentsArgIdRef(int, int, int) and TemplateTransformationRepository.setArgumentsArgPosRef(int, int, int)
RepositoryAccessException - if the repositories cannot be accessed

remove

protected void remove()
               throws TemplateTransformationRepositoryException,
                      RepositoryAccessException
Removes this TemplateArgument from the TTR.

Throws:
TemplateTransformationRepositoryException - see TemplateTransformationRepository.removeArgument(int, int)
RepositoryAccessException - if the repositories cannot be accessed

getSequenceId

public int getSequenceId()
Returns the sequence identifier of this TemplateArgument.

Returns:
sequenceId of this TemplateArgument.

getPosition

public int getPosition()
Returns the position of this TemplateArgument.

Returns:
position of this TemplateArgument.

print

public void print()
           throws TemplateTransformationRepositoryException,
                  RepositoryAccessException
TemplateTransformationRepositoryException
RepositoryAccessException

getArgumentsForSequence

protected static java.util.ArrayList getArgumentsForSequence(int sequenceId)
                                                      throws RepositoryAccessException
Returns all the TemplateArgument objects of the specified sequence of arguments. Returns null if no TemplateArgument objects exist in the TTR.

Parameters:
sequenceId - ID of sequence of arguments that the TemplateArgument objects will belong to
Returns:
an ArrayList of TemplateArgument objects
Throws:
RepositoryAccessException - if the repositories cannot be accessed