コード例 #1
0
        public void Add(Entity entity, Simulation simulation, string parameterName, string expression, bool beforeTemperature, bool beforeLoad)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (parameterName == null)
            {
                throw new ArgumentNullException(nameof(parameterName));
            }

            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            if (!SimulationSpecificUpdates.ContainsKey(simulation))
            {
                SimulationSpecificUpdates[simulation] = new Dictionary <Entity, EntityUpdate>();
            }

            if (!SimulationSpecificUpdates[simulation].ContainsKey(entity))
            {
                SimulationSpecificUpdates[simulation][entity] = new EntityUpdate();
            }

            if (beforeLoad)
            {
                SimulationSpecificUpdates[simulation][entity].ParameterUpdatesBeforeLoad.Add(
                    new EntityParameterExpressionValueUpdate()
                {
                    ParameterName = parameterName,
                    Expression    = new DynamicExpression(expression),
                });
            }

            if (beforeTemperature)
            {
                SimulationSpecificUpdates[simulation][entity].ParameterUpdatesBeforeTemperature.Add(new EntityParameterExpressionValueUpdate()
                {
                    Expression    = new DynamicExpression(expression),
                    ParameterName = parameterName,
                });
            }
        }
コード例 #2
0
        public void Add(Entity entity, string parameterName, string expression, bool beforeTemperature, bool beforeLoad)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (parameterName == null)
            {
                throw new ArgumentNullException(nameof(parameterName));
            }

            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            if (!CommonUpdates.ContainsKey(entity))
            {
                CommonUpdates[entity] = new EntityUpdate();
            }

            if (beforeLoad)
            {
                CommonUpdates[entity].ParameterUpdatesBeforeLoad.Add(
                    new EntityParameterExpressionValueUpdate()
                {
                    ParameterName = parameterName,
                    Expression    = new DynamicExpression(expression),
                });
            }

            if (beforeTemperature)
            {
                CommonUpdates[entity].ParameterUpdatesBeforeTemperature.Add(new EntityParameterExpressionValueUpdate()
                {
                    Expression    = new DynamicExpression(expression),
                    ParameterName = parameterName,
                });
            }
        }
コード例 #3
0
        public void Add(IEntity entity, Simulation simulation, string parameterName, double value, bool beforeTemperature, bool beforeLoad)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (simulation == null)
            {
                throw new ArgumentNullException(nameof(simulation));
            }

            if (parameterName == null)
            {
                throw new ArgumentNullException(nameof(parameterName));
            }

            if (!SimulationSpecificUpdates.ContainsKey(simulation))
            {
                SimulationSpecificUpdates[simulation] = new Dictionary <IEntity, EntityUpdate>();
            }

            if (!SimulationSpecificUpdates[simulation].ContainsKey(entity))
            {
                SimulationSpecificUpdates[simulation][entity] = new EntityUpdate();
            }

            if (beforeLoad)
            {
                SimulationSpecificUpdates[simulation][entity].ParameterUpdatesBeforeLoad.Add(new EntityParameterDoubleValueUpdate {
                    ParameterName = parameterName, Value = value
                });
            }

            if (beforeTemperature)
            {
                SimulationSpecificUpdates[simulation][entity].ParameterUpdatesBeforeTemperature.Add(new EntityParameterDoubleValueUpdate {
                    ParameterName = parameterName, Value = value
                });
            }
        }
コード例 #4
0
        public void Add(Entity entity, string parameterName, double value, bool beforeTemperature, bool beforeLoad)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (parameterName == null)
            {
                throw new ArgumentNullException(nameof(parameterName));
            }

            if (!CommonUpdates.ContainsKey(entity))
            {
                CommonUpdates[entity] = new EntityUpdate();
            }

            if (beforeLoad)
            {
                CommonUpdates[entity].ParameterUpdatesBeforeLoad.Add(
                    new EntityParameterDoubleValueUpdate()
                {
                    ParameterName = parameterName,
                    Value         = value,
                });
            }

            if (beforeTemperature)
            {
                CommonUpdates[entity].ParameterUpdatesBeforeTemperature.Add(
                    new EntityParameterDoubleValueUpdate()
                {
                    ParameterName = parameterName, Value = value
                });
            }
        }