예제 #1
0
 /// <summary>
 /// CheckParms( Parser.Token, CValue) - This method makes certain the single argument is non-null.
 ///		Raises an exception if it is.
 /// </summary>
 /// <param name="oToken">Parser.Token object</param>
 /// <param name="arg1">CValue argument</param>
 private void CheckParms(Parser.Token oToken, CValue arg1)
 {
     if (arg1 == null)
     {
         throw new ApplicationException("Argument not supplied near " + oToken.ToString() + " operation.");
     }
 }
예제 #2
0
        public CPower(CValue arg1, CValue arg2)
        {
            CheckParms("^", arg1, arg2);

            m_arg1 = arg1;
            m_arg2 = arg2;
        }
예제 #3
0
        public CDivide(CValue arg1, CValue arg2)
        {
            CheckParms("/", arg1, arg2);

            m_arg1 = arg1;
            m_arg2 = arg2;
        }
예제 #4
0
 public CValue(CValue clone)
 {
     this.m_IntValue   = clone.intValue;
     this.m_ColorValue = new Color(clone.colorValue.r, clone.colorValue.g, clone.colorValue.b, clone.colorValue.a);
     // May be get error
     this.m_GObjectValue = clone.gobjectValue;
 }
예제 #5
0
    /// <summary>
    /// SetFunction(string): Sets the current function to a passed string.
    /// </summary>
    /// <param name="sEquation">string representing the function being used</param>
    public void SetFunction(string sEquation)
    {
        m_currentToken = null;
        m_nextToken    = null;

        m_sEquation = sEquation;
        m_Function  = null;
        InitFunctions();
    }
예제 #6
0
파일: modSQL.cs 프로젝트: justdude/DbExport
		public static string InsertValue(CValue item)
		{
			string str = @"INSERT INTO Conf_Dyn_Values(Id, TableId, CollId, RowNumb, Float, String, DateTime, Bool, Int) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')";

			return string.Format(str, item.Id, item.TableId, item.CollumnId, item.RowNumb, 
								 item.FloatValue, item.StrValue,
								 item.DateValue.ToSqlDate(), 
								 item.BoolValue, item.IntValue);
		}
예제 #7
0
파일: modSQL.cs 프로젝트: justdude/DbExport
		public static string UpdateValue(CValue item)
		{
			string str = @"UPDATE Conf_Dyn_Values 
							SET TableId ='{0}', CollId ='{1}', RowNumb ='{2}', 
							Float ='{3}', String ='{4}', DateTime ='{5}', Bool ='{6}', Int ='{7}'
							Where Id='{8}'";

			return string.Format(str, item.TableId, item.CollumnId, item.RowNumb,
								 item.FloatValue, item.StrValue, item.DateValue, item.BoolValue, item.IntValue, item.Id);
		}
예제 #8
0
파일: Engine.cs 프로젝트: justdude/DbExport
		public IEnumerable<CValue> LoadValues()
		{
			List<CValue> list = new List<CValue>();
			CValue item = null;
			SqlCeDataReader reader = null;
			try
			{
				reader = CDatabase.Instance.Execute(modSQL.SelectValues());

				while (reader.Read())
				{
					item = new CValue();
					item.Id = reader.GetClearStr(0);
					item.TableId = reader.GetClearStr(1);
					item.CollumnId = reader.GetClearStr(2);
					item.RowNumb = reader.GetIntSafe(3);

					try
					{
						item.FloatValue = reader.GetFloatSafe(4);
						item.StrValue = reader.GetStringSafe(5);
						item.DateValue = reader.GetDateTimeSafe(6); //reader.GetConvertedDateTime(6);
						item.BoolValue = reader.GetBoolSafe(7);
						item.IntValue = reader.GetIntSafe(8);
					}
					catch(Exception ex)
					{

					}

					item.Status = Status.Normal;

					list.Add(item);
				}

			}
			catch
			{
				if (reader != null)
					reader.Close();
			}
			finally
			{
				if (reader != null && !reader.IsClosed)
					reader.Close();
			}

			return list;
		}
예제 #9
0
 public CGreaterThanEq( CValue arg1, CValue arg2 )
 {
     CheckParms(">=", arg1, arg2);
     m_arg1 = arg1;
     m_arg2 = arg2;
 }
예제 #10
0
 public CEqual( CValue arg1, CValue arg2 )
 {
     CheckParms("= or ==", arg1, arg2);
     m_arg1 = arg1;
     m_arg2 = arg2;
 }
