de.fuberlin.wiwiss.d2rq.algebra
Class ColumnRenamer

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.algebra.ColumnRenamer
Direct Known Subclasses:
AliasMap, ColumnRenamerMap

public abstract class ColumnRenamer
extends Object

Something that can rename columns in various objects.

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
static ColumnRenamer NULL
          An optimized ColumnRenamer that leaves every column unchanged
 
Constructor Summary
ColumnRenamer()
           
 
Method Summary
abstract  AliasMap applyTo(AliasMap aliases)
           
abstract  Attribute applyTo(Attribute original)
           
 Expression applyTo(Expression original)
           
 Join applyTo(Join original)
           
 List<OrderSpec> applyTo(List<OrderSpec> orderSpecs)
           
 ProjectionSpec applyTo(ProjectionSpec original)
           
 Set<Join> applyToJoinSet(Set<Join> joins)
           
 Set<ProjectionSpec> applyToProjectionSet(Set<ProjectionSpec> projections)
           
protected static
<K,V> Map<V,K>
invertMap(Map<K,V> m)
          Returns a new map with keys and values exchanged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final ColumnRenamer NULL
An optimized ColumnRenamer that leaves every column unchanged

Constructor Detail

ColumnRenamer

public ColumnRenamer()
Method Detail

invertMap

protected static final <K,V> Map<V,K> invertMap(Map<K,V> m)
Returns a new map with keys and values exchanged. Lossy if multiple keys in the original have equal values.

Parameters:
m - The original map
Returns:
An inverse map

applyTo

public abstract Attribute applyTo(Attribute original)
Parameters:
original - A column
Returns:
The renamed version of that column, or the same column if the renamer does not apply to this argument

applyTo

public Join applyTo(Join original)
Parameters:
original - A join
Returns:
A join with all columns renamed according to this Renamer

applyTo

public Expression applyTo(Expression original)
Parameters:
original - An expression
Returns:
An expression with all columns renamed according to this Renamer

applyToJoinSet

public Set<Join> applyToJoinSet(Set<Join> joins)

applyTo

public ProjectionSpec applyTo(ProjectionSpec original)

applyToProjectionSet

public Set<ProjectionSpec> applyToProjectionSet(Set<ProjectionSpec> projections)

applyTo

public List<OrderSpec> applyTo(List<OrderSpec> orderSpecs)

applyTo

public abstract AliasMap applyTo(AliasMap aliases)