de.fuberlin.wiwiss.d2rq.expr
Class Constant

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.expr.Expression
      extended by de.fuberlin.wiwiss.d2rq.expr.Constant
Direct Known Subclasses:
ConstantEx

public class Constant
extends Expression

A constant-valued expression. This class currently doesn't track its type (Is the constant a number or string, for example?). Since we need to know the type when writing the constant to SQL, we keep a reference to an attribute around. The constant is assumed to have the same type as that attribute. This is an ugly hack. TODO Should have a DataType instead of the silly column reference

Author:
Richard Cyganiak (richard@cyganiak.de)

Field Summary
 
Fields inherited from class de.fuberlin.wiwiss.d2rq.expr.Expression
FALSE, TRUE
 
Constructor Summary
Constant(String value)
           
Constant(String value, Attribute attributeForTrackingType)
           
 
Method Summary
 Set<Attribute> attributes()
           
 boolean equals(Object other)
           
 int hashCode()
           
 boolean isFalse()
           
 boolean isTrue()
           
 Expression renameAttributes(ColumnRenamer columnRenamer)
           
 String toSQL(ConnectedDB database, AliasMap aliases)
           
 String toString()
           
 String value()
           
 
Methods inherited from class de.fuberlin.wiwiss.d2rq.expr.Expression
and, or
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Constant

public Constant(String value)

Constant

public Constant(String value,
                Attribute attributeForTrackingType)
Method Detail

value

public String value()

attributes

public Set<Attribute> attributes()
Specified by:
attributes in class Expression

isFalse

public boolean isFalse()
Specified by:
isFalse in class Expression

isTrue

public boolean isTrue()
Specified by:
isTrue in class Expression

renameAttributes

public Expression renameAttributes(ColumnRenamer columnRenamer)
Specified by:
renameAttributes in class Expression

toSQL

public String toSQL(ConnectedDB database,
                    AliasMap aliases)
Specified by:
toSQL in class Expression

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object