public final class Constant<E> extends ImmutableBOp implements IConstant<E>
Modifier and Type | Class and Description |
---|---|
static interface |
Constant.Annotations |
DEFAULT_INITIAL_CAPACITY
Constructor and Description |
---|
Constant(Constant<E> op)
Constructor required for
com.bigdata.bop.BOpUtility#deepCopy(FilterNode) . |
Constant(E value)
Create a constant for the value.
|
Constant(IVariable<E> var,
E value)
Create a constant which models a variable bound to that constant.
|
Modifier and Type | Method and Description |
---|---|
Constant<E> |
clone()
Clone is overridden to reduce heap churn.
|
boolean |
equals(IVariableOrConstant<E> o)
Return
true if this is the same variable or if both values
are Constant whose values are the same. |
boolean |
equals(Object o)
true if all arguments and annotations are the same. |
static Constant |
errorValue()
Always returns the same constant representing the error value as in
https://www.w3.org/TR/sparql11-query/#aggregateAlgebra .
|
E |
get()
Return the bound value.
|
E |
get(IBindingSet bindingSet)
Return the as bound value of the variable, constant, or
expression.
|
String |
getName()
Return the name of a variable.
|
IVariable<E> |
getVar() |
int |
hashCode()
The hash code is based on the hash of the operands (cached).
|
boolean |
isConstant()
Return
true iff this is a constant. |
boolean |
isVar()
Return
true iff this is a variable. |
String |
toString()
Return a non-recursive representation of the arguments and annotations
for this
BOp . |
_clearProperty, _setProperty
__replaceArg, _set, annotations, annotationsCopy, annotationsEqual, annotationsRef, argIterator, args, argsCopy, arity, clearAnnotations, clearProperty, deepCopy, deepCopy, get, getProperty, setArg, setProperty, setUnboundProperty, toArray, toArray
annotationsEqual, annotationsToString, annotationsToString, annotationValueToString, checkArgs, getEvaluationContext, getId, getProperty, getRequiredProperty, indent, isController, mutation, shortenName, toShortString, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
toString
annotations, argIterator, args, arity, get, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortString
getProperty
public Constant(Constant<E> op)
com.bigdata.bop.BOpUtility#deepCopy(FilterNode)
.op
- != Constant.ERROR_VALUEpublic Constant(IVariable<E> var, E value)
Constant
with the IVariable
and handling this case when
solutions are joined the resulting solutions will have the variable with
its constant bound value.
Note: The Var
class in bigdata provides a guarantee of reference
testing for equality, which is why we can not simply attach the constant
to the variable and have the variable report its bound value. *
Note: A very similar effect may be achieved by simply binding the
variable on the IBindingSet
to the constant. However, there are
some (few) cases where we can not do that because the binding must be
applied for all solutions and we lack access to the input solutions.
See
BOpContext.bind(IPredicate, IConstraint[], Object, IBindingSet)
,
which takes care of propagating the binding onto the variable for
solutions which join.
var
- The variable.value
- The bound value.public Constant(E value)
value
- The value (may not be null
).public final boolean isVar()
IVariableOrConstant
true
iff this is a variable.isVar
in interface IVariableOrConstant<E>
public final boolean isConstant()
IVariableOrConstant
true
iff this is a constant.isConstant
in interface IVariableOrConstant<E>
public static Constant errorValue()
public final Constant<E> clone()
clone
in interface BOp
clone
in class CoreBaseBOp
public String toString()
CoreBaseBOp
BOp
.toString
in interface BOp
toString
in class CoreBaseBOp
public final boolean equals(IVariableOrConstant<E> o)
IVariableOrConstant
true
if this is the same variable or if both values
are Constant
whose values are the same.equals
in interface IVariableOrConstant<E>
public final boolean equals(Object o)
CoreBaseBOp
true
if all arguments and annotations are the same.equals
in class CoreBaseBOp
public final int hashCode()
CoreBaseBOp
hashCode
in interface IConstant<E>
hashCode
in class CoreBaseBOp
public final E get()
IVariableOrConstant
get
in interface IVariableOrConstant<E>
public final E get(IBindingSet bindingSet)
IValueExpression
IConstant
is the
contant's value. The as bound value of an IVariable
is the
bound value in the given IBindingSet
-or- null
if
the variable is not bound in the IBindingSet
.get
in interface IValueExpression<E>
bindingSet
- The binding set.public final String getName()
IVariableOrConstant
getName
in interface IVariableOrConstant<E>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.