use of org.janusgraph.graphdb.internal.InternalElement in project janusgraph by JanusGraph.
the class PredicateCondition method evaluate.
@Override
public boolean evaluate(E element) {
RelationType type;
if (key instanceof String) {
type = ((InternalElement) element).tx().getRelationType((String) key);
if (type == null)
return satisfiesCondition(null);
} else {
type = (RelationType) key;
}
Preconditions.checkNotNull(type);
if (type.isPropertyKey()) {
Iterator<Object> iterator = ElementHelper.getValues(element, (PropertyKey) type).iterator();
if (iterator.hasNext()) {
while (iterator.hasNext()) {
if (satisfiesCondition(iterator.next()))
return true;
}
return false;
}
return satisfiesCondition(null);
} else {
assert ((InternalRelationType) type).multiplicity().isUnique(Direction.OUT);
return satisfiesCondition(element.value(type.name()));
}
}
Aggregations