freemarker.template.expression
Class Equals

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

public final class Equals
extends AbstractBinary
implements java.io.Serializable

Performs an equality test on two template models.

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

Fields inherited from class freemarker.template.expression.AbstractBinary
left, right
 
Constructor Summary
Equals()
          Default constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines whether this object is equal to the given object.
 TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
          The TemplateModel value of this equality test.
 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.
 void setLeft(Expression left)
          Sets the left-hand side of the expression.
 void setRight(Expression right)
          Sets the right-hand side of the expression.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class freemarker.template.expression.AbstractBinary
isComplete
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Equals

public Equals()
Default constructor.
Method Detail

setLeft

public void setLeft(Expression left)
Sets the left-hand side of the expression.
Overrides:
setLeft in class AbstractBinary
Parameters:
left - the left-hand side of the expression
Throws:
NullPointerException - the argument was null
java.lang.IllegalArgumentException - the argument was neither a String nor a number

setRight

public void setRight(Expression right)
Sets the right-hand side of the expression.
Overrides:
setRight in class AbstractBinary
Parameters:
right - the right-hand side of the expression
Throws:
NullPointerException - the argument was null
java.lang.IllegalArgumentException - the argument was neither a String nor a number

getAsTemplateModel

public TemplateModel getAsTemplateModel(TemplateModelRoot modelRoot)
                                 throws TemplateException
The TemplateModel value of this equality test.
Parameters:
modelRoot - the template model that will be evaluated by the expression
Returns:
a FastBoolean indicating whether the two sides of the expression are equal
Throws:
TemplateException - the expression could not be evaluated for some reason

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.

getOperatorClass

public int getOperatorClass()
Return the type of operator this is to the caller. Used for associating operators according to precedence.
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