package gve.calc.formula; import java.lang.reflect.*; import gve.calc.logic.*; // OperatorModel
The classes InfixBinaryOp, PrefixUnaryOp and PostfixUnaryOp maintain a list of (String,Factory) pairs, linking an operator name (e.g. "*") to a Factory (that contains a method returning for example OperatorMult objects). |
This Factory is more or less equivalent to manually creating classes like class OperatorMultFactory extends InfixBinaryOpFactory { public InfixBinaryOp createInfixBinaryOp(String name,Part l,Part r) { return new OperatorMult(l,r); } } except for the extra getName() method. We actually don't need the 'name' argument of createInfixBinaryOp() at all. |