terp - the Codemesh Modular
Template Interpreter v1.3.309

com.codemesh.terp.eval.executors
Class ComparableComparator

java.lang.Object
  extended by com.codemesh.terp.api.Executor.AbstractExecutor<java.lang.Object>
      extended by com.codemesh.terp.eval.executors.ComparableComparator
All Implemented Interfaces:
Executor<java.lang.Object>, BooleanExecutor

public class ComparableComparator
extends Executor.AbstractExecutor<java.lang.Object>
implements BooleanExecutor

A comparator for comparable objects.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.codemesh.terp.api.Executor
Executor.AbstractExecutor<T>, Executor.ForMethod
 
Constructor Summary
ComparableComparator(int op)
          Creates a comparator instance for the given comparison operation.
 
Method Summary
 java.lang.Object execute(java.util.List<java.lang.Object> args, TerpEvaluator eval, TerpContext ctx)
          Performs the executor's action on the given arguments in the given context.
 boolean matches(java.util.List<java.lang.Object> args)
          Returns true if the executor applies to the given arguments.
 
Methods inherited from class com.codemesh.terp.api.Executor.AbstractExecutor
execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparableComparator

public ComparableComparator(int op)
Creates a comparator instance for the given comparison operation. Comparable comparators take an integer representing the comparison operation as input. This allows one type to represent the six different operations.

Parameters:
op - the comparison type.
Method Detail

matches

public boolean matches(java.util.List<java.lang.Object> args)
Returns true if the executor applies to the given arguments. Typically, your custom executor will implement this method to check for the proper number of arguments and the proper argument types.

Specified by:
matches in interface Executor<java.lang.Object>
Parameters:
args - the arguments passed to the executor.
Returns:
true if the executor knows how to handle the given arguments, false otherwise.

execute

public java.lang.Object execute(java.util.List<java.lang.Object> args,
                                TerpEvaluator eval,
                                TerpContext ctx)
Performs the executor's action on the given arguments in the given context. Typically, your custom executor will implement this method to provide its core functionality.

Specified by:
execute in interface Executor<java.lang.Object>
Parameters:
args - the arguments.
eval - the evaluator to use. Can frequently be null.
ctx - the context in which the execution occurs. Can frequently be null.
Returns:
the execution result.

terp - the Codemesh Modular
Template Interpreter v1.3.309

Copyright © 2008-2012 by Codemesh, Inc. All Rights Reserved.