Top Description Fields Constructors Methods
org.eclipse.jetty.util

public Class RegexSet

extends AbstractSet<String>
implements Predicate<String>
Class Inheritance
All Implemented Interfaces
java.util.function.Predicate
Imports
java.util.AbstractSet, .Collections, .HashSet, .Iterator, .Set, java.util.function.Predicate, java.util.regex.Pattern

A Set of Regular expressions strings.

Provides the efficient matches(String) method to check for a match against all the combined Regex's

Field Summary

Modifier and TypeField and Description
private Pattern
private final Set<String>
private final Set<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
add(String
element to be added to this set
pattern
)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Adds the specified element to this set if it is not already present (optional operation).

public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the elements from this set (optional operation).

public boolean
isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Returns true if this set contains no elements.

public Iterator<String>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.

public boolean
public boolean
remove(Object
object to be removed from this set, if present
pattern
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present (optional operation).

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).

public boolean
test(String
the input argument
s
)

Implements java.util.function.Predicate.test.

Evaluates this predicate on the given argument.

private void
Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Field Detail

_patternback to summary
private Pattern _pattern
_patternsback to summary
private final Set<String> _patterns
_unmodifiableback to summary
private final Set<String> _unmodifiable

Constructor Detail

RegexSetback to summary
public RegexSet()

Method Detail

addback to summary
public boolean add(String pattern)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.Set.add.

Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

Parameters
pattern:String

element to be added to this set

Returns:boolean

true if this set did not already contain the specified element

Annotations
@Override
clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Doc from java.util.Set.clear.

Removes all of the elements from this set (optional operation). The set will be empty after this call returns.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Doc from java.util.Set.isEmpty.

Returns true if this set contains no elements.

Returns:boolean

true if this set contains no elements

Annotations
@Override
iteratorback to summary
public Iterator<String> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<String>

an iterator over the elements in this set

Annotations
@Override
matchesback to summary
public boolean matches(String s)
removeback to summary
public boolean remove(Object pattern)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Parameters
pattern:Object

object to be removed from this set, if present

Returns:boolean

true if this set contained the specified element

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
testback to summary
public boolean test(String s)

Implements java.util.function.Predicate.test.

Doc from java.util.function.Predicate.test.

Evaluates this predicate on the given argument.

Parameters
s:String

the input argument

Returns:boolean

true if the input argument matches the predicate, otherwise false

Annotations
@Override
updatePatternback to summary
private void updatePattern()