org.mmbase.storage.search.implementation
Class BasicStringSearchConstraint

java.lang.Object
  extended by org.mmbase.storage.search.implementation.BasicConstraint
      extended by org.mmbase.storage.search.implementation.BasicFieldConstraint
          extended by org.mmbase.storage.search.implementation.BasicStringSearchConstraint
All Implemented Interfaces:
Serializable, Constraint, FieldConstraint, StringSearchConstraint

public class BasicStringSearchConstraint
extends BasicFieldConstraint
implements StringSearchConstraint, Serializable

Basic implementation.

Since:
MMBase-1.7
Version:
$Id: BasicStringSearchConstraint.java 41982 2010-04-20 14:05:14Z michiel $
Author:
Rob van Maris
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mmbase.storage.search.implementation.BasicConstraint
modifiable
 
Fields inherited from interface org.mmbase.storage.search.StringSearchConstraint
MATCH_TYPE_DESCRIPTIONS, MATCH_TYPE_FUZZY, MATCH_TYPE_LITERAL, MATCH_TYPE_SYNONYM, PARAM_FUZZINESS, PARAM_PROXIMITY_LIMIT, SEARCH_TYPE_DESCRIPTIONS, SEARCH_TYPE_PHRASE_ORIENTED, SEARCH_TYPE_PROXIMITY_ORIENTED, SEARCH_TYPE_WORD_ORIENTED
 
Constructor Summary
BasicStringSearchConstraint(StepField field, int searchType, int matchType, List<String> searchTerms)
          Creates a new instance of BasicStringSearchConstraint.
BasicStringSearchConstraint(StepField field, int searchType, int matchType, String searchTerms)
          Creates a new instance of BasicStringSearchConstraint.
 
Method Summary
 BasicStringSearchConstraint addSearchTerm(String searchTerm)
          Adds searchterm to list of searchterms.
 boolean equals(Object obj)
          Compares this constraint to the specified object.
 int getBasicSupportLevel()
          Tests if this constraint is supported by the basic queryhandler.
 int getMatchType()
          Gets the match type.
 String getMatchTypeDescription()
          Returns a description of the match type
 Map<String,Object> getParameters()
          Gets value of additional parameters.
 List<String> getSearchTerms()
          Gets the list of searchterms.
 int getSearchType()
          Gets the search type, this specifies how the search is performed.
 String getSearchTypeDescription()
          Returns a description of the search type
 int hashCode()
           
 BasicStringSearchConstraint setMatchType(int matchType)
          Sets the match type.
 BasicStringSearchConstraint setParameter(String name, Object value)
          Sets parameter.
 BasicStringSearchConstraint setSearchTerms(List<String> searchTerms)
          Sets searchterms to elements in specified list.
 BasicStringSearchConstraint setSearchTerms(String searchTerms)
          Sets searchterms to searchterms in string.
 BasicStringSearchConstraint setSearchType(int searchType)
          Sets the search type.
 String toString()
          Returns a string representation of this StringSearchConstraint.
 
Methods inherited from class org.mmbase.storage.search.implementation.BasicFieldConstraint
getField, getFieldName, isCaseSensitive, matches, setCaseSensitive
 
Methods inherited from class org.mmbase.storage.search.implementation.BasicConstraint
isInverse, setInverse, setUnmodifiable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.storage.search.FieldConstraint
getField, isCaseSensitive, matches
 
Methods inherited from interface org.mmbase.storage.search.Constraint
isInverse, setUnmodifiable
 

Constructor Detail

BasicStringSearchConstraint

public BasicStringSearchConstraint(StepField field,
                                   int searchType,
                                   int matchType,
                                   List<String> searchTerms)
Creates a new instance of BasicStringSearchConstraint.

Parameters:
field - The associated field.
searchType - The search type.
matchType - The match type.
searchTerms - the searchterms
Throws:
IllegalArgumentValue - when an invalid argument is supplied.
See Also:
getSearchType(), getMatchType()

BasicStringSearchConstraint

public BasicStringSearchConstraint(StepField field,
                                   int searchType,
                                   int matchType,
                                   String searchTerms)
Creates a new instance of BasicStringSearchConstraint.

