public final boolean test(final Element element) { // it is OK to evaluate equality of ids via toString(), given that the test suite enforces the value of // id().toString() to be a first class representation of the identifier. a string test is only executed // if the predicate value is a String. this allows stuff like: g.V().has(id,lt(10)) to work properly if (this.key.equals(T.id.getAccessor())) return testingIdString ? testIdAsString(element) : testId(element); else if (this.key.equals(T.label.getAccessor())) return testLabel(element); else if (element instanceof VertexProperty && this.key.equals(T.value.getAccessor())) return testValue((VertexProperty) element); else if (element instanceof VertexProperty && this.key.equals(T.key.getAccessor())) return testKey((VertexProperty) element); else { if (element instanceof Vertex) { final Iterator<? extends Property> itty = element.properties(this.key); while (itty.hasNext()) { if (testValue(itty.next())) return true; } return false; } else { final Property property = element.property(this.key); return property.isPresent() && testValue(property); } } }
public final boolean test(final Element element) { // it is OK to evaluate equality of ids via toString(), given that the test suite enforces the value of // id().toString() to be a first class representation of the identifier. a string test is only executed // if the predicate value is a String. this allows stuff like: g.V().has(id,lt(10)) to work properly if (this.key.equals(T.id.getAccessor())) return testingIdString ? testIdAsString(element) : testId(element); else if (this.key.equals(T.label.getAccessor())) return testLabel(element); else if (element instanceof VertexProperty && this.key.equals(T.value.getAccessor())) return testValue((VertexProperty) element); else if (element instanceof VertexProperty && this.key.equals(T.key.getAccessor())) return testKey((VertexProperty) element); else { if (element instanceof Vertex) { final Iterator<? extends Property> itty = element.properties(this.key); while (itty.hasNext()) { if (testValue(itty.next())) return true; } return false; } else { final Property property = element.property(this.key); return property.isPresent() && testValue(property); } } }