Package org.teiid.query.sql.lang
Class From
- java.lang.Object
-
- org.teiid.query.sql.lang.From
-
- All Implemented Interfaces:
Cloneable
,LanguageObject
public class From extends 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
).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Constructor Summary
Constructors Constructor Description From()
Constructs a default instance of this class.From(List<? extends FromClause> parameters)
Constructs an instance of this class from an ordered set of from clauses
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.void
addClause(FromClause clause)
Add a clause to the FROMvoid
addClauses(Collection<? extends FromClause> toAdd)
Add clauses to the FROMvoid
addGroup(GroupSymbol group)
Adds a new group to the list (it will be wrapped in a UnaryFromClause)void
addGroups(Collection<GroupSymbol> groups)
Adds a new collection of groups to the listObject
clone()
Return copy of this From clause.boolean
containsGroup(GroupSymbol group)
Checks if a group is in the Fromboolean
equals(Object obj)
Compare two Froms for equality.List<FromClause>
getClauses()
Get all the clauses in FROMList<GroupSymbol>
getGroups()
Returns an ordered list of the groups in all sub-clauses.int
hashCode()
Get hashcode for From.void
setClauses(List<FromClause> clauses)
Set all the clausesString
toString()
Returns a string representation of an instance of this class.
-
-
-
Constructor Detail
-
From
public From()
Constructs a default instance of this class.
-
From
public From(List<? extends FromClause> 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(Collection<? extends FromClause> toAdd)
Add clauses to the FROM- Parameters:
toAdd
- Collection ofFromClause
s
-
getClauses
public List<FromClause> getClauses()
Get all the clauses in FROM- Returns:
- List of
FromClause
-
setClauses
public void setClauses(List<FromClause> clauses)
Set all the clauses- Parameters:
clauses
- List ofFromClause
-
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(Collection<GroupSymbol> groups)
Adds a new collection of groups to the list- Parameters:
groups
- Collection ofGroupSymbol
-
getGroups
public List<GroupSymbol> 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 interfaceLanguageObject
- Parameters:
visitor
- Visitor being used
-
clone
public Object clone()
Return copy of this From clause.- Specified by:
clone
in interfaceLanguageObject
- Overrides:
clone
in classObject
- Returns:
- Deep clone of this object
-
equals
public boolean equals(Object obj)
Compare two Froms for equality. Order is not important in the from, so this is a set comparison.
-
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.
-
-