prefuse.util
Class PredicateChain

java.lang.Object
  extended by prefuse.util.PredicateChain

public class PredicateChain
extends java.lang.Object

A chain of Predicates and associated values, maintain a large if-statement structure for looking up values based on a Predicate condition.

Author:
jeffrey heer

Constructor Summary
PredicateChain()
           
 
Method Summary
 void add(Predicate p, java.lang.Object val)
          Add a new rule to the end of the chain, associating a Predicate condition with an Object value.
 void clear()
          Remove all rules from the predicate chain.
 java.lang.Object get(Tuple t)
          Evaluate the predicate chain for the given Tuple.
 Expression getExpression()
          Return the backing predicate chain as an Expression instance.
 boolean remove(Predicate p)
          Remove rules using the given predicate from this predicate chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredicateChain

public PredicateChain()
Method Detail

getExpression

public Expression getExpression()
Return the backing predicate chain as an Expression instance.

Returns:
the predicate chain, either an IfExpression or the single terminal default Expression instance.

get

public java.lang.Object get(Tuple t)
Evaluate the predicate chain for the given Tuple.

Parameters:
t - the Tuple
Returns:
the object associated with the first Predicate that successfully matches the Tuple.

add

public void add(Predicate p,
                java.lang.Object val)
Add a new rule to the end of the chain, associating a Predicate condition with an Object value.

Parameters:
p - the Predicate condition
val - the associated Object value

remove

public boolean remove(Predicate p)
Remove rules using the given predicate from this predicate chain. This method will not remove rules in which this predicate is used within a composite of clauses, such as an AND or OR. It only removes rules using this predicate as the top-level trigger.

Parameters:
p - the predicate to remove from the chain
Returns:
true if a rule was successfully removed, false otherwise

clear

public void clear()
Remove all rules from the predicate chain.



Copyright © 2007 Regents of the University of California