APIdia Launch Partner
Top Description Inners Constructors Methods
io.github.spannm.jackcess.util

public abstract Class RowFilter

extends Object
implements Predicate<Row>
Class Inheritance
All Implemented Interfaces
java.util.function.Predicate
Imports
io.github.spannm.jackcess.Column, .Row, java.util.Iterator, .Map, .NoSuchElementException, .Objects, java.util.function.Predicate, java.util.stream.Stream, .StreamSupport

The RowFilter class encapsulates a filter test for a table row. This can be used by the apply(Iterable) method to create an Iterable over a table which returns only rows matching some criteria.
Author
Patricia Donaldson, Xerox Corporation

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
RowFilter.FilterIterable

Iterable which creates a filtered view of a another row iterable.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Iterable<Row>

Returns:

a filtering iterable
apply
(Iterable<? extends Row>
row iterable to filter
iterable
)

Returns an iterable which filters the given iterable based on this filter.

public static Iterable<Row>

Returns:

a filtering iterable (or the given iterable if a null filter was given)
apply
(RowFilter
the filter criteria, may be null
rowFilter
,
Iterable<? extends Row>
row iterable to filter
iterable
)

Returns an iterable which filters the given iterable based on the given rowFilter.

public Stream<Row>
filter(Iterable<? extends Row> iterable)

Convenience method to apply this filter to the given iterable and return it as a Stream.

public static RowFilter

Returns:

a RowFilter which matches rows not matched by the given filter
invert
(final RowFilter
filter which to invert
filter
)

Creates a filter which inverts the sense of the given filter (rows which are matched by the given filter will not be matched by the returned filter, and vice versa).

public abstract boolean
matches(Row
current row to test for inclusion in the filter
row
)

Returns true if the given table row matches the Filter criteria, false otherwise.

public static RowFilter

Returns:

a filter which matches table rows which match the values in the row pattern
matchPattern
(final Map<String, ?>
Map from column names to the values to be matched. A table row will match the target if Objects.equals(rowPattern.get(s), row.get(s)) for all column names in the pattern map.
rowPattern
)

Creates a filter based on a row pattern.

public static RowFilter

Returns:

a filter which matches table rows which match the value in the row pattern
matchPattern
(Column
column to be matched
columnPattern
,
Object
value to be matched. A table row will match the target if Objects.equals(valuePattern, row.get(columnPattern.getName())).
valuePattern
)

Creates a filter based on a single value row pattern.

public boolean
test(Row row)

Implements java.util.function.Predicate.test.

Adaptation of this class for Predicate support.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RowFilterback to summary
public RowFilter()

Method Detail

applyback to summary
public Iterable<Row> apply(Iterable<? extends Row> iterable)

Returns an iterable which filters the given iterable based on this filter.

Parameters
iterable:Iterable<? extends Row>

row iterable to filter

Returns:Iterable<Row>

a filtering iterable

Annotations
@SuppressWarnings:AmbiguousMethodReference
applyback to summary
public static Iterable<Row> apply(RowFilter rowFilter, Iterable<? extends Row> iterable)

Returns an iterable which filters the given iterable based on the given rowFilter.

Parameters
rowFilter:RowFilter

the filter criteria, may be null

iterable:Iterable<? extends Row>

row iterable to filter

Returns:Iterable<Row>

a filtering iterable (or the given iterable if a null filter was given)

Annotations
@SuppressWarnings:unchecked, AmbiguousMethodReference
filterback to summary
public Stream<Row> filter(Iterable<? extends Row> iterable)

Convenience method to apply this filter to the given iterable and return it as a Stream.

invertback to summary
public static RowFilter invert(final RowFilter filter)

Creates a filter which inverts the sense of the given filter (rows which are matched by the given filter will not be matched by the returned filter, and vice versa).

Parameters
filter:RowFilter

filter which to invert

Returns:RowFilter

a RowFilter which matches rows not matched by the given filter

matchesback to summary
public abstract boolean matches(Row row)

Returns true if the given table row matches the Filter criteria, false otherwise.

Parameters
row:Row

current row to test for inclusion in the filter

matchPatternback to summary
public static RowFilter matchPattern(final Map<String, ?> rowPattern)

Creates a filter based on a row pattern.

Parameters
rowPattern:Map<String, ?>

Map from column names to the values to be matched. A table row will match the target if Objects.equals(rowPattern.get(s), row.get(s)) for all column names in the pattern map.

Returns:RowFilter

a filter which matches table rows which match the values in the row pattern

matchPatternback to summary
public static RowFilter matchPattern(Column columnPattern, Object valuePattern)

Creates a filter based on a single value row pattern.

Parameters
columnPattern:Column

column to be matched

valuePattern:Object

value to be matched. A table row will match the target if Objects.equals(valuePattern, row.get(columnPattern.getName())).

Returns:RowFilter

a filter which matches table rows which match the value in the row pattern

testback to summary
public boolean test(Row row)

Implements java.util.function.Predicate.test.

Adaptation of this class for Predicate support. Uses the matches method.

Annotations
@Override
io.github.spannm.jackcess.util back to summary

private final Class RowFilter.FilterIterable

extends Object
implements Iterable<Row>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable

Iterable which creates a filtered view of a another row iterable.

Field Summary

Modifier and TypeField and Description
private final Iterable<? extends Row>

Constructor Summary

AccessConstructor and Description
private
FilterIterable(Iterable<? extends Row> iterable)

Method Summary

Modifier and TypeMethod and Description
public Iterator<Row>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator which iterates through the rows of the underlying iterable, returning only rows for which the RowFilter#matches method returns true

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iterableback to summary
private final Iterable<? extends Row> iterable

Constructor Detail

FilterIterableback to summary
private FilterIterable(Iterable<? extends Row> iterable)

Method Detail

iteratorback to summary
public Iterator<Row> iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator which iterates through the rows of the underlying iterable, returning only rows for which the RowFilter#matches method returns true

Annotations
@Override