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 Details

    • RULE_MORE_THAN

      public static final int RULE_MORE_THAN
      Rule requiring given content NOT to be greater than task property.
      See Also:
    • RULE_LESS_THAN

      public static final int RULE_LESS_THAN
      Rule requiring given content NOT to be smaller than task property.
      See Also:
  • Constructor Details

    • DurationFilter

      public DurationFilter(int contentRule, 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 Details

    • getContentRules

      public 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 Vector filterTasks(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 String toString()
      Returns name of filter as text.
      Overrides:
      toString in class AbstractTaskFilter
      Returns:
      Name of filter as text.