com.levigo.jadice.search
Class PatternSearchRequest

java.lang.Object
  extended by com.levigo.jadice.search.AbstractCharSequenceSearchRequest
      extended by com.levigo.jadice.search.PatternSearchRequest

public class PatternSearchRequest
extends AbstractCharSequenceSearchRequest

A variation of a AbstractCharSequenceSearchRequest which allows searching using Patterns. This kind of search request is mainly useful for batch processing of documents. A array of patterns has to be set using the setPatterns(Pattern[]) method. Each one will be executed, in the indexing order of the array.

The PatternSearchRequest will provide the matching pattern as the handback value of Result. Please see Result.getHandback() and MatchConsumer.match(int, int, Object) for details.


Nested Class Summary
protected static class PatternSearchRequest.PatternMatcher
           
 
Field Summary
 
Fields inherited from class com.levigo.jadice.search.AbstractCharSequenceSearchRequest
PROPERTY_PAGES
 
Constructor Summary
PatternSearchRequest()
           
 
Method Summary
protected  CharSequenceMatcher createMatcher()
          Creates a CharSequenceMatcher.
 Pattern[] getPatterns()
          Returns the Patterns applied to this PatternSearchRequest or null if no patterns have been applied yet.
 boolean isValid()
          Extends the AbstractCharSequenceSearchRequest.isValid() by requiring a valid array of Patterns.
 void setPatterns(Pattern[] patterns)
          Assign an array of Patterns to this PatternSearchRequest.
 
Methods inherited from class com.levigo.jadice.search.AbstractCharSequenceSearchRequest
addSearchStateListener, cancel, ensureModifiable, ensureNotRunning, ensureValid, execute, executeSync, getInternalHook, getPages, getResultList, getState, isModifiable, isRunning, reset, setPages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternSearchRequest

public PatternSearchRequest()
Method Detail

setPatterns

public void setPatterns(Pattern[] patterns)
Assign an array of Patterns to this PatternSearchRequest. The array must not be null, have a zero length and no element in the array may be null. Is one of the conditions, mentioned before, violated this method will throw an IllegalArgumentException.

Parameters:
patterns - the Patterns to search for.
Throws:
IllegalArgumentException - if the array is null or has zero length.

getPatterns

public Pattern[] getPatterns()
Returns the Patterns applied to this PatternSearchRequest or null if no patterns have been applied yet.

Returns:
the Patterns applied to this PatternSearchRequest or null if no patterns have been applied yet.

isValid

public boolean isValid()
Extends the AbstractCharSequenceSearchRequest.isValid() by requiring a valid array of Patterns. Please see AbstractCharSequenceSearchRequest.isValid() for details.

Overrides:
isValid in class AbstractCharSequenceSearchRequest
Returns:
true if the configuration is sufficient
See Also:
AbstractCharSequenceSearchRequest.isValid()

createMatcher

protected CharSequenceMatcher createMatcher()
Description copied from class: AbstractCharSequenceSearchRequest
Creates a CharSequenceMatcher. This method may never return null.

Specified by:
createMatcher in class AbstractCharSequenceSearchRequest
Returns:
a ready-to-use CharSequenceMatcher


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.