Parameters:
field - The associated field.
searchType - The search type.
matchType - The match type.
searchTerms - String containing searchterms as words separated by white space.
Throws:
IllegalArgumentValue - when an invalid argument is supplied.
See Also:
getSearchType(), getMatchType()
Method Detail

setMatchType

public BasicStringSearchConstraint setMatchType(int matchType)
Sets the match type.

Parameters:
matchType - The matchtype.
Returns:
This BasicStringSearchConstraint instance.
Throws:
IllegalArgumentValue - when an invalid argument is supplied.
See Also:
getMatchType()

setSearchType

public BasicStringSearchConstraint setSearchType(int searchType)
Sets the search type.

Parameters:
searchType - The searchType.
Returns:
This BasicStringSearchConstraint instance.
Throws:
IllegalArgumentValue - when an invalid argument is supplied.
See Also:
getSearchType()

addSearchTerm

public BasicStringSearchConstraint addSearchTerm(String searchTerm)
Adds searchterm to list of searchterms.

Parameters:
searchTerm - the searchterms
Returns:
This BasicStringSearchConstraint instance.
Throws:
IllegalArgumentException - when an invalid argument is supplied.

setSearchTerms

public BasicStringSearchConstraint setSearchTerms(List<String> searchTerms)
Sets searchterms to elements in specified list.

Parameters:
searchTerms - the searchterms
Returns:
This BasicStringSearchConstraint instance.

setSearchTerms

public BasicStringSearchConstraint setSearchTerms(String searchTerms)
Sets searchterms to searchterms in string.

Parameters:
searchTerms - String containing searchterms as words separated by white space.
Returns:
This BasicStringSearchConstraint instance.
Throws:
IllegalArgumentException - when an invalid argument is supplied.

setParameter

public BasicStringSearchConstraint setParameter(String name,
                                                Object value)
Sets parameter. Ignored if parameter is not relavant to the present search- and matchtype.

Parameters:
name - The parameter name.
value - The parameter value.
Returns:
This BasicStringSearchConstraint instance.
Throws:
IllegalArgumentValue - when an invalid argument is supplied.
See Also:
getParameters()

getParameters

public Map<String,Object> getParameters()
Description copied from interface: StringSearchConstraint
Gets value of additional parameters.

Specified by:
getParameters in interface StringSearchConstraint
Returns:
The parameters, as an unmodifiable Map.

getMatchType

public int getMatchType()
Description copied from interface: StringSearchConstraint
Gets the match type.

Specified by:
getMatchType in interface StringSearchConstraint

getMatchTypeDescription

public String getMatchTypeDescription()
Returns a description of the match type


getSearchType

public int getSearchType()
Description copied from interface: StringSearchConstraint
Gets the search type, this specifies how the search is performed.

Specified by:
getSearchType in interface StringSearchConstraint

getSearchTypeDescription

public String getSearchTypeDescription()
Returns a description of the search type


getSearchTerms

public List<String> getSearchTerms()
Description copied from interface: StringSearchConstraint
Gets the list of searchterms.

Specified by:
getSearchTerms in interface StringSearchConstraint
Returns:
The searchterms, as an unmodifiable List.

getBasicSupportLevel

public int getBasicSupportLevel()
Description copied from interface: Constraint
Tests if this constraint is supported by the basic queryhandler.

Specified by:
getBasicSupportLevel in interface Constraint
Overrides:
getBasicSupportLevel in class BasicConstraint

equals

public boolean equals(Object obj)
Description copied from interface: Constraint
Compares this constraint to the specified object. The result is true if and only if the argument is a non-null Constraint object representing the same constraint(s).

Specified by:
equals in interface Constraint
Overrides:
equals in class BasicFieldConstraint
Parameters:
obj - The object to compare with.
Returns:
true if the objects are equal, false otherwise.

hashCode

public int hashCode()
Specified by:
hashCode in interface Constraint
Overrides:
hashCode in class BasicFieldConstraint

toString

public String toString()
Description copied from interface: StringSearchConstraint
Returns a string representation of this StringSearchConstraint. The string representation has the form "StringSearchConstraint(inverse:<:inverse>, field:<field>, casesensitive:<casesensitive>, searchtype:<searchtype>, matchtype:<matchtype>, parameters:<parameters>, searchterms:<searchterms>)" where


MMBase 2.0-SNAPSHOT - null