public DBParameter(string name, TypeOfValue typeOfValue, object value, ParameterType sqlType = ParameterType.IN) { this.name = name; this.typeOfValue = typeOfValue; this.value = value; this.sqlType = sqlType; }
public RuleCollection ParseRules() { /** Create a list of rules */ RuleCollection rules = new RuleCollection(); XmlNodeList ruleNode = xmlDoc.GetElementsByTagName("Rule"); foreach (XmlNode r in ruleNode) { /** Conclusion of Rule */ XmlNode conclusionNode = r["Conclusion"]; string attribute = conclusionNode["Attribute"].InnerText; TypeOfValue value = (TypeOfValue)Convert.ToInt32(conclusionNode["Value"].InnerText); Literal conclusion = new Literal(attribute, value); /** Priority of Rule */ decimal priority = decimal.Parse(r["Priority"].InnerText); /** Create a list of conditions */ LiteralCollection conditions = ParseConditions(r); rules.Add(new Rule(rules.Count, conditions, conclusion, priority)); } return(rules); }
private MySqlDbType GetSQLDataType(TypeOfValue typeOfValue) { switch (typeOfValue) { case TypeOfValue.BOOLEAN: return(MySqlDbType.Bit); case TypeOfValue.DATE: return(MySqlDbType.Date); case TypeOfValue.DATETIME: return(MySqlDbType.DateTime); case TypeOfValue.DECIMAL: return(MySqlDbType.Decimal); case TypeOfValue.INTEGER: return(MySqlDbType.Int32); case TypeOfValue.LONG: return(MySqlDbType.Int64); case TypeOfValue.STRING: return(MySqlDbType.VarChar); case TypeOfValue.TEXT: return(MySqlDbType.Text); case TypeOfValue.CHAR: return(MySqlDbType.VarChar); default: return(MySqlDbType.VarChar); } }
public AssertionWrapper Prop(string propertyName) { AssertionWrapper result = new AssertionWrapper(Because, null, "{0}.{1}"._Format(TypeOfValue.Name, propertyName)); PropertyInfo prop = TypeOfValue.GetProperty(propertyName); if (prop != null) { result.Value = prop.GetValue(Value, null); } return(result); }
public Declaration_Statement(TypeOfValue type, Value val_name, Statement st) { _type = type; _val_name = val_name; _st = st; Type = StatementType.Declaration; Compiler.identificators.Add(_val_name._identificator); Compiler.identificatorLines.Add(new Tuple <string, int>(_val_name._identificator, _val_name.Lineno)); if (!Compiler.identificatorValueType.ContainsKey(_val_name._identificator)) { Compiler.identificatorValueType.Add(_val_name._identificator, type); } }
public override TypeOfValue GetValueType() { if (_type == OperationType.UnaryMinus) { TypeOfValue val = _exR.GetValueType(); if (val == TypeOfValue.int_val || val == TypeOfValue.double_val) { return(val); } } if (_type == OperationType.BitwiseComplement) { TypeOfValue val = _exR.GetValueType(); if (val == TypeOfValue.int_val) { return(val); } } if (_type == OperationType.LogicalNegation) { TypeOfValue val = _exR.GetValueType(); if (val == TypeOfValue.bool_val) { return(val); } } if (_type == OperationType.IntConversion) { TypeOfValue val = _exR.GetValueType(); if (val == TypeOfValue.bool_val || val == TypeOfValue.int_val || val == TypeOfValue.double_val) { return(TypeOfValue.int_val); } } if (_type == OperationType.DoubleConversion) { TypeOfValue val = _exR.GetValueType(); if (val == TypeOfValue.bool_val || val == TypeOfValue.int_val || val == TypeOfValue.double_val) { return(TypeOfValue.double_val); } } Console.WriteLine("Wrong type in unary expression" + _type.ToString() + "in line: " + Lineno); Compiler.typeErrors++; return(TypeOfValue.wrong_val); }
public LiteralCollection ParseConditions(XmlNode ruleNode) { /** Create a list of conditions */ LiteralCollection conditions = new LiteralCollection(); foreach (XmlNode node in ruleNode["ConditionList"]) { /** Condition of Rule */ string attribute = node["Attribute"].InnerText; TypeOfValue value = (TypeOfValue)Convert.ToInt32(node["Value"].InnerText); Literal cond = new Literal(attribute, value); conditions.Add(cond); } return(conditions); }
public LiteralCollection ParseFacts() { LiteralCollection facts = new LiteralCollection(); XmlNodeList factNode = xmlDoc.GetElementsByTagName("Fact"); foreach (XmlNode f in factNode) { /** Fact */ string attribute = f["Attribute"].InnerText; TypeOfValue value = (TypeOfValue)Convert.ToInt32(f["Value"].InnerText); Fact fact = new Fact(facts.Count, attribute, value); facts.Add(fact); } return(facts); }
/// <summary> /// Initializes a new instance of the <see cref="Chanel" /> class. /// </summary> /// <param name="id" >The id.</param> /// <param name="key" >The key.</param> /// <param name="direction" >The direction.</param> /// <param name="typeOfValue" >Type of the value.</param> public Chanel(int id, string key, Direction direction, TypeOfValue typeOfValue) { this.Id = id; this.Key = key; this.Direction = direction; this.TypeOfValue = typeOfValue; if (this.TypeOfValue == TypeOfValue.Digital) { this.ValueAnalog = 0; this.ValueDigital = null; } else { this.ValueAnalog = null; this.ValueDigital = false; } this.Gain = 1; this.Offset = 0; }
private static object Cast(Int64 value, TypeOfValue type) { switch (type) { case TypeOfValue.Byte: return((byte)value); case TypeOfValue.Word: return((short)value); case TypeOfValue.Dword: return((int)value); case TypeOfValue.Qword: return(value); case TypeOfValue.IntPtr: return(new IntPtr(value)); default: return(null); } }
/// <summary> /// Sets the raw bytes of the value that this scalar represents. /// </summary> /// <param name="value">The array containing the bytes.</param> /// <param name="offset">The offset into the array at which the value starts.</param> public void SetValue(byte[] value, int offset) { Buffer.BlockCopy(value, offset, m_value, 0, TypeOfValue.GetByteSize()); }
/// <summary> /// Gets the raw bytes of the value that this scalar represents. /// </summary> /// <returns>The value in bytes.</returns> public byte[] GetValue() { return(m_value.BlockCopy(0, TypeOfValue.GetByteSize())); }
public override TypeOfValue GetValueType() { if (_type == OperationType.Assign) { TypeOfValue valL = _exL.GetValueType(); TypeOfValue valR = _exR.GetValueType(); if (_exL.Type == TypeOfValue.identificator) { if (valL == valR) { return(valL); } else if (valL == TypeOfValue.double_val && valR == TypeOfValue.int_val) { return(TypeOfValue.double_val); } } } if (_type == OperationType.BooleanLogicalOr || _type == OperationType.BooleanLogicalAnd) { TypeOfValue valL = _exL.GetValueType(); TypeOfValue valR = _exR.GetValueType(); if (valL == TypeOfValue.int_val && valR == TypeOfValue.int_val) { return(TypeOfValue.int_val); } } if (_type == OperationType.Plus || _type == OperationType.Minus || _type == OperationType.Multiplication || _type == OperationType.Divide) { TypeOfValue valL = _exL.GetValueType(); TypeOfValue valR = _exR.GetValueType(); if (valL == TypeOfValue.int_val && valR == TypeOfValue.int_val) { return(TypeOfValue.int_val); } else if ((valL == TypeOfValue.int_val && valR == TypeOfValue.double_val) || (valL == TypeOfValue.double_val && valR == TypeOfValue.int_val) || (valL == TypeOfValue.double_val && valR == TypeOfValue.double_val)) { return(TypeOfValue.double_val); } } if (_type == OperationType.Equal || _type == OperationType.Inequal || _type == OperationType.GreaterThan || _type == OperationType.GreaterOrEqual || _type == OperationType.LessThan || _type == OperationType.LessOrEqual) { TypeOfValue valL = _exL.GetValueType(); TypeOfValue valR = _exR.GetValueType(); if ((valL == TypeOfValue.int_val || valL == TypeOfValue.double_val) && (valR == TypeOfValue.int_val || valR == TypeOfValue.double_val)) { return(TypeOfValue.bool_val); } } if (_type == OperationType.Equal || _type == OperationType.Inequal) { TypeOfValue valL = _exL.GetValueType(); TypeOfValue valR = _exR.GetValueType(); if (valL == TypeOfValue.bool_val && valR == TypeOfValue.bool_val) { return(TypeOfValue.bool_val); } } if (_type == OperationType.ConditionalOr || _type == OperationType.ConditionalAnd) { TypeOfValue valL = _exL.GetValueType(); TypeOfValue valR = _exR.GetValueType(); if (valL == TypeOfValue.bool_val && valR == TypeOfValue.bool_val) { return(TypeOfValue.bool_val); } } Console.WriteLine("Wrong type in operation expression " + _type.ToString() + " in line: " + Lineno); Compiler.typeErrors++; return(TypeOfValue.wrong_val); }
/// <summary> /// Initializes a new instance of the <see cref="Chanel" /> class. /// </summary> /// <param name="id" >The id.</param> /// <param name="direction" >The direction.</param> /// <param name="typeOfValue" >Type of the value.</param> public Chanel(int id, Direction direction, TypeOfValue typeOfValue) : this(id, "Chanel [0]" + id, direction, typeOfValue) {}
public PointerReader(long baseAddress, int[] offsets, TypeOfValue type) { BaseAddress = baseAddress; Offsets = offsets; Type = type; }
public static Type TypeOf(this TypeOfValue typeOfValue) { return(TypeOfValueEnum.GetTypeOf(typeOfValue)); }