1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package net.sf.magicproject.operation;
24
25 import java.io.IOException;
26 import java.io.InputStream;
27
28 import net.sf.magicproject.expression.BinaryExpression;
29 import net.sf.magicproject.expression.Expression;
30 import net.sf.magicproject.expression.ExpressionFactory;
31
32
33 /***
34 * Represents a binary operation.
35 *
36 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
37 */
38 public abstract class BinaryOperation extends Operation {
39
40 /***
41 * Creates a new instance of BinaryOperation <br>
42 */
43 protected BinaryOperation() {
44 super();
45 }
46
47 @Override
48 public Expression readNextExpression(InputStream inputFile)
49 throws IOException {
50 return new BinaryExpression(this, ExpressionFactory
51 .readNextExpression(inputFile), ExpressionFactory
52 .readNextExpression(inputFile));
53 }
54
55 @Override
56 public abstract int process(int leftValue, int rightValue);
57
58 @Override
59 public abstract String getOperator();
60
61 }