use of java.util.EmptyStackException in project Algorithms by wlsgussla123.
the class Main method pop.
public char pop() throws EmptyStackException {
if (isEmpty())
new EmptyStackException();
char data = this.data[this.top];
this.top--;
return data;
}
use of java.util.EmptyStackException in project Algorithms by wlsgussla123.
the class MyStack method pop.
public T pop() {
if (top == null)
throw new EmptyStackException();
T data = top.data;
top = top.next;
return data;
}
use of java.util.EmptyStackException in project linuxtools by eclipse.
the class ParseNewlibTexinfo method BuildXMLFromTexinfo2.
public static void BuildXMLFromTexinfo2(String srcdir, String builddir, BufferedWriter os, String lib) {
try {
srcdir = srcdir.endsWith("/") ? srcdir + lib : srcdir + "/" + lib;
builddir = builddir.endsWith("/") ? builddir + lib : builddir + "/" + lib;
String qFile = srcdir + "/" + lib + ".texinfo";
try {
BufferedReader is = new BufferedReader(new FileReader(qFile));
String il;
boolean ignore = false;
while (is != null) {
while (null != (il = is.readLine())) {
if (!ignore && il.startsWith("@findex")) {
HandleFunction(os, is, il, builddir);
} else if (!ignore && il.startsWith("@include")) {
is = HandleInclude(is, builddir, il);
} else if (il.startsWith("@ignore")) {
ignore = true;
} else if (il.startsWith("@end ignore")) {
ignore = false;
}
}
is.close();
is = readers.pop();
}
} catch (IOException e) {
System.out.println("Input File IOException: " + e);
return;
} catch (EmptyStackException f) {
// ok, we expect to get here
}
} catch (NullPointerException e) {
e.printStackTrace();
System.out.println("NullPointerException: " + e);
return;
}
}
use of java.util.EmptyStackException in project scheduling by ow2-proactive.
the class FlowChecker method dfsBlocks.
/**
* Find matching start and end blocks in a task tree using depth first search
*
* @param tree task tree to search
* @param done already treated tasks; multiple dependencies: multiple passes
* @param env accumulates the previously read start tags
* @param join stacks previous join targets
* @throws FlowError
*/
private void dfsBlocks(TaskTree tree, Set<String> done, Stack<TaskTree> env, Stack<TaskTree> join) throws FlowError {
if (tree.joins.size() > 0 && !tree.joinTrigger) {
return;
}
if (tree.targetOf != null && !done.contains(tree.targetOf.element.getName())) {
return;
}
FlowBlock fb = tree.element.getFlowBlock();
String name = tree.element.getName();
if (done.contains(name)) {
return;
} else {
done.add(name);
}
switch(fb) {
case START:
// push new opening tag in the environment
env.push(tree);
break;
case END:
// close the last opened block
TaskTree start = null;
try {
start = env.pop();
} catch (EmptyStackException e) {
throw new FlowError("Unmatched end block", FlowErrorType.BLOCK, name);
}
Block blk = new Block(start, tree);
blocks.add(blk);
break;
case NONE:
break;
}
List<TaskTree> children = new ArrayList<>();
children.addAll(tree.children);
if (tree.children.size() == 0) {
if (tree.element.getFlowScript() != null && tree.element.getFlowScript().getActionType().equals(FlowActionType.IF.toString())) {
if (tree.targetJoin != null) {
join.add(tree.targetJoin);
}
for (TaskTree t : tree.targets) {
children.add(t);
}
} else if (join.size() > 0) {
TaskTree pop = join.pop();
children.add(pop);
pop.joinTrigger = true;
}
}
// recursive call
for (TaskTree child : children) {
dfsBlocks(child, done, env, join);
}
}
use of java.util.EmptyStackException in project CommandHelper by EngineHub.
the class CompilerObject method popNode.
private void popNode(Target t) throws ConfigCompileException {
try {
nodes.pop();
pointer = nodes.peek();
} catch (EmptyStackException e) {
throw new ConfigCompileException("Unmatched closing parenthesis. (Did you put too many right parenthesis?)", t);
}
}
Aggregations