コード例 #1
0
 public static void setMemorySideEffects(
     final Traversal.Admin<?, ?> traversal, final Memory memory, final ProgramPhase phase) {
   final TraversalSideEffects sideEffects = traversal.getSideEffects();
   if (!(sideEffects instanceof MemoryTraversalSideEffects)) {
     traversal.setSideEffects(new MemoryTraversalSideEffects(sideEffects));
   }
   final MemoryTraversalSideEffects memoryTraversalSideEffects =
       ((MemoryTraversalSideEffects) traversal.getSideEffects());
   memoryTraversalSideEffects.memory = memory;
   memoryTraversalSideEffects.phase = phase;
 }
コード例 #2
0
 public static Set<MemoryComputeKey> getMemoryComputeKeys(final Traversal.Admin<?, ?> traversal) {
   final Set<MemoryComputeKey> keys = new HashSet<>();
   final TraversalSideEffects sideEffects =
       traversal.getSideEffects() instanceof MemoryTraversalSideEffects
           ? ((MemoryTraversalSideEffects) traversal.getSideEffects()).getSideEffects()
           : traversal.getSideEffects();
   sideEffects
       .keys()
       .stream()
       .forEach(
           key -> keys.add(MemoryComputeKey.of(key, sideEffects.getReducer(key), true, false)));
   return keys;
 }