public abstract class ExprNode extends Object implements Expr
CMP_EQUAL, CMP_GREATER, CMP_INDETERMINATE, CMP_LESS, CMP_UNEQUAL
Constructor and Description |
---|
ExprNode() |
Modifier and Type | Method and Description |
---|---|
abstract Expr |
applyNodeTransform(NodeTransform transform)
Rewrite, applying a node->node transformation
|
Var |
asVar()
Convert to a Var variable.
|
abstract Expr |
copySubstitute(Binding binding)
Deep copy with substitution
|
Expr |
deepCopy()
Deep copy
|
abstract boolean |
equals(Expr other,
boolean bySyntax)
General equality operation - consider this to be 'protected'
|
boolean |
equals(Object other) |
boolean |
equalsBySyntax(Expr other) |
abstract NodeValue |
eval(Binding binding,
FunctionEnv env)
Evaluate this expression against the binding
|
NodeValue |
getConstant()
NodeValue constant (returns null if not a constant)
|
Expr |
getExpr() |
ExprVar |
getExprVar()
Variable (or null)
|
ExprFunction |
getFunction()
Get the function (returns null if not a function)
|
Op |
getGraphPattern() |
String |
getVarName()
Variable name (returns null if not a variable)
|
Set<String> |
getVarNamesMentioned() |
Set<Var> |
getVarsMentioned()
Variables used by this expression - excludes variables scoped to (NOT)EXISTS
|
abstract int |
hashCode()
Expr are used in both syntax and algebra. |
boolean |
isConstant()
Answer whether this is a constant expression - false includes "don't know"
No constant folding so "false" from an expression that evaluates to a constant
|
boolean |
isExpr() |
boolean |
isFunction()
Answer wether this is a function.
|
boolean |
isGraphPattern() |
boolean |
isSatisfied(Binding binding,
FunctionEnv funcEnv)
Test whether a Constraint is satisfied, given a set of bindings
Includes error propagtion and Effective Boolean Value rules.
|
boolean |
isVariable()
Answer whether this is a variable (in which case getVarName and getNodeVar can be called)
|
String |
toString() |
void |
varNamesMentioned(Collection<String> acc) |
void |
varsMentioned(Collection<Var> acc)
Variables used by this expression - excludes variables scoped to (NOT)EXISTS
|
public boolean isSatisfied(Binding binding, FunctionEnv funcEnv)
Expr
isSatisfied
in interface Expr
binding
- The bindingsfuncEnv
- FunctionEnvpublic boolean isExpr()
public final Expr getExpr()
public abstract NodeValue eval(Binding binding, FunctionEnv env)
Expr
public Set<Var> getVarsMentioned()
Expr
getVarsMentioned
in interface Expr
public void varsMentioned(Collection<Var> acc)
Expr
varsMentioned
in interface Expr
public void varNamesMentioned(Collection<String> acc)
public abstract int hashCode()
Expr
Expr
are used in both syntax and algebra. There is no syntax
to algebra translation step because the parser uses operator precedence
to build the right evaluation structure directly.
The exceptions to this are the NOT EXISTS
and
EXISTS
expressions which involve a query pattern. As a
result there are different ways in syntax to produce the same algebra
form.
Two Expr
are considered equal if they are equal as algebra
expressions. hashCode
and equals
must implement
that.
There is also equalsBySyntax
. Because two different syntax
forms can yield the same algebra, but two different algebra forms
must be different syntax, equalsBySyntax
implies equals
(by alegbra).
Hence, different hashCode
=> not equalsBySyntax
.
public final boolean equals(Object other)
public final boolean equalsBySyntax(Expr other)
equalsBySyntax
in interface Expr
public abstract boolean equals(Expr other, boolean bySyntax)
Expr
public abstract Expr copySubstitute(Binding binding)
Expr
copySubstitute
in interface Expr
public abstract Expr applyNodeTransform(NodeTransform transform)
Expr
applyNodeTransform
in interface Expr
public boolean isVariable()
Expr
isVariable
in interface Expr
public String getVarName()
Expr
getVarName
in interface Expr
public ExprVar getExprVar()
Expr
getExprVar
in interface Expr
public boolean isConstant()
Expr
isConstant
in interface Expr
public NodeValue getConstant()
Expr
getConstant
in interface Expr
public boolean isFunction()
Expr
isFunction
in interface Expr
public ExprFunction getFunction()
Expr
getFunction
in interface Expr
public boolean isGraphPattern()
public Op getGraphPattern()
Licenced under the Apache License, Version 2.0