/** * Return the {@link Entry} currently at the top of the {@link LinkedList} or * {@code null} if the {@link LinkedList} is empty. */ @Nullable public Entry peek() { return this.state.peek(); }
public SubProcess getCurrentSubProcess() { return currentSubprocessStack.peek(); }
@Override public T getCurrent() { return internalStack.peek(); }
@Override public Object peekMatchedResource() { return matchedResources.peek(); }
@Override public Object peekMatchedResource() { return matchedResources.peek(); }
/** * Return the {@link Entry} currently at the top of the {@link LinkedList} or * {@code null} if the {@link LinkedList} is empty. */ @Nullable public Entry peek() { return this.state.peek(); }
@Override public BaseDanmaku first() { if (items != null && !items.isEmpty()) { if (mSortType == ST_BY_LIST) { return ((LinkedList<BaseDanmaku>) items).peek(); } return ((SortedSet<BaseDanmaku>) items).first(); } return null; }
private static List<Class<?>> getCurrentExtensions() { RunContext context = contextStacks.get().peek(); if (context == null) return Collections.emptyList(); return context.globalExtensionClasses; }
/** * Creates a new iterator representation for all files within a folder. * * @param folder The root folder. */ protected FolderIterator(File folder) { files = new LinkedList<File>(Collections.singleton(folder)); File candidate; do { candidate = files.removeFirst(); File[] file = candidate.listFiles(); if (file != null) { files.addAll(0, Arrays.asList(file)); } } while (!files.isEmpty() && (files.peek().isDirectory() || files.peek().equals(new File(folder, JarFile.MANIFEST_NAME)))); }
/** * {@inheritDoc} */ @SuppressFBWarnings(value = "IT_NO_SUCH_ELEMENT", justification = "Exception is thrown by invoking removeFirst on an empty list.") public Element next() { try { return new Element.ForFile(folder, files.removeFirst()); } finally { while (!files.isEmpty() && (files.peek().isDirectory() || files.peek().equals(new File(folder, JarFile.MANIFEST_NAME)))) { File folder = files.removeFirst(); File[] file = folder.listFiles(); if (file != null) { files.addAll(0, Arrays.asList(file)); } } } }
@Override public String getFinalMatchingGroup() { final MatchResult mr = matchResults.peek(); if (mr == null) { return null; } final String finalGroup = mr.group(mr.groupCount()); // We have found a match but the right hand path pattern did not match anything // so just returning an empty string as a final matching group result. // Otherwise a non-empty patterns would fail to match the right-hand-path properly. // See also PatternWithGroups.match(CharSequence) implementation. return finalGroup == null ? "" : finalGroup; }
@Override public String getFinalMatchingGroup() { final MatchResult mr = matchResults.peek(); if (mr == null) { return null; } final String finalGroup = mr.group(mr.groupCount()); // We have found a match but the right hand path pattern did not match anything // so just returning an empty string as a final matching group result. // Otherwise a non-empty patterns would fail to match the right-hand-path properly. // See also PatternWithGroups.match(CharSequence) implementation. return finalGroup == null ? "" : finalGroup; }
@Override public void characters(char ch[], int start, int length) { String value = new String(ch, start, length); mDataSet.addValue(value, mOpenTags.peek()); } }
public void pushToStack(int serviceId, String videoUrl, String name) { if (DEBUG) { Log.d(TAG, "pushToStack() called with: serviceId = [" + serviceId + "], videoUrl = [" + videoUrl + "], name = [" + name + "]"); } if (stack.size() > 0 && stack.peek().getServiceId() == serviceId && stack.peek().getUrl().equals(videoUrl)) { Log.d(TAG, "pushToStack() called with: serviceId == peek.serviceId = [" + serviceId + "], videoUrl == peek.getUrl = [" + videoUrl + "]"); return; } else { Log.d(TAG, "pushToStack() wasn't equal"); } stack.push(new StackItem(serviceId, videoUrl, name)); }
@Override public void epilogue(InputStream is) throws IOException { expect(MimeMultipart.class); ByteArrayOutputStream epilogue = new ByteArrayOutputStream(); IOUtils.copy(is, epilogue); ((MimeMultipart) stack.peek()).setEpilogue(epilogue.toByteArray()); }
@Override public void pushMatchedRuntimeResource(final RuntimeResource runtimeResource) { if (tracingLogger.isLogEnabled(ServerTraceEvent.MATCH_RUNTIME_RESOURCE)) { tracingLogger.log(ServerTraceEvent.MATCH_RUNTIME_RESOURCE, runtimeResource.getResources().get(0).getPath(), runtimeResource.getResources().get(0).getPathPattern().getRegex(), matchResults.peek().group() .substring(0, matchResults.peek().group().length() - getFinalMatchingGroup().length()), matchResults.peek().group()); } this.matchedRuntimeResources.push(runtimeResource); }
@Override public void pushMatchedRuntimeResource(final RuntimeResource runtimeResource) { if (tracingLogger.isLogEnabled(ServerTraceEvent.MATCH_RUNTIME_RESOURCE)) { tracingLogger.log(ServerTraceEvent.MATCH_RUNTIME_RESOURCE, runtimeResource.getResources().get(0).getPath(), runtimeResource.getResources().get(0).getPathPattern().getRegex(), matchResults.peek().group() .substring(0, matchResults.peek().group().length() - getFinalMatchingGroup().length()), matchResults.peek().group()); } this.matchedRuntimeResources.push(runtimeResource); }
public void setTitleToUrl(int serviceId, String videoUrl, String name) { if (name != null && !name.isEmpty()) { for (StackItem stackItem : stack) { if (stack.peek().getServiceId() == serviceId && stackItem.getUrl().equals(videoUrl)) { stackItem.setTitle(name); } } } }
@Override public void field(Field parsedField) throws MimeException { expect(Part.class); String name = parsedField.getName(); String raw = parsedField.getRaw().toString(); ((Part) stack.peek()).addRawHeader(name, raw); } }
@Override public void body(BodyDescriptor bd, InputStream in) throws IOException, MimeException { expect(Part.class); Body body = bodyFactory.createBody(bd.getTransferEncoding(), bd.getMimeType(), in); ((Part)stack.peek()).setBody(body); }