E
- The generic type of the elements that will be tested by the
filter.public class SameVariableConstraint<E> extends Object implements IFilterTest, Externalizable
IAccessPath
. The filter is required IFF a IVariable
appears
in more than one position for the IPredicate
associated with the
IAccessPath
. For example, in spo(?g, p1, o1, ?g)
, the
variable g shows up at both index ZERO (0) and index THREE (3).
An instance of the filter is created by passing in an IPredicate
. The
filter creates an array of variables which appear more than once and the
index at which those variables appear in the predicate. The filter then does
the minimum amount of work and just compares the values found in the
different slots in which each variable appears for only those variables which
appear more than once in the IPredicate
.
Modifier and Type | Field and Description |
---|---|
protected int[] |
indices
An array containing one or more records, each of which has the form
|
Constructor and Description |
---|
SameVariableConstraint()
De-serialization constructor.
|
SameVariableConstraint(IPredicate<E> p,
int[] indices) |
Modifier and Type | Method and Description |
---|---|
int[] |
getIndices() |
boolean |
isValid(Object obj)
True iff the argument is matched by the filter.
|
static <E> SameVariableConstraint<E> |
newInstance(IPredicate<E> p)
The filter is only created and populated for variables which appear more
than once in the predicate.
|
void |
readExternal(ObjectInput in) |
String |
toString() |
void |
writeExternal(ObjectOutput out) |
protected int[] indices
[n,index[0], index[1], ... index[n-1]], where n is the number of occurrences of some variable and index[i], for i in
[0,n-1]
, gives each index
in the predicate at which that variable appears.
For example, given the predicate
spo(?g,p1,o1,?g)the array would be coded as one record
[2, 0, 3]Given the predicate
foo(?g,?h,?h,?g,4,?h)the array would be coded as two records
[[2, 0, 3], [3, 1, 2, 5]]where the records are indicated by the nested square brackets.
public SameVariableConstraint()
public SameVariableConstraint(IPredicate<E> p, int[] indices)
public boolean isValid(Object obj)
IFilterTest
isValid
in interface IFilterTest
public int[] getIndices()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public static <E> SameVariableConstraint<E> newInstance(IPredicate<E> p)
E
- The generic type of the elements to be tested by the filter.p
- The predicate.null
iff no variables appear more
than once in the IPredicate
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.