Interface FilterExpression

    • Method Detail

      • applyOSH

        @Contract(pure=true)
        default boolean applyOSH​(OSHEntity entity)
        Apply the filter to an OSH entity.

        Must be compatible with the result of applyOSM(org.heigit.ohsome.oshdb.osm.OSMEntity), e.g. that it must not return false when oshEntity.getVersions().….anyMatch(applyOSM) would evaluate to true.

        Parameters:
        entity - the OSH entity to check.
        Returns:
        false if the filter knows that none of the versions of the OSH entity can fulfill the specified filter, true otherwise.
      • applyOSM

        @Contract(pure=true)
        boolean applyOSM​(OSMEntity entity)
        Apply the filter to an OSM entity.
        Parameters:
        entity - the OSM entity to check.
        Returns:
        true if the entity fulfills the specified filter, otherwise false.
      • applyOSMGeometry

        @Contract(pure=true)
        default boolean applyOSMGeometry​(OSMEntity entity,
                                         Supplier<org.locationtech.jts.geom.Geometry> geometrySupplier)
        Apply the filter to an "OSM feature" (i.e. an entity with a geometry).

        The default implementation doesn't perform a geometry type check, but any Filter can override it to do so.

        Parameters:
        entity - the OSM entity to check.
        geometrySupplier - a function returning the geometry of this OSM feature to check.
        Returns:
        true if the OSM feature fulfills the specified filter, otherwise false.
      • applyOSMGeometry

        @Contract(pure=true)
        default boolean applyOSMGeometry​(OSMEntity entity,
                                         org.locationtech.jts.geom.Geometry geometry)
        Apply the filter to an "OSM feature" (i.e. an entity with a geometry).

        The default implementation doesn't perform a geometry type check, but any Filter can override it to do so.

        Parameters:
        entity - the OSM entity to check.
        geometry - the geometry of this OSM feature to check.
        Returns:
        true if the OSM feature fulfills the specified filter, otherwise false.
      • applyOSMEntitySnapshot

        @Contract(pure=true)
        default boolean applyOSMEntitySnapshot​(OSMEntitySnapshot snapshot)
        Apply a filter to a snapshot (OSMEntitySnapshot) of an OSM entity.
        Parameters:
        snapshot - a snapshot of the OSM entity to check
        Returns:
        true if the the OSM entity snapshot fulfills the specified filter, otherwise false.
      • applyOSMContribution

        @Contract(pure=true)
        default boolean applyOSMContribution​(OSMContribution contribution)
        Apply a filter to a contribution (OSMEntitySnapshot) to an OSM entity.

        A contribution matches the given filter if either the state of the OSM entity before the modification or the state of it after the modification matches the filter.

        Parameters:
        contribution - a modification of the OSM entity to check
        Returns:
        true if the the OSM contribution fulfills the specified filter, otherwise false.
      • negate

        @Contract(pure=true)
        FilterExpression negate()
        Returns the opposite of the current filter expression.
        Returns:
        the opposite of the current filter expression.
      • normalize

        @Contract(pure=true)
        default List<List<Filter>> normalize()
        Converts a random boolean expression into a disjunctive normal form.

        for example: A∧(B∨C) ⇔ (A∧B)∨(A∧C)

        Returns:
        a disjunction of conjunctions of filter expressions: A∧B∧… ∨ C∧D∧… ∨ …
        Throws:
        IllegalStateException - if the filter cannot be normalized (all filters provided by the oshdb-filter module are normalizable, but this can occur for user defined filter expressions)