@Override public boolean terminate(Memory memory) { return memory.getIteration() > 1; }
@Override public boolean doStage(final Stage stage) { return stage.equals(Stage.MAP); }
@Override public void removeRelation(InternalRelation e) { throw GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated(); }
public FulgoraMemory(final VertexProgram<?> vertexProgram, final Set<MapReduce> mapReducers) { this.currentMap = new ConcurrentHashMap<>(); this.previousMap = new ConcurrentHashMap<>(); if (null != vertexProgram) { for (final MemoryComputeKey key : vertexProgram.getMemoryComputeKeys()) { this.memoryKeys.put(key.getKey(), key); } } for (final MapReduce mapReduce : mapReducers) { this.memoryKeys.put(mapReduce.getMemoryKey(), MemoryComputeKey.of(mapReduce.getMemoryKey(), Operator.assign, false, false)); } }
@Override public <R> R get(final String key) throws IllegalArgumentException { final R r = (R) this.previousMap.get(key); if (null == r) throw Memory.Exceptions.memoryDoesNotExist(key); else if (this.inExecute && !this.memoryKeys.get(key).isBroadcast()) throw Memory.Exceptions.memoryDoesNotExist(key); else return r; }
@Override public <R> R get(final String key) throws IllegalArgumentException { final R r = (R) this.previousMap.get(key); if (null == r) throw Memory.Exceptions.memoryDoesNotExist(key); else return r; }
@Override public GraphComputer edges(final Traversal<Vertex, Edge> edgeFilter) { this.graphFilter.setEdgeFilter(edgeFilter); return this; }
@Override public GraphComputer vertices(final Traversal<Vertex, Vertex> vertexFilter) { this.graphFilter.setVertexFilter(vertexFilter); return this; }
@Override public TitanEdge addEdge(String s, Vertex vertex, Object... keyValues) { throw GraphComputer.Exceptions.adjacentVertexEdgesAndVerticesCanNotBeReadOrUpdated(); }
@Override public final void accessEdges() { throw GraphComputer.Exceptions.incidentAndAdjacentElementsCanNotBeAccessedInMapReduce(); }
@Override public void accessSetProperty() { throw GraphComputer.Exceptions.vertexPropertiesCanNotBeUpdatedInMapReduce(); }
@Override public boolean terminate(Memory memory) { return memory.getIteration() >= maxIterations; }
@Override public final void accessProperties() { throw GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated(); }
@Override public boolean doStage(final Stage stage) { return stage.equals(Stage.MAP); }
@Override public boolean terminate(Memory memory) { return memory.getIteration()>=length; }
@Override public boolean addRelation(InternalRelation e) { throw GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated(); }
@Override public boolean terminate(final Memory memory) { return memory.getIteration() >= this.maxDepth; }
@Override public final void accessEdges() { throw GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated(); }
@Override public boolean terminate(Memory memory) { return memory.getIteration() > 1; }
@Override public void accessSetProperty() { throw GraphComputer.Exceptions.adjacentVertexPropertiesCanNotBeReadOrUpdated(); }