|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.relation.rule.ArrayBindingSet
public class ArrayBindingSet
An IBindingSet backed by an dense array (no gaps). This
implementation is more efficient for fixed or small N (N LTE ~20). It simples
scans the array looking for the variable using references tests for equality.
Since the #of variables is generally known in advance this can be faster and
lighter than HashBindingSet for most applications.
| Field Summary | |
|---|---|
protected static boolean |
DEBUG
True iff the log level is DEBUG or less. |
protected static boolean |
INFO
True iff the log level is INFO or less. |
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
protected |
ArrayBindingSet(ArrayBindingSet bindingSet)
Copy constructor. |
|
ArrayBindingSet(int capacity)
Initialized with the given capacity. |
|
ArrayBindingSet(IVariable[] vars,
IConstant[] vals)
Initialized with the given bindings (assumes for efficiency that all elements of bound arrays are non- null and that no
variables are duplicated). |
| Method Summary | |
|---|---|
void |
clear(IVariable var)
Since the array is dense (no gaps), clear(IVariable) requires
that we copy down any remaining elements in the array by one position. |
void |
clearAll()
Clear all bindings. |
ArrayBindingSet |
clone()
Return a shallow copy of the binding set. |
boolean |
equals(IBindingSet o)
True iff the variables and their bound values are the same for the two binding sets. |
IConstant |
get(IVariable var)
Return the binding for the variable. |
boolean |
isBound(IVariable var)
Return true iff the variable is bound. |
Iterator<Map.Entry<IVariable,IConstant>> |
iterator()
Iterator does not support either removal or concurrent modification of the binding set. |
void |
set(IVariable var,
IConstant val)
Bind the variable to the value. |
int |
size()
The #of bound variables. |
String |
toString()
|
Iterator<IVariable> |
vars()
Visits the bound variables. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected static final boolean INFO
log level is INFO or less.
protected static final boolean DEBUG
log level is DEBUG or less.
| Constructor Detail |
|---|
protected ArrayBindingSet(ArrayBindingSet bindingSet)
public ArrayBindingSet(IVariable[] vars,
IConstant[] vals)
null and that no
variables are duplicated).
vars - The variables.vals - Their bound values.public ArrayBindingSet(int capacity)
capacity - The capacity.
IllegalArgumentException - if the capacity is negative.| Method Detail |
|---|
public Iterator<IVariable> vars()
IBindingSet
vars in interface IBindingSetpublic Iterator<Map.Entry<IVariable,IConstant>> iterator()
iterator in interface IBindingSetpublic int size()
IBindingSet
size in interface IBindingSetpublic void clearAll()
IBindingSet
clearAll in interface IBindingSetpublic void clear(IVariable var)
clear(IVariable) requires
that we copy down any remaining elements in the array by one position.
clear in interface IBindingSetvar - The variable.public IConstant get(IVariable var)
IBindingSet
get in interface IBindingSetvar - The variable.
null iff the
variable is not bound.public boolean isBound(IVariable var)
IBindingSettrue iff the variable is bound.
isBound in interface IBindingSetvar - The variable.
true if the variable is bound.
public void set(IVariable var,
IConstant val)
IBindingSet
set in interface IBindingSetvar - The variable.val - The value (MAY NOT be null).public String toString()
toString in class Objectpublic ArrayBindingSet clone()
IBindingSet
clone in interface IBindingSetclone in class Objectpublic boolean equals(IBindingSet o)
IBindingSet
equals in interface IBindingSeto - Another binding set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||