GraphFilter implements Cloneable, Serializable { public void setVertexFilter(final Traversal<Vertex, Vertex> vertexFilter) { if (!TraversalHelper.isLocalProperties(vertexFilter.asAdmin())) throw GraphComputer.Exceptions.vertexFilterAccessesIncidentEdges(vertexFilter); this.vertexFilter = vertexFilter.asAdmin().clone(); } GraphFilter();  GraphFilter(final Computer computer); void setVertexFilter(final Traversal<Vertex, Vertex> vertexFilter); void setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter); boolean legalVertex(final Vertex vertex); Iterator<Edge> legalEdges(final Vertex vertex); final Traversal.Admin<Vertex, Vertex> getVertexFilter(); final Traversal.Admin<Vertex, Edge> getEdgeFilter(); boolean hasFilter(); boolean hasEdgeFilter(); boolean hasVertexFilter(); Set<String> getLegallyPositiveEdgeLabels(final Direction direction); Legal checkEdgeLegality(final Direction direction, final String label); Legal checkEdgeLegality(final Direction direction); @Override int hashCode(); @Override boolean equals(final Object object); @Override GraphFilter clone(); @Override String toString();  }
@Test public void shouldOnlyAllowVertexFilterToTraverseVertex() { GraphFilter graphFilter = new GraphFilter(); graphFilter.setVertexFilter(__.hasLabel("person")); try { graphFilter.setVertexFilter(__.<Vertex>as("a").outE().<Vertex>select("a")); fail("Should not allow traversals to the incident edges"); } catch (final IllegalArgumentException e) { assertEquals(e.getMessage(), GraphComputer.Exceptions.vertexFilterAccessesIncidentEdges(__.<Vertex>as("a").outE().<Vertex>select("a")).getMessage()); } }