Example #1
0
  @Override
  public Vertex getThat(Graph traversalContext) {
    Edge incidentEdge;
    try {
      incidentEdge =
          localGraphDatabase.getEdgeObject(storingGraphDatabase.getEdgeIdAtIncidenceId(id));
    } catch (RemoteException e) {
      throw new RuntimeException(e);
    }
    if (!incidentEdge.isBinary()) {
      throw new UnsupportedOperationException("This method is only supported by binary Edges.");
    }
    Vertex vertex = null;

    if (getDirection() == Direction.VERTEX_TO_EDGE) {
      vertex = ((BinaryEdge) incidentEdge).getOmega();
    } else {
      vertex = ((BinaryEdge) incidentEdge).getAlpha();
    }
    if (getGraph().getTraversalContext() == null
        || getGraph().getTraversalContext().containsVertex(vertex)) {
      return vertex;
    } else {
      return null;
    }
  }
Example #2
0
 @Override
 public Edge getEdge() {
   try {
     return localGraphDatabase.getEdgeObject(storingGraphDatabase.getEdgeIdAtIncidenceId(id));
   } catch (RemoteException e) {
     throw new RuntimeException(e);
   }
 }
Example #3
0
 @Override
 public Iterable<Vertex> getThoseVertices(Graph traversalContext) {
   Edge edge;
   try {
     edge = localGraphDatabase.getEdgeObject(storingGraphDatabase.getEdgeIdAtIncidenceId(id));
   } catch (RemoteException e) {
     throw new RuntimeException(e);
   }
   assert getGraph().getTraversalContext() == null
       || getGraph().getTraversalContext().containsEdge(edge);
   return edge.getIncidentVertices(traversalContext, getDirection().getOppositeDirection());
 }
Example #4
0
 @Override
 public Incidence getPreviousIncidenceAtEdge(Graph traversalContext) {
   Incidence currentIncidence;
   try {
     currentIncidence =
         localGraphDatabase.getIncidenceObject(
             storingGraphDatabase.getPreviousIncidenceIdAtEdgeId(
                 storingGraphDatabase.getEdgeIdAtIncidenceId(id)));
   } catch (RemoteException e) {
     throw new RuntimeException(e);
   }
   while ((traversalContext != null)
       && (currentIncidence != null)
       && (!traversalContext.containsVertex(currentIncidence.getVertex()))) {
     currentIncidence = currentIncidence.getPreviousIncidenceAtEdge();
   }
   return currentIncidence;
 }
Example #5
0
 @Override
 public Vertex getThis(Graph traversalContext) {
   try {
     if (!localGraphDatabase
         .getEdgeObject(storingGraphDatabase.getEdgeIdAtIncidenceId(id))
         .isBinary()) {
       throw new UnsupportedOperationException("This method is only supported by binary Edges.");
     } else {
       Vertex vertex =
           localGraphDatabase.getVertexObject(storingGraphDatabase.getVertexIdAtIncidenceId(id));
       if (getGraph().getTraversalContext() == null
           || getGraph().getTraversalContext().containsVertex(vertex)) {
         return vertex;
       } else {
         return null;
       }
     }
   } catch (RemoteException e) {
     throw new RuntimeException(e);
   }
 }