org.cesilko.rachota.core.filters
Class DurationFilter

java.lang.Object
  extended by org.cesilko.rachota.core.filters.AbstractTaskFilter
      extended by org.cesilko.rachota.core.filters.DurationFilter

public class DurationFilter
extends AbstractTaskFilter

Task filter allowing to filter tasks by duration.


Field Summary
static int RULE_LESS_THAN
          Rule requiring given content NOT to be smaller than task property.
static int RULE_MORE_THAN
          Rule requiring given content NOT to be greater than task property.
 
Constructor Summary
DurationFilter()
          Creates new default duration filter which is preset to RULE_MORE_THAN content rule and zero duration.
DurationFilter(int contentRule, java.lang.Long duration)
          Creates new duration filter.
 
Method Summary
 java.util.Vector filterTasks(java.util.Vector tasks)
          Applies duration filter on given tasks and returns those tasks that satisfied filter criterion.
 java.util.Vector getContentRules()
          Returns both available content rules of duration filter.
 java.lang.String toString()
          Returns name of filter as text.
 
Methods inherited from class org.cesilko.rachota.core.filters.AbstractTaskFilter
getContent, getContentRule, getContentValues, setContent, setContentRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RULE_MORE_THAN

public static final int RULE_MORE_THAN
Rule requiring given content NOT to be greater than task property.

See Also:
Constant Field Values

RULE_LESS_THAN

public static final int RULE_LESS_THAN
Rule requiring given content NOT to be smaller than task property.

See Also:
Constant Field Values
Constructor Detail

DurationFilter

public DurationFilter(int contentRule,
                      java.lang.Long duration)
Creates new duration filter. Filter accepts only RULE_LESS_THAN and RULE_MORE_THAN content rules. Other rules will cause that tasks will not be filtered at all.

Parameters:
contentRule - One of two content rules determining allowed value of task duration.
duration - Time duration in millisecondss that must be greater/smaller than task duration.

DurationFilter

public DurationFilter()
Creates new default duration filter which is preset to RULE_MORE_THAN content rule and zero duration.

Method Detail

getContentRules

public java.util.Vector getContentRules()
Returns both available content rules of duration filter.

Overrides:
getContentRules in class AbstractTaskFilter
Returns:
RULE_LESS_THAN and RULE_MORE_THAN content rules.

filterTasks

public java.util.Vector filterTasks(java.util.Vector tasks)
Applies duration filter on given tasks and returns those tasks that satisfied filter criterion.

Overrides:
filterTasks in class AbstractTaskFilter
Parameters:
tasks - Vector of tasks to be filtered.
Returns:
Filtered tasks.

toString

public java.lang.String toString()
Returns name of filter as text.

Overrides:
toString in class AbstractTaskFilter
Returns:
Name of filter as text.