com.metamatrix.query.sql.lang
Class From

java.lang.Object
  extended by com.metamatrix.query.sql.lang.From
All Implemented Interfaces:
LanguageObject, java.io.Serializable, java.lang.Cloneable

public class From
extends java.lang.Object
implements LanguageObject

Represents a FROM clause in a SELECT query. The from clause holds a set of FROM subclauses. Each FROM subclause can be either a single group (UnaryFromClause) or a join predicate (JoinPredicate).

See Also:
Serialized Form

Constructor Summary
From()
          Constructs a default instance of this class.
From(java.util.List parameters)
          Constructs an instance of this class from an ordered set of from clauses
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 void addClause(FromClause clause)
          Add a clause to the FROM
 void addClauses(java.util.Collection clauses)
          Add clauses to the FROM
 void addGroup(GroupSymbol group)
          Adds a new group to the list (it will be wrapped in a UnaryFromClause)
 void addGroups(java.util.Collection groups)
          Adds a new collection of groups to the list
 java.lang.Object clone()
          Return copy of this From clause.
 boolean containsGroup(GroupSymbol group)
          Checks if a group is in the From
 boolean equals(java.lang.Object obj)
          Compare two Froms for equality.
 java.util.List getClauses()
          Get all the clauses in FROM
 java.util.List getGroups()
          Returns an ordered list of the groups in all sub-clauses.
 int hashCode()
          Get hashcode for From.
 void setClauses(java.util.List clauses)
          Set all the clauses
 java.lang.String toString()
          Returns a string representation of an instance of this class.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

From

public From()
Constructs a default instance of this class.


From

public From(java.util.List parameters)
Constructs an instance of this class from an ordered set of from clauses

Parameters:
parameters - The ordered list of from clauses
Method Detail

addClause

public void addClause(FromClause clause)
Add a clause to the FROM

Parameters:
clause - Add a clause to the FROM

addClauses

public void addClauses(java.util.Collection clauses)
Add clauses to the FROM

Parameters:
clauses - Collection of FromClauses

getClauses

public java.util.List getClauses()
Get all the clauses in FROM

Returns:
List of FromClause

setClauses

public void setClauses(java.util.List clauses)
Set all the clauses

Parameters:
clauses - List of FromClause

addGroup

public void addGroup(GroupSymbol group)
Adds a new group to the list (it will be wrapped in a UnaryFromClause)

Parameters:
group - Group to add

addGroups

public void addGroups(java.util.Collection groups)
Adds a new collection of groups to the list

Parameters:
groups - Collection of GroupSymbol

getGroups

public java.util.List getGroups()
Returns an ordered list of the groups in all sub-clauses.

Returns:
List of GroupSymbol

containsGroup

public boolean containsGroup(GroupSymbol group)
Checks if a group is in the From

Parameters:
group - Group to check for
Returns:
True if the From contains the group

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

clone

public java.lang.Object clone()
Return copy of this From clause.

Specified by:
clone in interface LanguageObject
Overrides:
clone in class java.lang.Object
Returns:
Deep clone of this object

equals

public boolean equals(java.lang.Object obj)
Compare two Froms for equality. Order is not important in the from, so this is a set comparison.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Get hashcode for From. WARNING: The hash code relies on the variables in the select, so changing the variables will change the hash code, causing a select to be lost in a hash structure. Do not hash a From if you plan to change it.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a string representation of an instance of this class.

Overrides:
toString in class java.lang.Object
Returns:
String representation of object


Copyright © 2009. All Rights Reserved.