public virtual RDBool Equal(RDElement lhs, RDElement rhs, object factPool) { if (lhs is RDNumber) { return(new RDBool(((RDNumber)lhs).Data == ((RDNumber)rhs).Data)); } if (lhs is RDBool) { return(new RDBool(((RDBool)lhs).Data == ((RDBool)rhs).Data)); } throw new NotImplementedException(); }
public RDBool IsAny(RDList lhs, RDElement rhs, object factPool) { foreach (RDElement x in lhs.Data) { if (Equal(x, rhs, factPool).Data) { return(new RDBool(true)); } } return(new RDBool(false)); // return new RDBool(lhs.Data.Any(x => Equal(x, rhs, factPool).Data)); }
public virtual bool IsConstant(Formula formula, out RDElement result) { if (formula.Parameters == null) { int res = 0; if (formula.OperationName == "TRUE") { result = new RDBool(true); return(true); } if (formula.OperationName == "FALSE") { result = new RDBool(false); return(true); } if (int.TryParse(formula.OperationName, out res)) { result = new RDNumber(res); return(true); } } result = null; return(false); }
public RDBool LessOrEqual(RDElement lhs, RDElement rhs, object factPool) { return(LessThan(lhs, rhs, factPool).Or(Equal(lhs, rhs, factPool))); }
public virtual RDBool GreaterThan(RDElement lhs, RDElement rhs, object factPool) { return(new RDBool(((RDNumber)lhs).Data > ((RDNumber)rhs).Data)); }
public RDBool NotEqual(RDElement lhs, RDElement rhs, object factPool) { return(Equal(lhs, rhs, factPool).Not()); }
public virtual RDNumber Mod(RDElement lhs, RDElement rhs, object factPool) { return(new RDNumber(((RDNumber)lhs).Data % ((RDNumber)rhs).Data)); }
public RDBool GreaterOrEqual(RDElement lhs, RDElement rhs, object factPool) { return(GreaterThan(lhs, rhs, factPool).Or(Equal(lhs, rhs, factPool))); }