Package adams.gui.core
Class SearchParameters
- java.lang.Object
-
- adams.gui.core.SearchParameters
-
public class SearchParameters extends Object
A container for search parameters.
In case of simple substring matching, the search string and the string being searched are both used in lower case.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected Double
m_Double
not null if the search string is a double.protected Long
m_Long
not null if the search string is a long.protected Pattern
m_Pattern
for speeding up the matching of regular expressions.protected boolean
m_RegExp
whether to perform regular expression matching.protected String[]
m_SearchParts
the parts of the search string (split on blanks).protected String
m_SearchString
the search string.
-
Constructor Summary
Constructors Constructor Description SearchParameters(String search)
Initializes the search with simple substring matching.SearchParameters(String search, boolean regExp)
Initializes the search.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getLong()
Returns whether the search string represents an integer.String
getSearchString()
Returns the current search string.boolean
isDouble()
Returns whether the search string represents a double.boolean
isRegExp()
Returns whether the search uses regular expression matching or simple substring matching.boolean
matches(Double d)
Matches the double against the search string if it represents an double.boolean
matches(Float f)
Matches the float against the search string if it represents a float.boolean
matches(Integer i)
Matches the integer against the search string if it represents an integer.boolean
matches(Long l)
Matches the long against the search string if it represents a long.boolean
matches(String s)
Matches the search string against the provided string.String
toString()
Returns a short string representation of the search container.
-
-
-
Field Detail
-
m_SearchString
protected String m_SearchString
the search string.
-
m_SearchParts
protected String[] m_SearchParts
the parts of the search string (split on blanks).
-
m_Long
protected Long m_Long
not null if the search string is a long.
-
m_Double
protected Double m_Double
not null if the search string is a double.
-
m_RegExp
protected boolean m_RegExp
whether to perform regular expression matching.
-
m_Pattern
protected Pattern m_Pattern
for speeding up the matching of regular expressions.
-
-
Constructor Detail
-
SearchParameters
public SearchParameters(String search)
Initializes the search with simple substring matching.- Parameters:
search
- the search string
-
SearchParameters
public SearchParameters(String search, boolean regExp)
Initializes the search.- Parameters:
search
- the search stringregExp
- whether to perform regular expression matching or substring matching
-
-
Method Detail
-
getSearchString
public String getSearchString()
Returns the current search string.- Returns:
- the search string
-
isRegExp
public boolean isRegExp()
Returns whether the search uses regular expression matching or simple substring matching.- Returns:
- true if regular expressions are in use
-
getLong
public boolean getLong()
Returns whether the search string represents an integer.- Returns:
- true if an integer
-
isDouble
public boolean isDouble()
Returns whether the search string represents a double.- Returns:
- true if an double
-
matches
public boolean matches(String s)
Matches the search string against the provided string. Empty search string matches everything.- Parameters:
s
- the string to match, null is ignored- Returns:
- true if a match
-
matches
public boolean matches(Integer i)
Matches the integer against the search string if it represents an integer.- Parameters:
i
- the integer to check- Returns:
- true if the search is the same integer
-
matches
public boolean matches(Long l)
Matches the long against the search string if it represents a long.- Parameters:
l
- the long to check- Returns:
- true if the search is the same long
-
matches
public boolean matches(Float f)
Matches the float against the search string if it represents a float.- Parameters:
f
- the float to check- Returns:
- true if the search is the same float
-
matches
public boolean matches(Double d)
Matches the double against the search string if it represents an double.- Parameters:
d
- the double to check- Returns:
- true if the search is the same double
-
-