Package org.teiid.query.sql.visitor
Class ElementCollectorVisitor
- java.lang.Object
-
- org.teiid.query.sql.LanguageVisitor
-
- org.teiid.query.sql.visitor.ElementCollectorVisitor
-
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 Summary
Constructors Constructor Description ElementCollectorVisitor(Collection<? super ElementSymbol> elements)
Construct a new visitor with the specified collection, which should be non-null.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 collectionvoid
visit(ElementSymbol obj)
Visit a language object and collect symbols.void
visit(MultipleElementSymbol obj)
Visit a language object and collect symbols.-
Methods inherited from class org.teiid.query.sql.LanguageVisitor
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, visit, visit, visit
-
-
-
-
Constructor Detail
-
ElementCollectorVisitor
public ElementCollectorVisitor(Collection<? super ElementSymbol> elements)
Construct a new visitor with the specified collection, which should be non-null.- Parameters:
elements
- Collection to use for elements- Throws:
IllegalArgumentException
- If elements is null
-
-
Method Detail
-
visit
public void visit(ElementSymbol obj)
Visit a language object and collect symbols. This method should NOT be called directly.- Overrides:
visit
in classLanguageVisitor
- Parameters:
obj
- Language object
-
visit
public void visit(MultipleElementSymbol obj)
Visit a language object and collect symbols. This method should NOT be called directly.- Overrides:
visit
in classLanguageVisitor
- Parameters:
obj
- Language object
-
getElements
public static final void getElements(LanguageObject obj, Collection<? super ElementSymbol> elements)
Helper to quickly get the elements from obj in the elements collection- Parameters:
obj
- Language objectelements
- Collection to collect elements in
-
getElements
public static final void getElements(Collection<? extends LanguageObject> objs, Collection<ElementSymbol> elements)
-
getElements
public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates)
Helper to quickly get the elements from obj in a collection. The removeDuplicates flag affects whether duplicate elements will be filtered out.- Parameters:
obj
- Language objectremoveDuplicates
- True to remove duplicates- Returns:
- Collection of
ElementSymbol
-
getElements
public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates, boolean useDeepIteration)
Helper to quickly get the elements from obj in a collection. The removeDuplicates flag affects whether duplicate elements will be filtered out.- Parameters:
obj
- Language objectremoveDuplicates
- True to remove duplicatesuseDeepIteration
- indicates whether or not to iterate into nested subqueries of the query- Returns:
- Collection of
ElementSymbol
-
getElements
public static final Collection<ElementSymbol> getElements(LanguageObject obj, boolean removeDuplicates, boolean useDeepIteration, boolean aggsOnly)
-
getAggregates
public static final Collection<ElementSymbol> getAggregates(LanguageObject obj, boolean removeDuplicates)
-
-