procope.tools
Class BooleanExpression

java.lang.Object
  extended by procope.tools.BooleanExpression

public class BooleanExpression
extends Object

Used to evaluate boolean expressions. An example for such an expression would be:

(source='Y2H' OR source='TAP') AND score >= 0.5

You can use the boolean expression objects to filter edges in a network or proteins in the ProteinManager.

For detailed examples on how to use this class check out the manual of the library.

Author:
Jan Krumsiek

Constructor Summary
BooleanExpression(String expression)
          Create expression object from a given expression string.
 
Method Summary
 boolean evaluate(Map<String,Object> values)
          Evaluate a given set of variable name => value mappings using the expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanExpression

public BooleanExpression(String expression)
                  throws InvalidExpressionException
Create expression object from a given expression string. The expression will be parsed and an internal tree representation for rapid evaluation will be compiled.

Parameters:
expression - the expression string
Throws:
InvalidExpressionException - if the expression is invalid
Method Detail

evaluate

public boolean evaluate(Map<String,Object> values)
Evaluate a given set of variable name => value mappings using the expression.

Parameters:
values - variables and their annotations, for non-numeric object type the String representation of that object will be used
Returns:
true or false depending on whether the variables let the expression evaluate to true or false