gov.nih.nlm.umls.meta
Class ChainRestrictor

java.lang.Object
  extended bygov.nih.nlm.umls.meta.ChainRestrictor
All Implemented Interfaces:
Comparator, Restrictor

public class ChainRestrictor
extends Object
implements Restrictor

Default implementation of the CoocurrenceContext interface.

Author:
Brian Carlsen, Deborah Shapiro

Constructor Summary
ChainRestrictor()
          Instantiates an empty ChainRestrictor.
 
Method Summary
 void add(Restrictor restrictor)
          Adds the given Restrictor to the chain so that it will be applied.
 void add(Restrictor restrictor, boolean is_comparator)
          Adds the given Restrictor to the chain and uses it for the sort order.
 void clear()
          Clears list of restictors in chain so that no restrictors will be applied.
 int compare(Object obj1, Object obj2)
          Compares objects for sort order.
 boolean keep(Object o)
          Indicates if the given Object should be kept based on the Restrictors in the chain.
 void remove(Restrictor restrictor)
          Removes the given Restrictor from the chain so it will not be applied.
 void setComparator(Comparator comp)
          Sets the Comparator to be used for the sort order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ChainRestrictor

public ChainRestrictor()
Instantiates an empty ChainRestrictor.

Method Detail

keep

public boolean keep(Object o)
Indicates if the given Object should be kept based on the Restrictors in the chain.

Specified by:
keep in interface Restrictor
Parameters:
o - Object
Returns:
boolean returns false if the given object is not to be kept by all the Restrictors in the chain true otherwise

add

public void add(Restrictor restrictor)
Adds the given Restrictor to the chain so that it will be applied.

Parameters:
restrictor - Restrictor

add

public void add(Restrictor restrictor,
                boolean is_comparator)
Adds the given Restrictor to the chain and uses it for the sort order.

Parameters:
restrictor - Restrictor
is_comparator - boolean

setComparator

public void setComparator(Comparator comp)
Sets the Comparator to be used for the sort order.

Parameters:
comp - Comparator

remove

public void remove(Restrictor restrictor)
Removes the given Restrictor from the chain so it will not be applied.

Parameters:
restrictor - Restrictor

clear

public void clear()
Clears list of restictors in chain so that no restrictors will be applied.


compare

public int compare(Object obj1,
                   Object obj2)
Compares objects for sort order.

Specified by:
compare in interface Comparator
Parameters:
obj1 - Object
obj2 - Object
Returns:
int


Copyright ©2005