예제 #1
0
        public void TestLessThanHardcoded()
        {
            var lhs  = new ValueOperand(5.0);
            var rhs  = new ValueOperand(-1.5);
            var node = new LessThan().SetChildren(lhs, rhs);

            Assert.IsFalse((bool)node.Value().Invoke(null));
        }
	}	// Use this for initialization
	public override EquationOperand GetRandomEquation(int product)
	{

		int factor = GetRandomFactor(product);
		ValueOperand value1 = new ValueOperand(factor); //1 inclusuive, solution exclusive
		ValueOperand value2 = new ValueOperand(product/factor);
		return new EquationOperand(value1, this, value2);
	}
예제 #3
0
	}	// Use this for initialization
	public override EquationOperand GetRandomEquation(int quotient)
	{
		int divisor = 0;
		do {
			divisor = Random.Range(2, 51); // cap divisor at 50, and don't allow divide by 1
		} while (divisor * quotient > 200); // cap dividend at 200
		ValueOperand value1 = new ValueOperand(divisor);
		ValueOperand value2 = new ValueOperand(quotient * value1.GetValue());
		return new EquationOperand(value2, this, value1);
	}
예제 #4
0
        public override IOperationResult ToResult()
        {
            string result;

            if (ValueOperand is TextValueOperand)
            {
                string value = ((string)ValueOperand.GetValue()).TrimEnd('*').TrimStart('*');
                result = string.Format("CONTAINS({0},'\"{1}*\"')", ColumnOperand, value);
            }
            else
            {
                result = string.Format("CONTAINS({0},'\"{1}*\"')", ColumnOperand, ValueOperand.GetValue());
            }

            return(OperationResultBuilder.CreateResult(result));
        }
예제 #5
0
        public override IOperationResult ToResult()
        {
            string result;

            if (ValueOperand is TextValueOperand)
            {
                string value = (string)ValueOperand.GetValue();
                result = value.Contains("*")
                             ? string.Format("CONTAINS({0},'\"{1}\"')", ColumnOperand, value)
                             : string.Format("CONTAINS({0},{1})", ColumnOperand, ValueOperand);
            }
            else
            {
                result = string.Format("CONTAINS({0},{1})", ColumnOperand, ValueOperand);
            }

            return(OperationResultBuilder.CreateResult(result));
        }
예제 #6
0
	}	// Use this for initialization
	public override EquationOperand GetRandomEquation(int solution)
	{
		ValueOperand value1 = new ValueOperand((int)Mathf.Sqrt(solution));
		ValueOperand value2 = new ValueOperand(2);
		return new EquationOperand(value1, this, value2);
	}
예제 #7
0
	// Use this for initialization
	public override EquationOperand GetRandomEquation(int difference)
	{
		ValueOperand value2 = new ValueOperand(Random.Range(1, difference)); //1 inclusuive, solution exclusive
		ValueOperand value1 = new ValueOperand(difference + value2.GetValue());
		return new EquationOperand(value1, this, value2);
	}