Refine search
/** * Store un-initialized variables in a temporary stack for future use. */ private void storePrevScopeUninitializedVariableData() { final ScopeData scopeData = scopeStack.peek(); final Deque<DetailAST> prevScopeUninitializedVariableData = new ArrayDeque<>(); scopeData.uninitializedVariables.forEach(prevScopeUninitializedVariableData::push); prevScopeUninitializedVariables.push(prevScopeUninitializedVariableData); }
@Override public boolean hasNext() { if (geometriesDeque.isEmpty()) { return false; } while (geometriesDeque.peek() instanceof OGCConcreteGeometryCollection) { OGCGeometryCollection collection = (OGCGeometryCollection) geometriesDeque.pop(); for (int i = 0; i < collection.numGeometries(); i++) { geometriesDeque.push(collection.geometryN(i)); } } return !geometriesDeque.isEmpty(); }
final String name = nameIterator.hasNext() ? nameIterator.next() : null; final String name2 = inferAlias(exprList, node); names.add(Util.first(name, name2)); } else { final Frame frame = stack.pop(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), exprList, names, SqlValidatorUtil.F_SUGGESTER); stack.push( new Frame(frame.rel, ImmutableList.of(Pair.of(frame.right.get(0).left, rowType))));
@Override public void visitNode(Tree tree) { if (tree.is(Tree.Kind.TRY_STATEMENT)) { withinTry.push((TryStatementTree) tree); toReport.push(new ArrayList<>()); } else if (withinStandardTryWithFinally() && ((NewClassTree) tree).symbolType().isSubtypeOf("java.lang.AutoCloseable")) { toReport.peek().add(tree); } }
private static boolean recursiveDelete(File file) { Deque<File> toDelete = new ArrayDeque<>(); toDelete.push(file); while (!toDelete.isEmpty()) { File target = toDelete.pop(); File[] contents = target.listFiles(); if (contents == null || contents.length == 0) { if (target.exists() && !target.delete()) { return false; } } else { toDelete.push(target); for (File f : contents) { toDelete.push(f); } } } return true; }
/** * Stores name of currently parsed view in a stack so it can be determined * during {@code prepare()}. * * @param parsingView * {@code true} to store one more name, {@code false} to remove it * from stack * @param viewName * name of the view */ public void setParsingCreateView(boolean parsingView, String viewName) { // It can be recursive, thus implemented as counter. this.parsingView += parsingView ? 1 : -1; assert this.parsingView >= 0; if (parsingView) { viewNameStack.push(viewName); } else { assert viewName.equals(viewNameStack.peek()); viewNameStack.pop(); } } public String getParsingCreateViewName() {
public void testHoldsLockOnAllOperations() { create().element(); create().offer("foo"); create().peek(); create().poll(); create().remove(); create().equals(new ArrayDeque<>(ImmutableList.of("foo"))); create().hashCode(); create().isEmpty(); create().iterator(); create().remove("foo"); create().removeFirstOccurrence("e"); create().removeLastOccurrence("e"); create().push("e"); create().pop(); create().descendingIterator();
@Override public Activity startActivity(String activityName) { if (Thread.currentThread() != mainThread) { return OFF_THREAD_ACTIVITY; } ActivityInfo newActivity = new ActivityInfo(activityName).initialize(); if (!activityStack.isEmpty()) { ActivityInfo currentActivity = activityStack.peek(); currentActivity.ownTime += newActivity.startTime - ((currentActivity.resumeTime > 0) ? currentActivity.resumeTime : currentActivity.startTime); currentActivity.ownMem += (currentActivity.startMem - newActivity.startMem > 0) ? currentActivity.startMem - newActivity.startMem : 0; } activityStack.push(newActivity); return activityInstance; }
/** * @param closeable object to close at shutdown * @return {@code true} iff this is the first object to be registered * @throws IllegalStateException if already shutting down */ public boolean addCloseable(Closeable closeable) { Objects.requireNonNull(closeable); Preconditions.checkState(!triggered, "Can't add closeable %s; already shutting down", closeable); synchronized (closeAtShutdown) { boolean wasFirst = closeAtShutdown.isEmpty(); closeAtShutdown.push(closeable); return wasFirst; } }
private StringBuilder dump(StringBuilder sb) { Deque<ASTNode> stack = new ArrayDeque<ASTNode>(); stack.push(this); int tabLength = 0; while (!stack.isEmpty()) { ASTNode next = stack.peek(); if (!next.visited) { sb.append(StringUtils.repeat(" ", tabLength * 3)); sb.append(next.toString()); sb.append("\n"); if (next.children != null) { for (int i = next.children.size() - 1 ; i >= 0 ; i--) { stack.push((ASTNode)next.children.get(i)); } } tabLength++; next.visited = true; } else { tabLength--; next.visited = false; stack.pop(); } } return sb; }
final String name = nameIterator.hasNext() ? nameIterator.next() : null; final String name2 = inferAlias(exprList, node); names.add(Util.first(name, name2)); } else { final Frame frame = stack.pop(); final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), exprList, names, SqlValidatorUtil.F_SUGGESTER); stack.push( new Frame(frame.rel, ImmutableList.of(Pair.of(frame.right.get(0).left, rowType))));
private static Map<File, Long> doScan(File file) { final Map<File, Long> results = new HashMap<File, Long>(); final Deque<File> toScan = new ArrayDeque<File>(); toScan.add(file); while (!toScan.isEmpty()) { File next = toScan.pop(); if (next.isDirectory()) { results.put(next, next.lastModified()); File[] list = next.listFiles(); if (list != null) { for (File f : list) { toScan.push(new File(f.getAbsolutePath())); } } } } return results; }
Boolean val = simulatedStack.peek(); val = val != null ? val : Boolean.FALSE; simulatedStack.push(val); if (val) return; break; simulatedStack.push(vals[vals.length - 1]); simulatedStack.addAll(Arrays.asList(vals)); if (vals[1]) { simulatedStack.push(vals[vals.length - 1]); simulatedStack.addAll(Arrays.asList(vals)); if (vals[2]) { simulatedStack.push(vals[vals.length - 2]); simulatedStack.push(vals[vals.length - 1]); simulatedStack.addAll(Arrays.asList(vals)); if (vals[1] && vals[2]) { simulatedStack.push(vals[vals.length - 2]); simulatedStack.push(vals[vals.length - 1]); simulatedStack.addAll(Arrays.asList(vals)); break; simulatedStack.push(vals[1]); simulatedStack.push(vals[0]); break; case Opcodes.DCONST_0: