org.ujac.util.template
Class TemplateTokenContainer

java.lang.Object
  extended by org.ujac.util.template.TemplateToken
      extended by org.ujac.util.template.TemplateTokenContainer
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
BaseConditionToken, ForeachToken, ProcedureToken, TemplateRoot

public abstract class TemplateTokenContainer
extends TemplateToken

Name: TemplateTokenContainer
Description: A base class for statement token containers.

Author:
lauerc
See Also:
Serialized Form

Field Summary
protected  Map procedureRegistry
          The procedure registry.
 
Fields inherited from class org.ujac.util.template.TemplateToken
interpreter, nextLegalAncestor, parent, position, source
 
Constructor Summary
TemplateTokenContainer()
          Constructs a TemplateTokenContainer instance with no specific attributes.
 
Method Summary
 void addToken(TemplateToken token)
          Adds a token to the token list.
 void clearTokens()
          Clears the token list.
protected  void cloneChildTokens(Map procedureRegistry, TemplateTokenContainer parent)
          Clones the childs of this token.
 void close(int bodyEnd, int statementEnd)
          Closes the statement token container.
 int getBodyEnd()
          Getter method for the the property bodyEnd.
 int getBodyStart()
          Getter method for the the property bodyStart.
 Map getProcedureRegistry()
          Gets the procedure registry.
 TemplateToken getToken(int idx)
          Gets a token from the token list.
 int getTokenCount()
          Gets the current number of tokens.
 boolean isBodyToken()
          Tells whether or not this token has a body.
 boolean isClosed()
          Tells whether or not the container has been closed.
 void setBodyStart(int bodyStart)
          Setter method for the the property bodyStart.
 void setProcedureRegistry(Map registry)
          Sets the procedure registry.
 String toString()
           
 
Methods inherited from class org.ujac.util.template.TemplateToken
checkContainer, cloneToken, execute, getAncestorRules, getArgumentsAsString, getEndPosition, getIndention, getLength, getLevel, getParent, getPosition, getSource, getTokenName, initialize, isLegalAncestor, isLegalAncestor, parseArguments, parseArguments, setArgument, setLength, setLevel, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

procedureRegistry

protected Map procedureRegistry
The procedure registry.

Constructor Detail

TemplateTokenContainer

public TemplateTokenContainer()
Constructs a TemplateTokenContainer instance with no specific attributes.

Method Detail

isBodyToken

public boolean isBodyToken()
Tells whether or not this token has a body.

Overrides:
isBodyToken in class TemplateToken
Returns:
true if the token has a body, else false.

isClosed

public boolean isClosed()
Tells whether or not the container has been closed.

Returns:
true if the the container has been closed, else false.

close

public void close(int bodyEnd,
                  int statementEnd)
Closes the statement token container.

Parameters:
bodyEnd - The body end to set.
statementEnd - The statment end to set.

getTokenCount

public final int getTokenCount()
Gets the current number of tokens.

Returns:
The token list size.

getToken

public final TemplateToken getToken(int idx)
Gets a token from the token list.

Parameters:
idx - The token index.
Returns:
The according element from the token list.

addToken

public final void addToken(TemplateToken token)
Adds a token to the token list.

Parameters:
token - The token to add.

clearTokens

public final void clearTokens()
Clears the token list.


getBodyStart

public int getBodyStart()
Getter method for the the property bodyStart.

Returns:
The current value of property bodyStart.

setBodyStart

public void setBodyStart(int bodyStart)
Setter method for the the property bodyStart.

Parameters:
bodyStart - The value to set for the property bodyStart.

getBodyEnd

public int getBodyEnd()
Getter method for the the property bodyEnd.

Returns:
The current value of property bodyEnd.

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

getProcedureRegistry

public Map getProcedureRegistry()
Gets the procedure registry.

Returns:
The procedure registry.

setProcedureRegistry

public void setProcedureRegistry(Map registry)
Sets the procedure registry.

Parameters:
registry - The procedure registry to set.

cloneChildTokens

protected void cloneChildTokens(Map procedureRegistry,
                                TemplateTokenContainer parent)
Clones the childs of this token.

Parameters:
procedureRegistry - The procedure registry to use.
parent - The parent token container.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.