Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 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));
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 public RDBool LessOrEqual(RDElement lhs, RDElement rhs, object factPool)
 {
     return(LessThan(lhs, rhs, factPool).Or(Equal(lhs, rhs, factPool)));
 }
Exemplo n.º 5
0
 public virtual RDBool GreaterThan(RDElement lhs, RDElement rhs, object factPool)
 {
     return(new RDBool(((RDNumber)lhs).Data > ((RDNumber)rhs).Data));
 }
Exemplo n.º 6
0
 public RDBool NotEqual(RDElement lhs, RDElement rhs, object factPool)
 {
     return(Equal(lhs, rhs, factPool).Not());
 }
Exemplo n.º 7
0
 public virtual RDNumber Mod(RDElement lhs, RDElement rhs, object factPool)
 {
     return(new RDNumber(((RDNumber)lhs).Data % ((RDNumber)rhs).Data));
 }
Exemplo n.º 8
0
 public RDBool GreaterOrEqual(RDElement lhs, RDElement rhs, object factPool)
 {
     return(GreaterThan(lhs, rhs, factPool).Or(Equal(lhs, rhs, factPool)));
 }