public class ElementCollectorVisitor extends LanguageVisitor
This visitor class will traverse a language object tree and collect all element symbol references it finds. It uses a collection to collect the elements in so different collections will give you different collection properties - for instance, using a Set will remove duplicates.
The easiest way to use this visitor is to call the static methods which create the visitor (and possibly the collection), run the visitor, and return the collection. The public visit() methods should NOT be called directly.
Constructor and Description |
---|
ElementCollectorVisitor(Collection<? super ElementSymbol> elements)
Construct a new visitor with the specified collection, which should
be non-null.
|
Modifier and Type | Method and Description |
---|---|
static Collection<ElementSymbol> |
getAggregates(LanguageObject obj,
boolean removeDuplicates) |
static void |
getElements(Collection<? extends LanguageObject> objs,
Collection<ElementSymbol> elements) |
static Collection<ElementSymbol> |
getElements(LanguageObject obj,
boolean removeDuplicates)
Helper to quickly get the elements from obj in a collection.
|
static Collection<ElementSymbol> |
getElements(LanguageObject obj,
boolean removeDuplicates,
boolean useDeepIteration)
Helper to quickly get the elements from obj in a collection.
|
static Collection<ElementSymbol> |
getElements(LanguageObject obj,
boolean removeDuplicates,
boolean useDeepIteration,
boolean aggsOnly) |
static void |
getElements(LanguageObject obj,
Collection<? super ElementSymbol> elements)
Helper to quickly get the elements from obj in the elements collection
|
void |
visit(ElementSymbol obj)
Visit a language object and collect symbols.
|
void |
visit(MultipleElementSymbol obj)
Visit a language object and collect symbols.
|
setAbort, shouldAbort, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
public ElementCollectorVisitor(Collection<? super ElementSymbol> elements)
elements
- Collection to use for elementsIllegalArgumentException
- If elements is nullpublic void visit(ElementSymbol obj)
visit
in class LanguageVisitor
obj
- Language objectpublic void visit(MultipleElementSymbol obj)
visit
in class LanguageVisitor
obj
- Language objectpublic static final void getElements(LanguageObject obj, Collection<? super ElementSymbol> elements)
obj
- Language objectelements
- Collection to collect elements inpublic static final void getElements(Collection<? extends LanguageObject> objs, Collection<ElementSymbol> elements)
public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates)
obj
- Language objectremoveDuplicates
- True to remove duplicatesElementSymbol
public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates, boolean useDeepIteration)
obj
- Language objectremoveDuplicates
- True to remove duplicatesuseDeepIteration
- indicates whether or not to iterate into nested
subqueries of the queryElementSymbol
public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates, boolean useDeepIteration, boolean aggsOnly)
public static final Collection<ElementSymbol> getAggregates(LanguageObject obj, boolean removeDuplicates)
Copyright © 2018 JBoss by Red Hat. All rights reserved.