com.metamatrix.query.sql.symbol
Class GroupSymbol

java.lang.Object
  extended by com.metamatrix.query.sql.symbol.Symbol
      extended by com.metamatrix.query.sql.symbol.GroupSymbol
All Implemented Interfaces:
LanguageObject, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class GroupSymbol
extends Symbol
implements java.lang.Comparable

This is the server's representation of a metadata group symbol. The group symbol has a name, an optional definition, and a reference to a real metadata ID. Typically, a GroupSymbol will be created only from a name and possibly a definition if the group has an alias. The metadata ID is discovered only when resolving the query.

For example, if the original string contained a FROM clause such as "FROM Group1 AS G, Group2", there would be two GroupSymbols created. The first would have name=G, definition=Group1 and the second would have name=Group2, definition=null.

See Also:
Serialized Form

Field Summary
static java.lang.String TEMP_GROUP_PREFIX
           
 
Constructor Summary
  GroupSymbol(java.lang.String name)
          Construct a symbol with a name.
  GroupSymbol(java.lang.String name, java.lang.String definition)
          Construct a symbol with a name.
protected GroupSymbol(java.lang.String name, java.lang.String canonicalName, java.lang.String definition)
          Cloning constructor
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 java.lang.Object clone()
          Return a deep copy of this object.
 int compareTo(java.lang.Object other)
          Compare two groups and give an ordering.
 boolean equals(java.lang.Object obj)
          Compare group symbols
 java.lang.String getDefinition()
          Get the definition for the group symbol, which may be null
 java.lang.Object getMetadataID()
          Get the metadata ID that this group symbol resolves to.
 java.lang.String getNonCorrelationName()
           
 java.lang.String getOutputDefinition()
           
 boolean hasAlias()
           
 boolean isImplicitTempGroupSymbol()
           
 boolean isProcedure()
           
 boolean isResolved()
          Returns true if this symbol has been completely resolved with respect to actual runtime metadata.
static boolean isTempGroupName(java.lang.String name)
           
 boolean isTempGroupSymbol()
          Returns true if this is a symbol for a temporary group (i.e.
 boolean isTempTable()
           
 void setDefinition(java.lang.String definition)
          Set the definition for the group symbol, which may be null
 void setIsTempTable(boolean isTempTable)
           
 void setMetadataID(java.lang.Object metadataID)
          Set the metadata ID that this group symbol resolves to.
 void setOutputDefinition(java.lang.String outputDefinition)
           
 void setProcedure(boolean isProcedure)
           
 
Methods inherited from class com.metamatrix.query.sql.symbol.Symbol
getCanonical, getCanonicalName, getName, getOutputName, hashCode, setName, setOutputName, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TEMP_GROUP_PREFIX

public static final java.lang.String TEMP_GROUP_PREFIX
See Also:
Constant Field Values
Constructor Detail

GroupSymbol

protected GroupSymbol(java.lang.String name,
                      java.lang.String canonicalName,
                      java.lang.String definition)
Cloning constructor

Parameters:
name -
canonicalName -
definition -
Since:
4.3

GroupSymbol

public GroupSymbol(java.lang.String name)
Construct a symbol with a name.

Parameters:
name - Name of the symbol
Throws:
java.lang.IllegalArgumentException - If name is null

GroupSymbol

public GroupSymbol(java.lang.String name,
                   java.lang.String definition)
Construct a symbol with a name.

Parameters:
name - Name of the symbol
name - Definition of the symbol, may be null
Throws:
java.lang.IllegalArgumentException - If name is null
Method Detail

getNonCorrelationName

public java.lang.String getNonCorrelationName()

getDefinition

public java.lang.String getDefinition()
Get the definition for the group symbol, which may be null

Returns:
Group definition, may be null

setDefinition

public void setDefinition(java.lang.String definition)
Set the definition for the group symbol, which may be null

Parameters:
definition - Definition

getMetadataID

public java.lang.Object getMetadataID()
Get the metadata ID that this group symbol resolves to. If the group symbol has not been resolved yet, this will be null. If the symbol has been resolved, this will never be null.

Returns:
Metadata ID object

acceptVisitor

public void acceptVisitor(LanguageVisitor visitor)
Description copied from interface: LanguageObject
Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.

Specified by:
acceptVisitor in interface LanguageObject
Parameters:
visitor - Visitor being used

setMetadataID

public void setMetadataID(java.lang.Object metadataID)
Set the metadata ID that this group symbol resolves to. It cannot be null.

Parameters:
meatdataID - Metadata ID object
Throws:
java.lang.IllegalArgumentException - If metadataID is null

isResolved

public boolean isResolved()
Returns true if this symbol has been completely resolved with respect to actual runtime metadata. A resolved symbol has been validated that it refers to actual metadata and will have references to the real metadata IDs if necessary. Different types of symbols determine their resolution in different ways, so this method is abstract and must be implemented by subclasses.

Specified by:
isResolved in class Symbol
Returns:
True if resolved with runtime metadata

isTempGroupSymbol

public boolean isTempGroupSymbol()
Returns true if this is a symbol for a temporary group (i.e. if it starts with a '#')

Returns:
Since:
5.5

isImplicitTempGroupSymbol

public boolean isImplicitTempGroupSymbol()

compareTo

public int compareTo(java.lang.Object other)
Compare two groups and give an ordering. This is done with the hashcode of the lowercased group name. The order is stable.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - Other group
Returns:
-1, 0, or 1 depending on how this compares to group

clone

public java.lang.Object clone()
Return a deep copy of this object.

Specified by:
clone in interface LanguageObject
Specified by:
clone in class Symbol
Returns:
Deep copy of the object

equals

public boolean equals(java.lang.Object obj)
Compare group symbols

Overrides:
equals in class Symbol
Parameters:
obj - Other object to compare
Returns:
True if equivalent

hasAlias

public boolean hasAlias()

setIsTempTable

public void setIsTempTable(boolean isTempTable)

isTempGroupName

public static boolean isTempGroupName(java.lang.String name)

isTempTable

public boolean isTempTable()

isProcedure

public boolean isProcedure()

setProcedure

public void setProcedure(boolean isProcedure)

getOutputDefinition

public java.lang.String getOutputDefinition()

setOutputDefinition

public void setOutputDefinition(java.lang.String outputDefinition)


Copyright © 2009. All Rights Reserved.