org.ujac.util.template
Class ElseifToken

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

public class ElseifToken
extends BaseConditionToken

Name: ElseifToken
Description: Represents an _elseif_ statement.

Author:
lauerc
See Also:
Serialized Form

Field Summary
static TokenAncestor[] ancestorRules
          The ancestor rules.
 
Fields inherited from class org.ujac.util.template.TemplateTokenContainer
procedureRegistry
 
Fields inherited from class org.ujac.util.template.TemplateToken
interpreter, nextLegalAncestor, parent, position, source
 
Constructor Summary
ElseifToken()
          Constructs a ElseifToken instance with no specific attributes.
 
Method Summary
protected  TemplateToken cloneToken(BaseTemplateInterpreter interpreter, TemplateTokenContainer parent)
          Clones the token for caching reasons.
 TokenAncestor[] getAncestorRules()
          Gets the ancestor rules for this template.
protected  String getArgumentsAsString()
          Gets the argument list as string.
 BaseConditionToken getRootCondition()
          Gets the root condition.
 String getTokenName()
          Gets the token name.
 void initialize(BaseTemplateInterpreter interpreter, char[] source, int position, int length)
          Initializes the token.
 boolean isTrue(TemplateContext ctx)
          Tells whether or not the condition is true.
 void setArgument(Operand argument, int idx)
          Sets an argument.
 String toString()
           
 
Methods inherited from class org.ujac.util.template.BaseConditionToken
execute, getPreviousCondition, isResolved, parseArguments, setResolved
 
Methods inherited from class org.ujac.util.template.TemplateTokenContainer
addToken, clearTokens, cloneChildTokens, close, getBodyEnd, getBodyStart, getProcedureRegistry, getToken, getTokenCount, isBodyToken, isClosed, setBodyStart, setProcedureRegistry
 
Methods inherited from class org.ujac.util.template.TemplateToken
checkContainer, getEndPosition, getIndention, getLength, getLevel, getParent, getPosition, getSource, isLegalAncestor, isLegalAncestor, parseArguments, setLength, setLevel, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ancestorRules

public static final TokenAncestor[] ancestorRules
The ancestor rules.

Constructor Detail

ElseifToken

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

Method Detail

getTokenName

public String getTokenName()
Gets the token name.

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

getAncestorRules

public TokenAncestor[] getAncestorRules()
Gets the ancestor rules for this template.

Overrides:
getAncestorRules in class TemplateToken
Returns:
An array of template ancestors.

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.

setArgument

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

Specified by:
setArgument in class TemplateToken
Parameters:
argument - The argument to set.
idx - The argument index.

isTrue

public boolean isTrue(TemplateContext ctx)
               throws ExpressionException
Tells whether or not the condition is true.

Specified by:
isTrue in class BaseConditionToken
Parameters:
ctx - The template context.
Returns:
true or false.
Throws:
ExpressionException - If the token could not be successfuly executed.

getRootCondition

public BaseConditionToken getRootCondition()
Gets the root condition.

Specified by:
getRootCondition in class BaseConditionToken
Returns:
The root condition of the current condition.

toString

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

getArgumentsAsString

protected String getArgumentsAsString()
Description copied from class: TemplateToken
Gets the argument list as string.

Overrides:
getArgumentsAsString in class TemplateToken
Returns:
The arguements as a comma separated text.
See Also:
TemplateToken.getArgumentsAsString()

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.


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