1 module orelang.operator.EqualOperator; 2 import orelang.operator.IOperator, 3 orelang.Engine, 4 orelang.Value; 5 6 class EqualOperator : IOperator { 7 /** 8 * call 9 */ 10 public Value call(Engine engine, Value[] args) { 11 return new Value(engine.eval(args[0]) == engine.eval(args[1])); 12 } 13 } 14 15 class NotEqualOperator : IOperator { 16 /** 17 * call 18 */ 19 public Value call(Engine engine, Value[] args) { 20 return new Value(engine.eval(args[0]) != engine.eval(args[1])); 21 } 22 } 23 24 class LessOperator : IOperator { 25 /** 26 * call 27 */ 28 public Value call(Engine engine, Value[] args) { 29 return new Value(engine.eval(args[0]) < engine.eval(args[1])); 30 } 31 } 32 33 class GreatOperator : IOperator { 34 /** 35 * call 36 */ 37 public Value call(Engine engine, Value[] args) { 38 return new Value(engine.eval(args[0]) > engine.eval(args[1])); 39 } 40 } 41 42 class LEqOperator : IOperator { 43 /** 44 * call 45 */ 46 public Value call(Engine engine, Value[] args) { 47 return new Value(engine.eval(args[0]) <= engine.eval(args[1])); 48 } 49 } 50 51 class GEqOperator : IOperator { 52 /** 53 * call 54 */ 55 public Value call(Engine engine, Value[] args) { 56 return new Value(engine.eval(args[0]) >= engine.eval(args[1])); 57 } 58 }