org.apache.camel.processor.resequencer
Class DefaultExchangeComparator

java.lang.Object
  extended by org.apache.camel.processor.resequencer.DefaultExchangeComparator
All Implemented Interfaces:
Comparator<Exchange>, ExpressionResultComparator, SequenceElementComparator<Exchange>

public class DefaultExchangeComparator
extends Object
implements ExpressionResultComparator

Compares elements of an Exchange sequence by comparing long values returned by this comparator's expression.

Version:

Constructor Summary
DefaultExchangeComparator()
           
 
Method Summary
 int compare(Exchange o1, Exchange o2)
           
 boolean isValid(Exchange exchange)
          Returns true if the o1 can be used in this comparator.
 boolean predecessor(Exchange o1, Exchange o2)
          Returns true if o1 is an immediate predecessor of o2.
 void setExpression(Expression expression)
          Set the expression sed for comparing Exchanges.
 boolean successor(Exchange o1, Exchange o2)
          Returns true if o1 is an immediate successor of o2.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

DefaultExchangeComparator

public DefaultExchangeComparator()
Method Detail

setExpression

public void setExpression(Expression expression)
Description copied from interface: ExpressionResultComparator
Set the expression sed for comparing Exchanges.

Specified by:
setExpression in interface ExpressionResultComparator
Parameters:
expression - the expression

predecessor

public boolean predecessor(Exchange o1,
                           Exchange o2)
Description copied from interface: SequenceElementComparator
Returns true if o1 is an immediate predecessor of o2.

Specified by:
predecessor in interface SequenceElementComparator<Exchange>
Parameters:
o1 - a sequence element.
o2 - a sequence element.
Returns:
true if its an immediate predecessor

successor

public boolean successor(Exchange o1,
                         Exchange o2)
Description copied from interface: SequenceElementComparator
Returns true if o1 is an immediate successor of o2.

Specified by:
successor in interface SequenceElementComparator<Exchange>
Parameters:
o1 - a sequence element.
o2 - a sequence element.
Returns:
true if its an immediate successor

compare

public int compare(Exchange o1,
                   Exchange o2)
Specified by:
compare in interface Comparator<Exchange>

isValid

public boolean isValid(Exchange exchange)
Description copied from interface: SequenceElementComparator
Returns true if the o1 can be used in this comparator.

Specified by:
isValid in interface SequenceElementComparator<Exchange>
Parameters:
exchange - a sequence element
Returns:
true if its usable for this comparator

toString

public String toString()
Overrides:
toString in class Object


Apache Camel