Code example for Stack

Methods: peek, pop, size

0
 
	public void pop() 
	{ 
		ASTNode topOfItemStack = itemStack.peek();
		 
		if(stack.size() > 0 && stack.peek().parentCompound == topOfItemStack){
			stack.pop();
		} 
	} 
	 
	public IfStatement getIfInElseCase() 
	{ 
		StackItem topItem = stack.pop();
		StackItem returnItem = stack.pop();
		stack.push(topItem);
		return (IfStatement) returnItem.ifOrDo;
	} 
	 
	public IfStatement getIf() 
	{ 
		IfStatement retval;