本文整理了Java中java.util.Stack.pop()
方法的一些代码示例,展示了Stack.pop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stack.pop()
方法的具体详情如下:
包路径:java.util.Stack
类名称:Stack
方法名:pop
[英]Returns the element at the top of the stack and removes it.
[中]返回堆栈顶部的元素并将其删除。
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
void advance() {
if (searchStack.isEmpty()) {
next = null;
} else {
next = searchStack.pop();
}
}
};
代码示例来源:origin: apache/hive
/**
* Pop the last signal
*/
public Signal signalPop() {
if (!exec.signals.empty()) {
return exec.signals.pop();
}
return null;
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void flushParents(List<Record> willReturn){
Stack<RepeatedRecordInfo> reverseStack = new Stack<>();
while(!stack.isEmpty()){
reverseStack.push(stack.pop());
}
while(!reverseStack.isEmpty()){
RepeatedRecordInfo info = reverseStack.pop();
info.timesSeen -= 1;
flush(info, willReturn);
stack.push(info);
}
}
代码示例来源:origin: jenkinsci/jenkins
private void visit(N p) throws CycleDetectedException {
if (!visited.add(p)) return;
visiting.add(p);
path.push(p);
for (N q : getEdges(p)) {
if (q==null) continue; // ignore unresolved references
if (visiting.contains(q))
detectedCycle(q);
visit(q);
}
visiting.remove(p);
path.pop();
topologicalOrder.add(p);
}
代码示例来源:origin: apache/hive
/**
* walk the current operator and its descendants.
*
* @param nd
* current operator in the graph
* @throws SemanticException
*/
@Override
protected void walk(Node nd) throws SemanticException {
if (opStack.empty() || nd != opStack.peek()) {
opStack.push(nd);
}
if (allParentsDispatched(nd)) {
// all children are done or no need to walk the children
if (!getDispatchedList().contains(nd)) {
toWalk.addAll(nd.getChildren());
dispatch(nd, opStack);
}
opStack.pop();
return;
}
// add children, self to the front of the queue in that order
toWalk.add(0, nd);
addAllParents(nd);
}
}
代码示例来源:origin: plantuml/plantuml
private void shuntOperators(List<Token> outputQueue, Stack<Token> stack, LazyOperator o1) {
Expression.Token nextToken = stack.isEmpty() ? null : stack.peek();
while (nextToken != null
&& (nextToken.type == Expression.TokenType.OPERATOR || nextToken.type == Expression.TokenType.UNARY_OPERATOR)
&& ((o1.isLeftAssoc() && o1.getPrecedence() <= operators.get(nextToken.surface).getPrecedence()) || (o1
.getPrecedence() < operators.get(nextToken.surface).getPrecedence()))) {
outputQueue.add(stack.pop());
nextToken = stack.isEmpty() ? null : stack.peek();
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
private GroovySourceAST getGrandParentNode() {
Object currentNode = stack.pop();
Object parentNode = stack.pop();
Object grandParentNode = stack.peek();
stack.push(parentNode);
stack.push(currentNode);
return (GroovySourceAST) grandParentNode;
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Called at the end of processing an antlib.
*/
public void exitAntLib() {
antLibStack.pop();
antLibCurrentUri = (antLibStack.isEmpty()) ? null : antLibStack.peek();
}
代码示例来源:origin: pmd/pmd
private Object init(JavaNode node, Object data) {
stack.push(count);
count = NumericConstants.ZERO;
node.childrenAccept(this, data);
if (count > 1) {
addViolation(data, node);
}
count = stack.pop();
return data;
}
代码示例来源:origin: jenkinsci/jenkins
private Set<AbstractProject> getTransitive(Map<AbstractProject, List<DependencyGroup>> direction, AbstractProject src, boolean up) {
Set<AbstractProject> visited = new HashSet<AbstractProject>();
Stack<AbstractProject> queue = new Stack<AbstractProject>();
queue.add(src);
while(!queue.isEmpty()) {
AbstractProject p = queue.pop();
for (AbstractProject child : get(direction,p,up)) {
if(visited.add(child))
queue.add(child);
}
}
return visited;
}
代码示例来源:origin: jenkinsci/jenkins
String[] p = path.split("/");
Stack<String> name = new Stack<String>();
for (int i=0; i<c.length;i++) {
if (i==0 && c[i].equals("")) continue;
name.push(c[i]);
));
name.pop();
continue;
continue;
name.push(p[i]);
代码示例来源:origin: gocd/gocd
private void validateRootExists(CaseInsensitiveString root, PipelineDependencyState pipelineDependencyState, Stack<CaseInsensitiveString> visiting) throws Exception {
if (!pipelineDependencyState.hasPipeline(root)) {
StringBuffer sb = new StringBuffer("Pipeline \"");
sb.append(root);
sb.append("\" does not exist.");
visiting.pop();
if (!visiting.empty()) {
CaseInsensitiveString parent = visiting.peek();
sb.append(" It is used from pipeline \"");
sb.append(parent);
sb.append("\".");
}
throw new Exception(sb.toString());
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
void advance() {
if (searchStack.isEmpty()) {
next = null;
} else {
next = searchStack.pop();
if (pathMatchesNode(next)) {
for (int i = next.numChildren() - 1; i >= 0; i--) {
searchStack.push(next.getChild(i));
}
}
}
}
};
代码示例来源:origin: jenkinsci/jenkins
public void endNode() {
XStreamDOM dom = pendings.pop().toDOM();
pendings.peek().addChild(dom);
}
代码示例来源:origin: gocd/gocd
private Set<Class> findAllInterfacesInHierarchy(Class candidateGoExtensionClass) {
Stack<Class> classesInHierarchy = new Stack<>();
classesInHierarchy.add(candidateGoExtensionClass);
Set<Class> interfaces = new HashSet<>();
while (!classesInHierarchy.empty()) {
Class classToCheckFor = classesInHierarchy.pop();
if (classToCheckFor.isInterface()) {
interfaces.add(classToCheckFor);
}
classesInHierarchy.addAll(Arrays.asList(classToCheckFor.getInterfaces()));
if (classToCheckFor.getSuperclass() != null) {
classesInHierarchy.add(classToCheckFor.getSuperclass());
}
}
return interfaces;
}
代码示例来源:origin: groovy/groovy-core
private GroovySourceAST getParentNode() {
GroovySourceAST parentNode = null;
GroovySourceAST currentNode = stack.pop();
if (!stack.empty()) {
parentNode = stack.peek();
}
stack.push(currentNode);
return parentNode;
}
代码示例来源:origin: org.testng/testng
private void run(Graph<T> graph, T v) {
m_indices.put(v, m_index);
m_lowlinks.put(v, m_index);
m_index++;
m_s.push(v);
for (T vprime : graph.getPredecessors(v)) {
if (! m_indices.containsKey(vprime)) {
run(graph, vprime);
int min = Math.min(m_lowlinks.get(v), m_lowlinks.get(vprime));
m_lowlinks.put(v, min);
}
else if (m_s.contains(vprime)) {
m_lowlinks.put(v, Math.min(m_lowlinks.get(v), m_indices.get(vprime)));
}
}
if (Objects.equals(m_lowlinks.get(v), m_indices.get(v))) {
m_cycle = Lists.newArrayList();
T n;
do {
n = m_s.pop();
m_cycle.add(n);
} while (! n.equals(v));
}
}
代码示例来源:origin: rapidoid/rapidoid
private static void close(Stack<XNode> stack, String text) {
U.must(!stack.isEmpty(), "Empty stack!");
XNode x = stack.pop();
U.must(x.op != XNode.OP.OP_ROOT, "Cannot close a tag that wasn't open: %s", text);
if (!U.eq(x.text, text)) {
throw U.rte("Expected block: %s, but found: %s", x.text, text);
}
stack.peek().children.add(x);
}
代码示例来源:origin: org.codehaus.groovy/groovy
private GroovySourceAST getParentNode() {
Object currentNode = stack.pop();
Object parentNode = stack.peek();
stack.push(currentNode);
return (GroovySourceAST) parentNode;
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
void advance() {
if (searchStack.isEmpty()) {
next = null;
} else {
next = searchStack.pop();
}
}
};
内容来源于网络,如有侵权,请联系作者删除!