freemarker.template.expression
Class Not

java.lang.Object
  |
  +--freemarker.template.expression.Not
All Implemented Interfaces:
Expression, ExpressionElement, Operator, java.io.Serializable, Unary

public final class Not
extends java.lang.Object
implements Unary, java.io.Serializable

Performs a logical "not" operation on a given template model.

Version:
$Id: Not.java,v 1.21 2003/11/27 07:07:12 run2000 Exp $
See Also:
Serialized Form

Fields inherited from interface freemarker.template.expression.Unary
POSTFIX, PREFIX
 
Constructor Summary
Not()
          Default constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines whether this object is equal to the given object.
 int getAssociationType()
          Retrieve the operator association for this operator.
 TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
          Returns a binary "not" of the expression previously set.
 int getOperatorClass()
          Return the type of operator this is to the caller.
 int getType()
          Determine the type of result that can be calculated by this expression.
 int hashCode()
          Returns the hash code for this operator.
 boolean isComplete()
          Is the target specified?
 void setTarget(Expression target)
          Sets the target of this Not operator.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Not

public Not()
Default constructor.
Method Detail

getAsTemplateModel

public TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
                                 throws TemplateException
Returns a binary "not" of the expression previously set.
Specified by:
getAsTemplateModel in interface Expression
Parameters:
modelRoot - the template model that will be evaluated by the expression
Returns:
A FastBoolean of the "not" expression
Throws:
TemplateException - the expression could not be evaluated for some reason

isComplete

public boolean isComplete()
Is the target specified?
Specified by:
isComplete in interface Expression
Returns:
true if the target is specified, otherwise false

getType

public int getType()
Determine the type of result that can be calculated by this expression. This is in the form of an integer constant ored together from values in the ExpressionUtils class.
Specified by:
getType in interface Expression

getAssociationType

public int getAssociationType()
Retrieve the operator association for this operator.
Specified by:
getAssociationType in interface Unary
Returns:
PREFIX.

setTarget

public void setTarget(Expression target)
Sets the target of this Not operator.
Specified by:
setTarget in interface Unary
Parameters:
target - the target of this operator
Throws:
NullPointerException - the expression is null

getOperatorClass

public int getOperatorClass()
Return the type of operator this is to the caller. Used for associating operators according to precedence.
Specified by:
getOperatorClass in interface Operator
Returns:
an integer indicating the type of operator this is

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this expression

equals

public boolean equals(java.lang.Object o)
Determines whether this object is equal to the given object.
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared with
Returns:
true if the objects are equal, otherwise false

hashCode

public int hashCode()
Returns the hash code for this operator.
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this object