Package org.cesilko.rachota.core.filters
Class DurationFilter
java.lang.Object
org.cesilko.rachota.core.filters.AbstractTaskFilter
org.cesilko.rachota.core.filters.DurationFilter
Task filter allowing to filter tasks by duration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Rule requiring given content NOT to be smaller than task property.static final int
Rule requiring given content NOT to be greater than task property. -
Constructor Summary
ConstructorsConstructorDescriptionCreates new default duration filter which is preset to RULE_MORE_THAN content rule and zero duration.DurationFilter
(int contentRule, Long duration) Creates new duration filter. -
Method Summary
Modifier and TypeMethodDescriptionfilterTasks
(Vector tasks) Applies duration filter on given tasks and returns those tasks that satisfied filter criterion.Returns both available content rules of duration filter.toString()
Returns name of filter as text.Methods inherited from class org.cesilko.rachota.core.filters.AbstractTaskFilter
getContent, getContentRule, getContentValues, setContent, setContentRule
-
Field Details
-
RULE_MORE_THAN
public static final int RULE_MORE_THANRule requiring given content NOT to be greater than task property.- See Also:
-
RULE_LESS_THAN
public static final int RULE_LESS_THANRule requiring given content NOT to be smaller than task property.- See Also:
-
-
Constructor Details
-
DurationFilter
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 Details
-
getContentRules
Returns both available content rules of duration filter.- Overrides:
getContentRules
in classAbstractTaskFilter
- Returns:
- RULE_LESS_THAN and RULE_MORE_THAN content rules.
-
filterTasks
Applies duration filter on given tasks and returns those tasks that satisfied filter criterion.- Overrides:
filterTasks
in classAbstractTaskFilter
- Parameters:
tasks
- Vector of tasks to be filtered.- Returns:
- Filtered tasks.
-
toString
Returns name of filter as text.- Overrides:
toString
in classAbstractTaskFilter
- Returns:
- Name of filter as text.
-