Class Filter<T>

java.lang.Object
megamek.common.pathfinder.filters.Filter<T>
Direct Known Subclasses:
AeroGroundPathFinder.AeroGroundOffBoardFilter, MovePathGreedyFilter, MovePathLegalityFilter, MovePathLengthFilter, MovePathLengthFilter, MovePathRiskFilter

public abstract class Filter<T> extends Object
Represents a function that allows removing unwanted objects from a collection.
  • Constructor Details

    • Filter

      public Filter()
  • Method Details

    • doFilter

      public Collection<T> doFilter(Collection<T> collection)
      Returns filtered collection by removing those objects that fail shouldStay(T) test.
      Parameters:
      collection - collection to be filtered
      Returns:
      filtered collection
    • shouldStay

      public abstract boolean shouldStay(T object)
      Tests if the object should stay in the collection.
      Parameters:
      object - tested object
      Returns:
      true if the object should stay in the collection