com.metamatrix.query.sql.visitor
Class GroupCollectorVisitor

java.lang.Object
  extended by com.metamatrix.query.sql.LanguageVisitor
      extended by com.metamatrix.query.sql.visitor.GroupCollectorVisitor

public class GroupCollectorVisitor
extends LanguageVisitor

This visitor class will traverse a language object tree and collect all group symbol references it finds. It uses a collection to collect the groups 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 get the collection. The public visit() methods should NOT be called directly.


Constructor Summary
GroupCollectorVisitor(java.util.Collection groups)
          Construct a new visitor with the specified collection, which should be non-null.
 
Method Summary
 java.util.Collection getGroups()
          Get the groups collected by the visitor.
static java.util.Collection getGroups(LanguageObject obj, boolean removeDuplicates)
          Helper to quickly get the groups from obj in a collection.
static void getGroups(LanguageObject obj, java.util.Collection groups)
          Helper to quickly get the groups from obj in the groups collection
static java.util.Collection getGroupsIgnoreInlineViews(LanguageObject obj, boolean removeDuplicates)
          Helper to quickly get the groups from obj in a collection.
static void getGroupsIgnoreInlineViews(LanguageObject obj, java.util.Collection groups)
          Helper to quickly get the groups from obj in the groups collection
 java.util.Collection getInlineViewGroups()
           
 void setIgnoreInlineViewGroups(boolean ignoreInlineViewGroups)
           
 void visit(GroupSymbol obj)
          Visit a language object and collect symbols.
 void visit(Into obj)
           
 void visit(StoredProcedure obj)
          Visit a language object and collect symbols.
 void visit(SubqueryFromClause obj)
           
 
Methods inherited from class com.metamatrix.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupCollectorVisitor

public GroupCollectorVisitor(java.util.Collection groups)
Construct a new visitor with the specified collection, which should be non-null.

Parameters:
groups - Collection to use for groups
Throws:
java.lang.IllegalArgumentException - If groups is null
Method Detail

getGroups

public java.util.Collection getGroups()
Get the groups collected by the visitor. This should best be called after the visitor has been run on the language object tree.

Returns:
Collection of GroupSymbol

getInlineViewGroups

public java.util.Collection getInlineViewGroups()

setIgnoreInlineViewGroups

public void setIgnoreInlineViewGroups(boolean ignoreInlineViewGroups)

visit

public void visit(GroupSymbol obj)
Visit a language object and collect symbols. This method should NOT be called directly.

Overrides:
visit in class LanguageVisitor
Parameters:
obj - Language object

visit

public void visit(StoredProcedure obj)
Visit a language object and collect symbols. This method should NOT be called directly.

Overrides:
visit in class LanguageVisitor
Parameters:
obj - Language object

visit

public void visit(Into obj)
Overrides:
visit in class LanguageVisitor

visit

public void visit(SubqueryFromClause obj)
Overrides:
visit in class LanguageVisitor

getGroups

public static void getGroups(LanguageObject obj,
                             java.util.Collection groups)
Helper to quickly get the groups from obj in the groups collection

Parameters:
obj - Language object
elements - Collection to collect groups in

getGroups

public static java.util.Collection getGroups(LanguageObject obj,
                                             boolean removeDuplicates)
Helper to quickly get the groups from obj in a collection. The removeDuplicates flag affects whether duplicate groups will be filtered out.

Parameters:
obj - Language object
removeDuplicates - True to remove duplicates
Returns:
Collection of GroupSymbol

getGroupsIgnoreInlineViews

public static void getGroupsIgnoreInlineViews(LanguageObject obj,
                                              java.util.Collection groups)
Helper to quickly get the groups from obj in the groups collection

Parameters:
obj - Language object
elements - Collection to collect groups in

getGroupsIgnoreInlineViews

public static java.util.Collection getGroupsIgnoreInlineViews(LanguageObject obj,
                                                              boolean removeDuplicates)
Helper to quickly get the groups from obj in a collection. The removeDuplicates flag affects whether duplicate groups will be filtered out.

Parameters:
obj - Language object
removeDuplicates - True to remove duplicates
Returns:
Collection of GroupSymbol


Copyright © 2009. All Rights Reserved.