test_class.file: gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilterTest.java
test_class.identifier: GraphFilterTest
test_case.body: @Test
      public void shouldOnlyAllowEdgeFilterToTraverseLocalStarGraph() {
          GraphFilter graphFilter = new GraphFilter();
          graphFilter.setEdgeFilter(__.outE());
          try {
              graphFilter.setEdgeFilter(__.<Vertex>outE().inV().outE());
              fail("Should not allow traversals past the star graph");
          } catch (final IllegalArgumentException e) {
              assertEquals(e.getMessage(), GraphComputer.Exceptions.edgeFilterAccessesAdjacentVertices(__.<Vertex>outE().inV().outE()).getMessage());
          }
      }
test_case.class_method_signature: GraphFilterTest.shouldOnlyAllowEdgeFilterToTraverseLocalStarGraph()
test_case.full_signature: @Test public void shouldOnlyAllowEdgeFilterToTraverseLocalStarGraph()
test_case.identifier: shouldOnlyAllowEdgeFilterToTraverseLocalStarGraph
test_case.invocations: setEdgeFilter outE setEdgeFilter outE inV outE fail assertEquals getMessage getMessage edgeFilterAccessesAdjacentVertices outE inV outE
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldOnlyAllowEdgeFilterToTraverseLocalStarGraph()
focal_class.declarator: vertexFilter = null
focal_class.modifier: private
focal_class.original_string: private Traversal.Admin<Vertex, Vertex> vertexFilter = null;
focal_class.type: Traversal.Admin<Vertex, Vertex>
focal_class.var_name: vertexFilter
focal_class.declarator: edgeFilter = null
focal_class.modifier: private
focal_class.original_string: private Traversal.Admin<Vertex, Edge> edgeFilter = null;
focal_class.type: Traversal.Admin<Vertex, Edge>
focal_class.var_name: edgeFilter
focal_class.declarator: edgeLegality = new HashMap<>()
focal_class.modifier: private
focal_class.original_string: private Map<Direction, Map<String, Legal>> edgeLegality = new HashMap<>();
focal_class.type: Map<Direction, Map<String, Legal>>
focal_class.var_name: edgeLegality
focal_class.declarator: allowNoEdges = false
focal_class.modifier: private
focal_class.original_string: private boolean allowNoEdges = false;
focal_class.type: boolean
focal_class.var_name: allowNoEdges
focal_class.file: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
focal_class.identifier: GraphFilter
focal_class.interfaces: implements Cloneable, Serializable
focal_class.class_method_signature: GraphFilter.GraphFilter()
focal_class.full_signature: public  GraphFilter()
focal_class.identifier: GraphFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  GraphFilter()
focal_class.class_method_signature: GraphFilter.GraphFilter(final Computer computer)
focal_class.full_signature: public  GraphFilter(final Computer computer)
focal_class.identifier: GraphFilter
focal_class.modifiers: public
focal_class.parameters: (final Computer computer)
focal_class.signature:  GraphFilter(final Computer computer)
focal_class.class_method_signature: GraphFilter.setVertexFilter(final Traversal<Vertex, Vertex> vertexFilter)
focal_class.full_signature: public void setVertexFilter(final Traversal<Vertex, Vertex> vertexFilter)
focal_class.identifier: setVertexFilter
focal_class.modifiers: public
focal_class.parameters: (final Traversal<Vertex, Vertex> vertexFilter)
focal_class.return: void
focal_class.signature: void setVertexFilter(final Traversal<Vertex, Vertex> vertexFilter)
focal_class.class_method_signature: GraphFilter.setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter)
focal_class.full_signature: public void setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter)
focal_class.identifier: setEdgeFilter
focal_class.modifiers: public
focal_class.parameters: (final Traversal<Vertex, Edge> edgeFilter)
focal_class.return: void
focal_class.signature: void setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter)
focal_class.class_method_signature: GraphFilter.legalVertex(final Vertex vertex)
focal_class.full_signature: public boolean legalVertex(final Vertex vertex)
focal_class.identifier: legalVertex
focal_class.modifiers: public
focal_class.parameters: (final Vertex vertex)
focal_class.return: boolean
focal_class.signature: boolean legalVertex(final Vertex vertex)
focal_class.class_method_signature: GraphFilter.legalEdges(final Vertex vertex)
focal_class.full_signature: public Iterator<Edge> legalEdges(final Vertex vertex)
focal_class.identifier: legalEdges
focal_class.modifiers: public
focal_class.parameters: (final Vertex vertex)
focal_class.return: Iterator<Edge>
focal_class.signature: Iterator<Edge> legalEdges(final Vertex vertex)
focal_class.class_method_signature: GraphFilter.getVertexFilter()
focal_class.full_signature: public final Traversal.Admin<Vertex, Vertex> getVertexFilter()
focal_class.identifier: getVertexFilter
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: Traversal.Admin<Vertex, Vertex>
focal_class.signature: Traversal.Admin<Vertex, Vertex> getVertexFilter()
focal_class.class_method_signature: GraphFilter.getEdgeFilter()
focal_class.full_signature: public final Traversal.Admin<Vertex, Edge> getEdgeFilter()
focal_class.identifier: getEdgeFilter
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: Traversal.Admin<Vertex, Edge>
focal_class.signature: Traversal.Admin<Vertex, Edge> getEdgeFilter()
focal_class.class_method_signature: GraphFilter.hasFilter()
focal_class.full_signature: public boolean hasFilter()
focal_class.identifier: hasFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean hasFilter()
focal_class.class_method_signature: GraphFilter.hasEdgeFilter()
focal_class.full_signature: public boolean hasEdgeFilter()
focal_class.identifier: hasEdgeFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean hasEdgeFilter()
focal_class.class_method_signature: GraphFilter.hasVertexFilter()
focal_class.full_signature: public boolean hasVertexFilter()
focal_class.identifier: hasVertexFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean hasVertexFilter()
focal_class.class_method_signature: GraphFilter.getLegallyPositiveEdgeLabels(final Direction direction)
focal_class.full_signature: public Set<String> getLegallyPositiveEdgeLabels(final Direction direction)
focal_class.identifier: getLegallyPositiveEdgeLabels
focal_class.modifiers: public
focal_class.parameters: (final Direction direction)
focal_class.return: Set<String>
focal_class.signature: Set<String> getLegallyPositiveEdgeLabels(final Direction direction)
focal_class.class_method_signature: GraphFilter.checkEdgeLegality(final Direction direction, final String label)
focal_class.full_signature: public Legal checkEdgeLegality(final Direction direction, final String label)
focal_class.identifier: checkEdgeLegality
focal_class.modifiers: public
focal_class.parameters: (final Direction direction, final String label)
focal_class.return: Legal
focal_class.signature: Legal checkEdgeLegality(final Direction direction, final String label)
focal_class.class_method_signature: GraphFilter.checkEdgeLegality(final Direction direction)
focal_class.full_signature: public Legal checkEdgeLegality(final Direction direction)
focal_class.identifier: checkEdgeLegality
focal_class.modifiers: public
focal_class.parameters: (final Direction direction)
focal_class.return: Legal
focal_class.signature: Legal checkEdgeLegality(final Direction direction)
focal_class.class_method_signature: GraphFilter.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_class.class_method_signature: GraphFilter.equals(final Object object)
focal_class.full_signature: @Override public boolean equals(final Object object)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (final Object object)
focal_class.return: boolean
focal_class.signature: boolean equals(final Object object)
focal_class.class_method_signature: GraphFilter.clone()
focal_class.full_signature: @Override public GraphFilter clone()
focal_class.identifier: clone
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: GraphFilter
focal_class.signature: GraphFilter clone()
focal_class.class_method_signature: GraphFilter.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: public void setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter) {
          if (!TraversalHelper.isLocalStarGraph(edgeFilter.asAdmin()))
              throw GraphComputer.Exceptions.edgeFilterAccessesAdjacentVertices(edgeFilter);
          this.edgeFilter = edgeFilter.asAdmin().clone();
          ////
          this.edgeLegality = new HashMap<>();
          this.edgeLegality.put(Direction.OUT, new HashMap<>());
          this.edgeLegality.put(Direction.IN, new HashMap<>());
          this.edgeLegality.put(Direction.BOTH, new HashMap<>());
          if (this.edgeFilter.getEndStep() instanceof RangeGlobalStep && 0 == ((RangeGlobalStep) this.edgeFilter.getEndStep()).getHighRange())
              this.allowNoEdges = true;
          ////
          if (this.edgeFilter.getStartStep() instanceof VertexStep) {
              final VertexStep step = (VertexStep) this.edgeFilter.getStartStep();
              final Map<String, Legal> map = this.edgeLegality.get(step.getDirection());
              if (step.returnsEdge()) {
                  if (step.getEdgeLabels().length == 0)
                      map.put(null, 1 == this.edgeFilter.getSteps().size() ? Legal.YES : Legal.MAYBE);
                  else {
                      for (final String label : step.getEdgeLabels()) {
                          map.put(label, 1 == this.edgeFilter.getSteps().size() ? Legal.YES : Legal.MAYBE);
                      }
                  }
              }
          } else if (this.edgeFilter.getStartStep() instanceof UnionStep) {
              final UnionStep<?, ?> step = (UnionStep) this.edgeFilter.getStartStep();
              for (final Traversal.Admin<?, ?> union : step.getGlobalChildren()) {
                  if (union.getStartStep() instanceof VertexStep) {
                      final VertexStep vertexStep = (VertexStep) union.getStartStep();
                      final Map<String, Legal> map = this.edgeLegality.get(vertexStep.getDirection());
                      if (vertexStep.returnsEdge()) {
                          if (vertexStep.getEdgeLabels().length == 0)
                              map.put(null, 2 == union.getSteps().size() ? Legal.YES : Legal.MAYBE);
                          else {
                              for (final String label : vertexStep.getEdgeLabels()) {
                                  map.put(label, 2 == union.getSteps().size() ? Legal.YES : Legal.MAYBE);
                              }
                          }
  
                      }
                  }
              }
          }
          final Map<String, Legal> outMap = this.edgeLegality.get(Direction.OUT);
          final Map<String, Legal> inMap = this.edgeLegality.get(Direction.IN);
          final Map<String, Legal> bothMap = this.edgeLegality.get(Direction.BOTH);
          for (final Map.Entry<String, Legal> entry : bothMap.entrySet()) {
              final Legal legal = inMap.get(entry.getKey());
              if (null == legal || legal.compareTo(entry.getValue()) > 0)
                  inMap.put(entry.getKey(), entry.getValue());
          }
          for (final Map.Entry<String, Legal> entry : bothMap.entrySet()) {
              final Legal legal = outMap.get(entry.getKey());
              if (null == legal || legal.compareTo(entry.getValue()) > 0)
                  outMap.put(entry.getKey(), entry.getValue());
          }
          for (final Map.Entry<String, Legal> entry : outMap.entrySet()) {
              final Legal legal = inMap.get(entry.getKey());
              if (null != legal)
                  bothMap.put(entry.getKey(), legal.compareTo(entry.getValue()) > 0 ? legal : entry.getValue());
          }
          if (outMap.isEmpty() && inMap.isEmpty() && bothMap.isEmpty()) { // the edge filter could not be reasoned on
              outMap.put(null, Legal.MAYBE);
              inMap.put(null, Legal.MAYBE);
              bothMap.put(null, Legal.MAYBE);
          }
      }
focal_method.class_method_signature: GraphFilter.setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter)
focal_method.full_signature: public void setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter)
focal_method.identifier: setEdgeFilter
focal_method.invocations: isLocalStarGraph asAdmin edgeFilterAccessesAdjacentVertices clone asAdmin put put put getEndStep getHighRange getEndStep getStartStep getStartStep get getDirection returnsEdge getEdgeLabels put size getSteps getEdgeLabels put size getSteps getStartStep getStartStep getGlobalChildren getStartStep getStartStep get getDirection returnsEdge getEdgeLabels put size getSteps getEdgeLabels put size getSteps get get get entrySet get getKey compareTo getValue put getKey getValue entrySet get getKey compareTo getValue put getKey getValue entrySet get getKey put getKey compareTo getValue getValue isEmpty isEmpty isEmpty put put put
focal_method.modifiers: public
focal_method.parameters: (final Traversal<Vertex, Edge> edgeFilter)
focal_method.return: void
focal_method.signature: void setEdgeFilter(final Traversal<Vertex, Edge> edgeFilter)