All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.webmacro.engine.Condition

java.lang.Object
   |
   +----org.webmacro.engine.Condition

public abstract class Condition
extends Object
implements Macro
Conditions evaluate() to Boolean.TRUE or Boolean.FALSE depending on its contents and the supplied context. You can build expressions from a combination of the operators ! && || == and Terms; you can also group sub-expressions with parentheses. An expression is true if it is non-null; and false if it is Boolean.FALSE or null. Beware that null values incur a slight performance penalty; therefore we recommend you use boolean values in expressions wherever possible.


Constructor Index

 o Condition()

Method Index

 o evaluate(Object)
Return an object representing this condition
 o parse(ParseTool)
Parse the expression and return a macro that will evaluate to Boolean.TRUE or Boolean.FALSE depending on the condition.
 o parseCond(ParseTool)
Exactly the same as parse(), but return type is Condition
 o test(Object)
Returns true if the condition is logically true; returns false if the condition is either logically false or undefined.
 o write(Writer, Object)
Evaluate the condition and write it out

Constructors

 o Condition
 public Condition()

Methods

 o parse
 public static final Object parse(ParseTool in) throws ParseException, IOException
Parse the expression and return a macro that will evaluate to Boolean.TRUE or Boolean.FALSE depending on the condition.

Returns:
boolean
Throws: ParseException
if the sytax was invalid and we could not recover
Throws: IOException
if we could not successfullly read the parseTool
 o parseCond
 public static Condition parseCond(ParseTool in) throws ParseException, IOException
Exactly the same as parse(), but return type is Condition

 o write
 public final void write(Writer out,
                         Object context) throws InvalidContextException, IOException
Evaluate the condition and write it out

 o evaluate
 public Object evaluate(Object context) throws InvalidContextException
Return an object representing this condition

 o test
 public abstract boolean test(Object context)
Returns true if the condition is logically true; returns false if the condition is either logically false or undefined.


All Packages  Class Hierarchy  This Package  Previous  Next  Index