Class AbstractFilter

java.lang.Object
nl.tudelft.simulation.language.filters.AbstractFilter
All Implemented Interfaces:
Serializable, FilterInterface
Direct Known Subclasses:
CompositeFilter, MaxPointFilter, ModulusFilter, ZeroFilter

public abstract class AbstractFilter extends Object implements FilterInterface
The abstract filter forms the abstract class for all filters. The filter method should be implemented by all subclasses. This filter method should have the same semantics as the accept(inverted=false) method.

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.

Author:
Niels Lang , Peter Jacobs
See Also:
  • Field Details

    • inverted

      protected boolean inverted
      is this filter inverted.
  • Constructor Details

    • AbstractFilter

      public AbstractFilter()
      constructs a new AbstractFilter.
  • Method Details

    • isInverted

      public boolean isInverted()
      is the filter inverted?
      Specified by:
      isInverted in interface FilterInterface
      Returns:
      whether the filter is inverted.
    • setInverted

      public void setInverted(boolean inverted)
      inverts the filter.
      Specified by:
      setInverted in interface FilterInterface
      Parameters:
      inverted - boolean; whether to invert the filter
    • accept

      public boolean accept(Object entry)
      a filter defines whether to accept a value in a chart.
      Specified by:
      accept in interface FilterInterface
      Parameters:
      entry - Object; the entry to filter
      Returns:
      whether to accept this entry
    • filter

      protected abstract boolean filter(Object entry)
      filters the entry. This method should be implemented by every filter based on its semantic meaning.
      Parameters:
      entry - Object; the entry to filter.
      Returns:
      whether to accept the value.
    • getCriterion

      public abstract String getCriterion()
      returns a string representation of the criterion.
      Specified by:
      getCriterion in interface FilterInterface
      Returns:
      the string representing the criterion
    • and

      public FilterInterface and(FilterInterface filter)
      adds filter to this filter and returns the composed filter.
      Specified by:
      and in interface FilterInterface
      Parameters:
      filter - FilterInterface; the filter to add
      Returns:
      the composed filter
    • or

      public FilterInterface or(FilterInterface filter)
      creates a new composite filter which is one or two.
      Specified by:
      or in interface FilterInterface
      Parameters:
      filter - FilterInterface; the filter to add
      Returns:
      the composed filter
    • toString

      public String toString()
      Overrides:
      toString in class Object