From c1a240e873cb0e434ea98506d2f33b4a571e354a Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Tue, 6 Jan 2015 11:43:01 +0100 Subject: Assignment No.12 first complete implementation. --- .../in/inf/java1/aufgabe12/UnaryOperator.java | 92 +++++++++++----------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src/de/fhswf/in/inf/java1/aufgabe12/UnaryOperator.java') diff --git a/src/de/fhswf/in/inf/java1/aufgabe12/UnaryOperator.java b/src/de/fhswf/in/inf/java1/aufgabe12/UnaryOperator.java index 481c027..c1734f1 100644 --- a/src/de/fhswf/in/inf/java1/aufgabe12/UnaryOperator.java +++ b/src/de/fhswf/in/inf/java1/aufgabe12/UnaryOperator.java @@ -1,46 +1,46 @@ -/** - * - */ -package de.fhswf.in.inf.java1.aufgabe12; - -import java.util.Stack; - -/** - * An abstract class for calculations with unary operators. - * - * @author $Author: $ - * @version $Revision: $, $Date: $ UTC - */ -public abstract class UnaryOperator implements Operator -{ - /* - * (non-Javadoc) - * - * @see de.fhswf.in.inf.java1.aufgabe12.Operator#eval(java.util.Stack) - */ - @Override - public final void eval(Stack stack) - { - if (stack == null) - { - throw new IllegalArgumentException("Stack must not be null."); - } - - if (stack.size() < 1) - { - throw new IllegalArgumentException( - "Unary operation requires one operand."); - } - - stack.push(eval(stack.pop())); - } - - /** - * This class implements the calculation. - * - * @param d - * The unary operator. - * @return The result of the calculation. - */ - abstract double eval(double d); -} +/** + * + */ +package de.fhswf.in.inf.java1.aufgabe12; + +import java.util.Stack; + +/** + * An abstract class for calculations with unary operators. + * + * @author $Author: $ + * @version $Revision: $, $Date: $ UTC + */ +public abstract class UnaryOperator implements Operator +{ + /* + * (non-Javadoc) + * + * @see de.fhswf.in.inf.java1.aufgabe12.Operator#eval(java.util.Stack) + */ + @Override + public final void eval(Stack stack) + { + if (stack == null) + { + throw new IllegalArgumentException("Stack must not be null."); + } + + if (stack.size() < 1) + { + throw new IllegalArgumentException( + "Unary operation requires one operand."); + } + + stack.push(eval(stack.pop())); + } + + /** + * This class implements the calculation. + * + * @param d + * The unary operator. + * @return The result of the calculation. + */ + abstract double eval(double d); +} -- cgit v1.2.3-70-g09d2