public Variable(string technicalName, string defaultValue, VariableDataType dataType, string description)
 {
     this.technicalName = technicalName;
     this.defaultValue  = defaultValue;
     this.dataType      = dataType;
     this.description   = description;
 }
Exemple #2
0
 public Variable()
     : base()
 {
     technicalName = string.Empty;
     defaultValue  = string.Empty;
     dataType      = VariableDataType.Boolean;
 }
        public VariableMetric(
            string variableName,
            VariableDataType dataType = VariableDataType.Double,
            string tableName          = null)
        {
            this.VariableName = variableName;
            this.DataType     = dataType;

            if (tableName == null)
            {
                tableName = variableName.Replace('.', '_');
            }

            this.TableName = tableName;
        }
Exemple #4
0
 public Variable(string mnemonic, VariableDataType variableDataType)
 {
     _mnemonic = mnemonic.ToLower().Trim();
     _variableDataType = variableDataType;
     switch (variableDataType)
     {
         case Business.VariableDataType.Numeric:
             _variableValue = 0.0;
             break;
         case Business.VariableDataType.Boolean:
             _variableValue = true;
             break;
         case Business.VariableDataType.String:
             _variableValue = string.Empty;
             break;
         default:
             break;
     }
 }
Exemple #5
0
            private object[] m_value;             // the values

            public Variable(string variableName, VariableDataType dataType, int numValues)
            {
                m_variableName = variableName;
                m_dataType     = dataType;
                m_value        = new object[numValues];
            }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the Variable class.
 /// </summary>
 /// <param name="variableName">string name of the variable.</param>
 /// <param name="dataType">string type of data for variable.</param>
 /// <param name="numberOfValues">int number for values that the variable contains.</param>
 public Variable(string variableName, VariableDataType dataType, int numberOfValues)
 {
     this.Name     = variableName;
     this.DataType = dataType;
     this.values   = new object[numberOfValues];
 }
Exemple #7
0
 public Variable(string mnemonic, VariableDataType variableDataType, object value)
     : this(mnemonic, variableDataType)
 {
     _variableValue = value;
 }
Exemple #8
0
 public Variable(string technicalName, string defaultValue, VariableDataType dataType)
 {
     this.technicalName = technicalName;
     this.defaultValue = defaultValue;
     this.dataType = dataType;
 }
Exemple #9
0
 public Variable()
     : base()
 {
     technicalName = string.Empty;
     defaultValue = string.Empty;
     dataType = VariableDataType.Boolean;
 }
Exemple #10
0
        /// <summary>
        /// Constructor that accepts a Name, whether Readonly or not, Namespace, Value, Expression and the parent to which the variables needs to be added.
        /// Also, there is a default parameter that accepts the data type
        /// </summary>
        /// <param name="variableName">Name of the variable</param>
        /// <param name="readOnly">whether Readonly or not</param>
        /// <param name="nameSpace">Namespace</param>
        /// <param name="val">Value</param>
        /// <param name="expression">Expression</param>
        /// <param name="parentContainer">Parent Container</param>
        /// <param name="userSpecifiedDataType"> A data type to be specified by the user. Use the VariableDataType enum for accepted values.</param>
        public ISVariable(string variableName, bool readOnly, string nameSpace, object val, string expression, ISContainer parentContainer, VariableDataType userSpecifiedDataType = VariableDataType.String)
        {
            bool variableExists = parentContainer.Variables_m.Contains(variableName);

            if (variableExists)
            {
                Variable = parentContainer.Variables_m[variableName];
            }
            if (!(variableExists))
            {
                switch (userSpecifiedDataType.ToString().ToLower())
                {
                case "boolean":
                    val = Convert.ToBoolean(val);
                    break;

                case "byte":
                    val = Convert.ToByte(val);
                    break;

                case "char":
                    val = Convert.ToChar(val);
                    break;

                case "datetime":
                    val = Convert.ToDateTime(val);
                    break;

                case "decimal":
                    val = Convert.ToDecimal(val);
                    break;

                case "double":
                    val = Convert.ToDouble(val);
                    break;

                case "int16":
                    val = Convert.ToInt16(val);
                    break;

                case "int32":
                    val = Convert.ToInt32(val);
                    break;

                case "int64":
                    val = Convert.ToInt64(val);
                    break;

                case "sbyte":
                    val = Convert.ToSByte(val);
                    break;

                case "single":
                    val = Convert.ToSingle(val);
                    break;

                case "string":
                    val = Convert.ToString(val);
                    break;

                case "uint32":
                    val = Convert.ToUInt32(val);
                    break;

                case "uint64":
                    val = Convert.ToUInt64(val);
                    break;

                default:
                    break;
                }
                Variable                      = parentContainer.Variables_m.Add(variableName, readOnly, nameSpace, val);
                Variable.Expression           = expression;
                Variable.EvaluateAsExpression = String.IsNullOrEmpty(expression) ? false : true;
            }
        }
Exemple #11
0
 private void SetOtherVariables(VariableDataType type, string variableName, long objectID)
 {
     this.variabeleDataType = type;
     this.variableName      = variableName;
     this.objectID          = objectID;
 }
Exemple #12
0
 public UpdateVariableData(VariableDataType type, string variableName, long objectID, Vector2 vector2Value)
 {
     SetOtherVariables(type, variableName, objectID);
     this.variableDataVector2 = vector2Value;
 }
Exemple #13
0
 public UpdateVariableData(VariableDataType type, string variableName, long objectID, string stringValue)
 {
     SetOtherVariables(type, variableName, objectID);
     this.variableDataString = stringValue;
 }
Exemple #14
0
 public UpdateVariableData(VariableDataType type, string variableName, long objectID, float floatValue)
 {
     SetOtherVariables(type, variableName, objectID);
     this.variableDataFloat = floatValue;
 }
Exemple #15
0
 public UpdateVariableData(VariableDataType type, string variableName, long objectID, bool boolValue)
 {
     SetOtherVariables(type, variableName, objectID);
     this.variableDataBool = boolValue;
 }
Exemple #16
0
 /// <summary>
 /// Adds a variable to the Container object.
 /// </summary>
 /// <param name="variableName">The name of hte variable</param>
 /// <param name="readOnly">Whether readonly or not</param>
 /// <param name="nameSpace">The namespace to which the variable belongs to</param>
 /// <param name="val">The value assigned to the Variable</param>
 /// <param name="expression">The expression with the Variable</param>
 /// <param name="userSpecifiedDataType"> A data type to be specified by the user. Use the VariableDataType enum for accepted values.</param>
 /// <returns></returns>
 public ISVariable AddVariable(string variableName, bool readOnly, string nameSpace, object val, string expression, VariableDataType userSpecifiedDataType = VariableDataType.String)
 {
     return(new ISVariable(variableName, readOnly, nameSpace, val, expression, this, userSpecifiedDataType));
 }