org.ujac.util.template
Class AssertToken

java.lang.Object
  extended by org.ujac.util.template.TemplateToken
      extended by org.ujac.util.template.AssertToken
All Implemented Interfaces:
Serializable, Cloneable

public class AssertToken
extends TemplateToken

Name: AssertToken
Description: Represents an _assert_ statement.

Author:
lauerc
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.ujac.util.template.TemplateToken
interpreter, nextLegalAncestor, parent, position, source
 
Constructor Summary
AssertToken()
          Constructs a AssertToken instance with no specific attributes.
 
Method Summary
 Object clone()
           
protected  TemplateToken cloneToken(BaseTemplateInterpreter interpreter, TemplateTokenContainer parent)
          Clones the token for caching reasons.
 void execute(Writer writer, TemplateContext ctx)
          Excecutes the statement token.
 String getTokenName()
          Gets the token name.
 void initialize(BaseTemplateInterpreter interpreter, char[] source, int position, int length)
          Initializes the token.
 int parseArguments()
          Parses the arguments of the token.
 void setArgument(Operand argument, int idx)
          Sets an argument.
 String toString()
           
 
Methods inherited from class org.ujac.util.template.TemplateToken
checkContainer, getAncestorRules, getArgumentsAsString, getEndPosition, getIndention, getLength, getLevel, getParent, getPosition, getSource, isBodyToken, isLegalAncestor, isLegalAncestor, parseArguments, setLength, setLevel, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AssertToken

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

Method Detail

getTokenName

public String getTokenName()
Gets the token name.

Overrides:
getTokenName in class TemplateToken
Returns:
The token name.

initialize

public void initialize(BaseTemplateInterpreter interpreter,
                       char[] source,
                       int position,
                       int length)
                throws TemplateException
Initializes the token.

Overrides:
initialize in class TemplateToken
Parameters:
interpreter - The template interpreter.
source - The source code.
position - The start position.
length - The length of the interresting area.
Throws:
TemplateException - In case the initialization failed.

parseArguments

public int parseArguments()
                   throws StatementException
Parses the arguments of the token.

Overrides:
parseArguments in class TemplateToken
Returns:
The position after the argument list.
Throws:
StatementException - In case the argument parsing failed.

setArgument

public void setArgument(Operand argument,
                        int idx)
                 throws StatementException
Sets an argument.

Specified by:
setArgument in class TemplateToken
Parameters:
argument - The argument to set.
idx - The argument index.
Throws:
StatementException - In case the given argument is not valid.

execute

public void execute(Writer writer,
                    TemplateContext ctx)
             throws ExpressionException
Excecutes the statement token.

Specified by:
execute in class TemplateToken
Parameters:
writer - The writer to write to.
ctx - The template context.
Throws:
ExpressionException - If the token could not be successfuly executed.

toString

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

cloneToken

protected TemplateToken cloneToken(BaseTemplateInterpreter interpreter,
                                   TemplateTokenContainer parent)
Clones the token for caching reasons.

Specified by:
cloneToken in class TemplateToken
Parameters:
interpreter - The interpreter to use.
parent - The actual parent in the cloned object tree.
Returns:
The clone.

clone

public Object clone()
Overrides:
clone in class Object
See Also:
Object.clone()


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