P - The type of element of the set (often a pattern)T - The type of the instance passed to the predicatejava.util.function.Predicate<T>IncludeExcludepublic class IncludeExcludeSet<P,T>
extends java.lang.Object
implements java.util.function.Predicate<T>
Maintains a set of included and excluded elements. The method matches(Object)
will return true IFF the passed object is not in the excluded set AND ( either the
included set is empty OR the object is in the included set)
The type of the underlying Set used may be passed into the
constructor, so special sets like Servlet PathMap may be used.
| Constructor | Description |
|---|---|
IncludeExcludeSet() |
Default constructor over
HashSet |
IncludeExcludeSet(java.lang.Class<SET> setClass) |
Construct an IncludeExclude.
|
IncludeExcludeSet(java.util.Set<P> includeSet,
java.util.function.Predicate<T> includePredicate,
java.util.Set<P> excludeSet,
java.util.function.Predicate<T> excludePredicate) |
Construct an IncludeExclude
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
clear() |
|
void |
exclude(P element) |
|
void |
exclude(P... element) |
|
java.util.Set<P> |
getExcluded() |
|
java.util.Set<P> |
getIncluded() |
|
void |
include(P element) |
|
void |
include(P... element) |
|
boolean |
isEmpty() |
|
boolean |
matches(T t) |
|
int |
size() |
|
boolean |
test(T t) |
|
java.lang.String |
toString() |
public IncludeExcludeSet()
HashSetpublic IncludeExcludeSet(java.lang.Class<SET> setClass)
SET - The type of a set to use as the backing storesetClass - The type of Set to using internally to hold patterns. Two instances will be created.
one for include patterns and one for exclude patters. If the class is also a Predicate,
then it is also used as the item test for the set, otherwise a IncludeExcludeSet.SetContainsPredicate instance
is created.public IncludeExcludeSet(java.util.Set<P> includeSet, java.util.function.Predicate<T> includePredicate, java.util.Set<P> excludeSet, java.util.function.Predicate<T> excludePredicate)
SET - The type of a set to use as the backing storeincludeSet - the Set of items that represent the included spaceincludePredicate - the Predicate for included item testing (null for simple Set.contains(Object) test)excludeSet - the Set of items that represent the excluded spaceexcludePredicate - the Predicate for excluded item testing (null for simple Set.contains(Object) test)public void include(P element)
public void include(P... element)
public void exclude(P element)
public void exclude(P... element)
public boolean matches(T t)
public int size()
public java.util.Set<P> getIncluded()
public java.util.Set<P> getExcluded()
public void clear()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEmpty()
Copyright © 1995–2018 Webtide. All rights reserved.