@Override public <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> boolean process(PatchingArtifact<P, S> artifact, S state) { final Node old = current; current = new Node(old, artifact, state, old.context); try { return doProcess(artifact, state); } finally { current = old; } }
@Override public String next(PatchingValidationErrorHandler context) { int i = idx; if (i >= size) { throw new NoSuchElementException(); } idx = i + 1; final String patch = patches.get(i); final int nextIdx = i + 1; String nextPatch = null; if (nextIdx < size) { nextPatch = patches.get(nextIdx); } final PatchingArtifacts.PatchID patchID = new PatchingArtifacts.PatchID(patch, nextPatch); processor.processRoot(PatchingArtifacts.HISTORY_RECORD, patchID, context); return patch; } };
public <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> boolean doProcess(PatchingArtifact<P, S> artifact, S state) { final PatchingArtifactStateHandler<S> handler = getHandlerForArtifact(artifact); if (!state.isValid(getValidationContext())) { return false; } // Process each child artifact boolean valid = true; for (final PatchingArtifact<S, ? extends PatchingArtifact.ArtifactState> child : artifact.getArtifacts()) { if (!child.process(state, this)) { valid = false; } } if (valid && handler != null) { handler.handleValidatedState(state); } return valid; }
Collections.reverse(patches); final int size = patches.size(); final BasicArtifactProcessor processor = new BasicArtifactProcessor(identity, errorHandler, handlers); final PatchHistoryIterator iterator = new PatchHistoryIterator() { int idx = 0;
public <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> boolean doProcess(PatchingArtifact<P, S> artifact, S state) { final PatchingArtifactStateHandler<S> handler = getHandlerForArtifact(artifact); if (!state.isValid(getValidationContext())) { return false; } // Process each child artifact boolean valid = true; for (final PatchingArtifact<S, ? extends PatchingArtifact.ArtifactState> child : artifact.getArtifacts()) { if (!child.process(state, this)) { valid = false; } } if (valid && handler != null) { handler.handleValidatedState(state); } return valid; }
Collections.reverse(patches); final int size = patches.size(); final BasicArtifactProcessor processor = new BasicArtifactProcessor(identity, errorHandler, handlers); final PatchHistoryIterator iterator = new PatchHistoryIterator() { int idx = 0;
protected <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> boolean processRoot(PatchingArtifact<P, S> artifact, S state, PatchingValidationErrorHandler context) { assert current == null; current = new Node(null, artifact, state, context); try { return doProcess(artifact, state); } finally { // Swap identity for the next patch-id currentIdentity = next; current = null; } }
@Override public String next(PatchingValidationErrorHandler context) { int i = idx; if (i >= size) { throw new NoSuchElementException(); } idx = i + 1; final String patch = patches.get(i); final int nextIdx = i + 1; String nextPatch = null; if (nextIdx < size) { nextPatch = patches.get(nextIdx); } final PatchingArtifacts.PatchID patchID = new PatchingArtifacts.PatchID(patch, nextPatch); processor.processRoot(PatchingArtifacts.HISTORY_RECORD, patchID, context); return patch; } };
protected <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> boolean processRoot(PatchingArtifact<P, S> artifact, S state, PatchingValidationErrorHandler context) { assert current == null; current = new Node(null, artifact, state, context); try { return doProcess(artifact, state); } finally { // Swap identity for the next patch-id currentIdentity = next; current = null; } }
@Override public <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> boolean process(PatchingArtifact<P, S> artifact, S state) { final Node old = current; current = new Node(old, artifact, state, old.context); try { return doProcess(artifact, state); } finally { current = old; } }