Package org.cesilko.rachota.core.filters
Class DurationFilter
- java.lang.Object
-
- org.cesilko.rachota.core.filters.AbstractTaskFilter
-
- org.cesilko.rachota.core.filters.DurationFilter
-
public class DurationFilter extends AbstractTaskFilter
Task filter allowing to filter tasks by duration.
-
-
Field Summary
Fields Modifier and Type Field Description static intRULE_LESS_THANRule requiring given content NOT to be smaller than task property.static intRULE_MORE_THANRule requiring given content NOT to be greater than task property.
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.VectorfilterTasks(java.util.Vector tasks)Applies duration filter on given tasks and returns those tasks that satisfied filter criterion.java.util.VectorgetContentRules()Returns both available content rules of duration filter.java.lang.StringtoString()Returns name of filter as text.-
Methods inherited from class org.cesilko.rachota.core.filters.AbstractTaskFilter
getContent, getContentRule, getContentValues, setContent, setContentRule
-
-
-
-
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:
getContentRulesin classAbstractTaskFilter- 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:
filterTasksin classAbstractTaskFilter- Parameters:
tasks- Vector of tasks to be filtered.- Returns:
- Filtered tasks.
-
toString
public java.lang.String toString()
Returns name of filter as text.- Overrides:
toStringin classAbstractTaskFilter- Returns:
- Name of filter as text.
-
-