public final class Var<E> extends ImmutableBOp implements IVariable<E>, Comparable<IVariable<E>>
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.
BOp.AnnotationsDEFAULT_INITIAL_CAPACITY| Modifier and Type | Method and Description |
|---|---|
Var<E> |
clone()
Clone is overridden to prevent variables from becoming aliased (this is
part of the canonicalizing mapping).
|
int |
compareTo(IVariable<E> o)
Orders variables alphabetically.
|
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. |
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.
|
int |
hashCode()
The hash code is based on the hash of the operands (cached).
|
boolean |
isAnonymous()
Return
true iff this is an anonymous variable. |
boolean |
isConstant()
Return
true iff this is a constant. |
boolean |
isVar()
Return
true iff this is a variable. |
boolean |
isWildcard()
Return
true iff this is the special variable * |
void |
setAnonymous(boolean anonymous) |
String |
toString()
Return a non-recursive representation of the arguments and annotations
for this
BOp. |
static Var<?> |
var()
Generate an anonymous random variable.
|
static Var |
var(String name)
Singleton factory for
Vars. |
_clearProperty, _setProperty__replaceArg, _set, annotations, annotationsCopy, annotationsEqual, annotationsRef, argIterator, args, argsCopy, arity, clearAnnotations, clearProperty, deepCopy, deepCopy, get, getProperty, setArg, setProperty, setUnboundProperty, toArray, toArrayannotationsEqual, annotationsToString, annotationsToString, annotationValueToString, checkArgs, getEvaluationContext, getId, getProperty, getRequiredProperty, indent, isController, mutation, shortenName, toShortString, toStringfinalize, getClass, notify, notifyAll, wait, wait, waittoStringannotations, argIterator, args, arity, get, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortStringgetPropertypublic void setAnonymous(boolean anonymous)
public boolean isAnonymous()
IVariabletrue iff this is an anonymous variable.isAnonymous in interface IVariable<E>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 Var<E> clone()
clone in interface BOpclone in class CoreBaseBOppublic final boolean equals(IVariableOrConstant<E> 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 boolean equals(Object o)
CoreBaseBOptrue if all arguments and annotations are the same.equals in class CoreBaseBOppublic final int hashCode()
CoreBaseBOphashCode in interface IVariable<E>hashCode in class CoreBaseBOppublic String toString()
CoreBaseBOpBOp.toString in interface BOptoString in class CoreBaseBOppublic boolean isWildcard()
IVariabletrue iff this is the special variable *isWildcard in interface IVariable<E>public E get()
IVariableOrConstantget in interface IVariableOrConstant<E>public E get(IBindingSet bindingSet)
IValueExpressionIConstant 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 String getName()
IVariableOrConstantgetName in interface IVariableOrConstant<E>public static Var<?> var()
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.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.