Skip to content

Instantly share code, notes, and snippets.

@fakedrake
Created October 21, 2012 16:11
Show Gist options
  • Save fakedrake/3927378 to your computer and use it in GitHub Desktop.
Save fakedrake/3927378 to your computer and use it in GitHub Desktop.
class BaseOperator<T> implements IOperator<T> {
public T operate(T x, T y) {}
public boolean apply (Stack<T> stack) {
try {
T x = stack.pop();
T y = stack.pop();
} catch (EmptyStackException e) {
System.out.println("Stack has to few arguments, you cant operate on it.");
return false;
}
stack.push(operate(x,y));
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment