1 module orelang.operator.LogicOperator; 2 import orelang.operator.IOperator, 3 orelang.Engine, 4 orelang.Value; 5 import std.algorithm; 6 7 class NotOperator : IOperator { 8 /** 9 * call 10 */ 11 public Value call(Engine engine, Value[] args) { 12 return new Value(!engine.eval(args[0]).getBool); 13 } 14 } 15 16 class AndOperator : IOperator { 17 /** 18 * call 19 */ 20 public Value call(Engine engine, Value[] args) { 21 return new Value(args.all!(arg => engine.eval(arg).getBool)); 22 } 23 } 24 25 class OrOperator : IOperator { 26 /** 27 * call 28 */ 29 public Value call(Engine engine, Value[] args) { 30 return new Value(args.any!(arg => engine.eval(arg).getBool)); 31 } 32 }