/** * Returns whether this stack has this call (left) * * @param call * the call to check * @return true if the call is present, false otherwise */ public boolean contains(final Call call) { for (final ListIterator<Call> i = iterator(); i.hasNext();) { final Call current = i.next(); if (current == call) { return true; } } return false; }
/** * Removes the given call. Does nothing if the call is not present. * * @param call * the call to remove * @return this for convenience */ public CallStack remove(final Call call) { for (final ListIterator<Call> i = iterator(); i.hasNext();) { final Call current = i.next(); if (current == call) { i.remove(); } } return this; }
/** * Creates a stack from another stack (starting at the next of the given * callstack) This does a deep copy of the stack. */ public CallStack(final CallStack stackToCopy) { name = stackToCopy.name; for (final Iterator<Call> i = stackToCopy.iterator(); i.hasNext();) { final Call callToCopy = i.next(); elements.add((Call) callToCopy.clone()); } this.statistics = stackToCopy.statistics; this.metric = stackToCopy.metric; }
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append("callstack"); if (name != null) { b.append(" "); b.append(name); } b.append(":"); for (Iterator<Call> i = iterator(); i.hasNext();) { b.append("\n"); b.append(" "); b.append(i.next().toString()); } b.append("\n"); return b.toString(); }
/** * Returns the next call to this processor id, or null if no such calls are * left */ public Call findCall(final ComponentId processorId) { for (final Iterator<Call> i = iterator(); i.hasNext();) { final Call call = i.next(); if (call.getDocumentProcessorId().equals(processorId)) { return call; } } return null; }
private static JSONObject renderDocprocChains(Container container) { JSONObject ret = new JSONObject(); for (RequestHandler h : container.getRequestHandlerRegistry().allComponents()) { if (h instanceof DocumentProcessingHandler) { ComponentRegistry<DocprocService> registry = ((DocumentProcessingHandler) h).getDocprocServiceRegistry(); for (DocprocService service : registry.allComponents()) { putJson(ret, service.getId().stringValue(), renderCalls(service.getCallStack().iterator())); } } } return ret; }