/// <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."); } }
public CPower(CValue arg1, CValue arg2) { CheckParms("^", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public CDivide(CValue arg1, CValue arg2) { CheckParms("/", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
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; }
/// <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(); }
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); }
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); }
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; }
public CGreaterThanEq( CValue arg1, CValue arg2 ) { CheckParms(">=", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public CEqual( CValue arg1, CValue arg2 ) { CheckParms("= or ==", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public CAnd( CValue arg1, CValue arg2 ) { CheckParms("&&", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
/// <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."); }
/// <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(); }
public CSubtract( CValue arg1, CValue arg2 ) { CheckParms("-", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public CPower( CValue arg1, CValue arg2 ) { CheckParms("^", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public COr( CValue arg1, CValue arg2 ) { CheckParms("||", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public override COperator Factory( CValue arg1, CValue arg2) { return new CLessThan(arg1, arg2); }
/// <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; }
public CLessThanEq( CValue arg1, CValue arg2 ) { CheckParms("<=", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public override COperator Factory( CValue arg1, CValue arg2) { return new CSubtract( arg1, arg2 ); }
public CMultiply( CValue arg1, CValue arg2 ) { CheckParms("*", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
/// <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."); }
public override COperator Factory( CValue arg1, CValue arg2) { return new CMultiply(arg1, arg2); }
public CAdd( CValue arg1, CValue arg2 ) { CheckParms("+", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public CNotEqual( CValue arg1, CValue arg2 ) { CheckParms("<> or !=", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
public CDivide( CValue arg1, CValue arg2 ) { CheckParms("/", arg1, arg2); m_arg1 = arg1; m_arg2 = arg2; }
/// <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);
public override COperator Factory( CValue arg1, CValue arg2) { return new CEqual(arg1, arg2); }
/// <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."); }
public override COperator Factory( CValue arg1, CValue arg2) { return new CGreaterThanEq(arg1, arg2); }
/// <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(); }