public abstract class SimpleSearchHandler extends java.lang.Object implements ISearchHandler
Lets searching ADQL objects which match with the condition defined in the function match(ADQLObject)
.
SearchColumnHandler
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<ADQLObject> |
results
List of all matching ADQL objects.
|
Constructor and Description |
---|
SimpleSearchHandler()
Builds a SimpleSearchHandler:
|
SimpleSearchHandler(boolean recursive)
Builds a SimpleSearchHandler which does not stop at the first match.
|
SimpleSearchHandler(boolean recursive,
boolean onlyFirstMatch)
Builds a SimpleSearchHandler.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMatch(ADQLObject matchObj,
ADQLIterator it)
Adds the given ADQL object as one result of the research.
|
int |
getNbMatch()
Indicates how many ADQL objects have matched.
|
protected boolean |
goInto(ADQLObject obj)
Indicates whether the research must continue inside the given ADQL object or not:
by default, it returns always true except if the given object is an ADQL query while the research must not be recursive.
|
protected boolean |
isFinished()
Indicates whether the research must finish now or not:
by default, the research ends only at the first match if it has been asked (see
setOnlyFirstMatch(boolean) ). |
boolean |
isRecursive()
Tells whether this handler must search also in sub-queries.
|
java.util.Iterator<ADQLObject> |
iterator()
Lets to iterate on the list of all the matched ADQL objects.
|
protected abstract boolean |
match(ADQLObject obj)
Only tests whether the given ADQL object checks the search conditions.
|
boolean |
onlyFirstMatch()
Tells whether this handler must stop at the first match.
|
protected void |
reset()
Resets this handler before the beginning of the research:
by default, the list of results is cleared.
|
void |
search(ADQLObject startObj)
Searches all matching ADQL objects from the given ADQL object (included).
|
void |
setOnlyFirstMatch(boolean firstMatch)
Lets configuring this handler so that it must stop at the first match.
|
void |
setRecursive(boolean recursive)
Lets configuring this handler so that it must search also in sub-queries or not.
|
protected final java.util.ArrayList<ADQLObject> results
public SimpleSearchHandler()
Builds a SimpleSearchHandler:
public SimpleSearchHandler(boolean recursive)
recursive
- true to search also in sub-queries, false otherwise.public SimpleSearchHandler(boolean recursive, boolean onlyFirstMatch)
recursive
- true to search also in sub-queries, false otherwise.onlyFirstMatch
- true to stop at the first match, false otherwise.public final boolean isRecursive()
public final void setRecursive(boolean recursive)
recursive
- true to search recursively, false otherwise.public final boolean onlyFirstMatch()
public final void setOnlyFirstMatch(boolean firstMatch)
firstMatch
- true if it must stop at the first match, false otherwise.public final java.util.Iterator<ADQLObject> iterator()
ISearchHandler
iterator
in interface ISearchHandler
iterator
in interface java.lang.Iterable<ADQLObject>
Iterable.iterator()
public final int getNbMatch()
ISearchHandler
getNbMatch
in interface ISearchHandler
protected boolean isFinished()
setOnlyFirstMatch(boolean)
).protected boolean goInto(ADQLObject obj)
obj
- An ADQL object.protected void addMatch(ADQLObject matchObj, ADQLIterator it)
Warning: the second parameter (it) may be null if the given match is the root search object itself.
matchObj
- An ADQL object which has matched to the research criteria.it
- The iterator from which the matched ADQL object has been extracted.protected void reset()
public final void search(ADQLObject startObj)
ISearchHandler
search
in interface ISearchHandler
startObj
- The ADQL object from which the search must start.protected abstract boolean match(ADQLObject obj)
obj
- The ADQL object to test. (warning: this object may be null !)