Class StateFilter

java.lang.Object
org.cesilko.rachota.core.filters.AbstractTaskFilter
org.cesilko.rachota.core.filters.StateFilter

public class StateFilter extends AbstractTaskFilter
Task filter allowing to filter tasks by state.
  • Field Details

    • RULE_EQUALS

      public static final int RULE_EQUALS
      Rule requiring given content to be equal to task property.
      See Also:
    • RULE_EQUALS_NOT

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

    • StateFilter

      public StateFilter(int contentRule, Integer state)
      Creates new state filter. Filter accepts only RULE_EQUALS and RULE_EQUALS_NOT 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 state.
      state - State level that must be equal/different than task state.
    • StateFilter

      public StateFilter()
      Creates new default state filter which is preset to RULE_EQUALS content rule and state Task.STATE_NEW.
  • Method Details

    • getContentRules

      public Vector getContentRules()
      Returns both two available content rules of state filter.
      Overrides:
      getContentRules in class AbstractTaskFilter
      Returns:
      RULE_EQUALS and RULE_EQUALS_NOT content rules.
    • getContentValues

      public Vector getContentValues()
      Returns all available content values of state filter.
      Overrides:
      getContentValues in class AbstractTaskFilter
      Returns:
      All content values of state filter.
    • getContent

      public String getContent()
      Returns required state value of task.
      Overrides:
      getContent in class AbstractTaskFilter
      Returns:
      Required state value of task.
    • filterTasks

      public Vector filterTasks(Vector tasks)
      Applies state 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.