예제 #1
0
 public override BoolType Smaller(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType != "string")
         return new BoolType(false);
     return new BoolType(this.strval.CompareTo(right.strval) < 0);
 }
예제 #2
0
 public override TypeBase Add(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType == "char")
         return new StringType(this.strval + right.cval.ToString());
     else if (rightType == "string")
         return new StringType(this.strval + right.strval);
     else
         return null;
 }
예제 #3
0
 public override BoolType Equal(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType != "string")
         return new BoolType(false);
     return new BoolType(this.strval == right.strval);
 }
예제 #4
0
 public override TypeBase Power(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType == "int")
         return new IntType((int)Math.Pow((double)this.ival, (double)right.ival));
     else if (rightType == "double")
         return new DoubleType(Math.Pow((double)this.dval, (double)right.dval));
     else
         return null;
 }
예제 #5
0
 public override BoolType Smaller(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType != "int")
         return new BoolType(false);
     return new BoolType(this.ival < right.ival);
 }
예제 #6
0
 public override TypeBase Percent(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType == "int")
         return new IntType(this.ival % right.ival);
     else
         return null;
 }
예제 #7
0
 public override TypeBase Multi(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType == "int")
         return new IntType(this.ival * right.ival);
     else if (rightType == "double")
         return new DoubleType((double)this.ival * right.dval);
     else
         return null;
 }
예제 #8
0
 public override TypeBase Minus(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType == "int")
         return new DoubleType(this.dval - (double)right.ival);
     else if (rightType == "double")
         return new DoubleType(this.dval - right.dval);
     else
         return null;
 }
예제 #9
0
 public override BoolType Larger(TypeBase right)
 {
     if (right == null)
         return null;
     var rightType = right.GetTypeStr();
     if (rightType != "double")
         return new BoolType(false);
     return new BoolType(this.dval > right.dval);
 }
예제 #10
0
 public override BoolType Or(TypeBase right)
 {
     if (right.GetTypeStr() != "bool")
         return new BoolType(false);
     return new BoolType( val || (right as BoolType).val);
 }