|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.relation.rule.Var<E>
public final class Var<E>
A variable.
Note: This implementation provides reference testing for equality. The rest of the package assumes that it can use reference testing for equality when comparing variables.
Var is
rule-local (or rule execution thread local) then it could define
set(Object) and get():Object to access its binding. A rule that was
specialized would then flag bound variables as immutable., Variable canonicalization could be limited in scope to a rule or its
derived rules (via specialization or for truth maintenance). This would
make it easier to place constraints directly on the variable so that it
can limit the types of binding that it will accept. Constraints on
IPredicates limit the matched tuples. Constraints on rules
limit the binding patterns across the rule. (In fact, variables can be
"named" by their index into the binding set for most purposes.)| Method Summary | |
|---|---|
int |
compareTo(IVariable<E> o)
Orders variables alphabetically. |
boolean |
equals(IVariableOrConstant o)
Return true if this is the same variable or if both values
are Constant whose values are the same. |
E |
get()
Return the bound value. |
String |
getName()
Return the name of a variable. |
int |
hashCode()
The hash code of the name of the variable as reported by IVariableOrConstant.getName() |
boolean |
isConstant()
Return true iff this is a constant. |
boolean |
isVar()
Return true iff this is a variable. |
String |
toString()
|
static Var |
var(String name)
Singleton factory for Vars. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public final boolean isVar()
IVariableOrConstanttrue iff this is a variable.
isVar in interface IVariableOrConstant<E>public final boolean isConstant()
IVariableOrConstanttrue iff this is a constant.
isConstant in interface IVariableOrConstant<E>public final boolean equals(IVariableOrConstant o)
IVariableOrConstanttrue if this is the same variable or if both values
are Constant whose values are the same.
equals in interface IVariableOrConstant<E>public final int hashCode()
IVariableIVariableOrConstant.getName()
hashCode in interface IVariable<E>hashCode in class Objectpublic String toString()
toString in class Objectpublic E get()
IVariableOrConstant
get in interface IVariableOrConstant<E>public String getName()
IVariableOrConstant
getName in interface IVariableOrConstant<E>public static Var var(String name)
Vars.
Note: While only a single instance of a variable object will be created for any given variable name, the "scope" of the variable is always constrained by the rule within which it is used. The purpose of the singleton factory is to let us test for the same variable using "==" (reference testing) and also to have a shorthand for variable creation.
name - The variable name.
public int compareTo(IVariable<E> o)
compareTo in interface Comparable<IVariable<E>>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||