예제 #11
0
            public CAnd( CValue arg1, CValue arg2 )
            {
                CheckParms("&&", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #12
0
        /// <summary>
        /// OpFactor(...): Reads the passed operator, identifies the associated implementation object
        ///		and requests an operation object to be used in evaluating the equation.
        /// </summary>
        /// <param name="oSourceOp">Parser.Token object representing the operator in question.</param>
        /// <param name="oValue1">The first value object to be operated on.</param>
        /// <param name="oValue2">The second value object to be operated on.</param>
        /// <returns>CValue object representing an operation.</returns>
        private CValue OpFactory( Parser.Token oSourceOp, CValue oValue1, CValue oValue2 )
        {
            foreach( COperator oOp in m_aOps )
            {

                if( oOp.IsMatch( oSourceOp ))
                    return oOp.Factory(oValue1, oValue2);
            }

            throw new ApplicationException("Invalid operator in equation.");
        }
예제 #13
0
        /// <summary>
        /// SetFunction(string): Sets the current function to a passed string.
        /// </summary>
        /// <param name="sEquation">string representing the function being used</param>
        public void SetFunction( string sEquation )
        {
            m_currentToken = null;
            m_nextToken = null;

            m_sEquation = sEquation;
            m_Function = null;
            InitFunctions();
        }
예제 #14
0
 public CSubtract( CValue arg1, CValue arg2 )
 {
     CheckParms("-", arg1, arg2);
     m_arg1 = arg1;
     m_arg2 = arg2;
 }
예제 #15
0
            public CPower( CValue arg1, CValue arg2 )
            {
                CheckParms("^", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #16
0
            public COr( CValue arg1, CValue arg2 )
            {
                CheckParms("||", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #17
0
 public override COperator Factory( CValue arg1, CValue arg2)
 {
     return new CLessThan(arg1, arg2);
 }
예제 #18
0
 /// <summary>
 /// CSignNeg constructor:  Grabs onto the assigned
 ///		CValue object and retains it for processing
 ///		requested operations.
 /// </summary>
 /// <param name="oValue">Child operation this object operates upon.</param>
 public CSignNeg( CValue oValue )
 {
     m_oValue = oValue;
 }
예제 #19
0
            public CLessThanEq( CValue arg1, CValue arg2 )
            {
                CheckParms("<=", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #20
0
 public override COperator Factory( CValue arg1, CValue arg2)
 {
     return new CSubtract( arg1, arg2 );
 }
예제 #21
0
            public CMultiply( CValue arg1, CValue arg2 )
            {
                CheckParms("*", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #22
0
 /// <summary>
 /// CheckParms( Parser.Token, CValue) - This method makes certain the single argument is non-null.
 ///		Raises an exception if it is.
 /// </summary>
 /// <param name="oToken">Parser.Token object</param>
 /// <param name="arg1">CValue argument</param>
 private void CheckParms( Parser.Token oToken, CValue arg1 )
 {
     if( arg1 == null )
         throw new ApplicationException("Argument not supplied near " + oToken.ToString() + " operation.");
 }
예제 #23
0
 public override COperator Factory( CValue arg1, CValue arg2)
 {
     return new CMultiply(arg1, arg2);
 }
예제 #24
0
            public CAdd( CValue arg1, CValue arg2 )
            {
                CheckParms("+", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #25
0
 public CNotEqual( CValue arg1, CValue arg2 )
 {
     CheckParms("<> or !=", arg1, arg2);
     m_arg1 = arg1;
     m_arg2 = arg2;
 }
예제 #26
0
            public CDivide( CValue arg1, CValue arg2 )
            {
                CheckParms("/", arg1, arg2);

                m_arg1 = arg1;
                m_arg2 = arg2;
            }
예제 #27
0
 /// <summary>
 /// Factory(CValue, CValue): responsible for providing an evaluation-time object that
 ///		holds onto the CValue objects it is responsible for operating on.
 /// </summary>
 /// <param name="arg1">First CValue object to operate on</param>
 /// <param name="arg2">Second CValue object to operate on</param>
 /// <returns>"Evaluation time" COperator object</returns>
 public abstract COperator Factory( CValue arg1, CValue arg2);
예제 #28
0
 public override COperator Factory( CValue arg1, CValue arg2)
 {
     return new CEqual(arg1, arg2);
 }
예제 #29
0
 /// <summary>
 /// CheckParms( string, CValue, CValue): Helper function that verifies the two arguments
 ///		are non-null objects.  If not, an exception is thrown.
 /// </summary>
 /// <param name="sOp">string representing the operation.</param>
 /// <param name="arg1">CValue object representing the first operation</param>
 /// <param name="arg2">CValue object representing the second oepration</param>
 protected void CheckParms(string sOp, CValue arg1, CValue arg2)
 {
     if( arg1 == null || arg2 == null )
         throw new ApplicationException("Missing expression on " + sOp + " operator.");
 }
예제 #30
0
 public override COperator Factory( CValue arg1, CValue arg2)
 {
     return new CGreaterThanEq(arg1, arg2);
 }
예제 #31
0
        /// <summary>
        /// Compile():  This function kicks off the process to tokenize the function
        ///		and compile the resulting token set into a runnable form.
        /// </summary>
        public void Compile()
        {
            Parser oParser = new Parser(m_sEquation );
            m_enumTokens = oParser.GetTokenEnumerator();

            PositionNextToken();

            m_Function = Relational();
        }