コード例 #1
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     Rules.AddRange(storage.GetValue <IList <AlertRule> >("Rules"));
     AlertType = storage.GetValue <string>("AlertType").To <AlertTypes?>();
     Caption   = storage.GetValue <string>("Caption");
     Message   = storage.GetValue <string>("Message");
 }
コード例 #2
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     Rules.AddRange(storage.GetValue <IList <AlertRule> >(nameof(Rules)));
     AlertType = storage.GetValue <string>(nameof(AlertType)).To <AlertTypes?>();
     Caption   = storage.GetValue <string>(nameof(Caption));
     Message   = storage.GetValue <string>(nameof(Message));
 }
コード例 #3
0
ファイル: Rule.cs プロジェクト: PLCnext/PLCnext_CLI
        public override void FlattenRules()
        {
            base.FlattenRules();

            while (true)
            {
                List <Rule> tmp = new List <Rule>();
                foreach (Rule r in Rules)
                {
                    if (r is SeqRule && r.IsUnnamed())
                    {
                        tmp.AddRange(r.GetRules());
                    }
                    else
                    {
                        tmp.Add(r);
                    }
                }
                if (Rules.Count == tmp.Count)
                {
                    return;
                }
                Rules.Clear();
                Rules.AddRange(tmp);
            }
        }
 /// <summary>
 ///
 /// </summary>
 public virtual void AddRule(IEnumerable <IValidate> validators)
 {
     if (validators != null)
     {
         Rules.AddRange(validators);
     }
 }
コード例 #5
0
ファイル: Rule.cs プロジェクト: PLCnext/PLCnext_CLI
        public SeqRule(IEnumerable <Rule> xs)
        {
            Rules.AddRange(xs);

            // We should at least have two sub-rules
            Trace.Assert(Rules.Count >= 2);
        }
コード例 #6
0
ファイル: Grammar.cs プロジェクト: luobolong/SLR1-parser
        private void readFile(string filename)
        {
            string json = File.ReadAllText(filename);

            Rules.AddRange(Rule.FromJson(json));

            List <Symbol> temp = new List <Symbol>();

            // 找出所有的符号
            foreach (var rule in Rules)
            {
                temp.Add(rule.Left);
                temp.AddRange(rule.Right);
            }
            Symbols.AddRange(temp.Distinct().ToList());
            foreach (var sym in Symbols)
            {
                if (sym.Type == "N")
                {
                    N_Symbols.Add(sym);
                }
                if (sym.Type == "V")
                {
                    V_Symbols.Add(sym);
                }
            }
            Symbols.Add(D);
        }
コード例 #7
0
 public JsonRunOptions()
 {
     Rules.AddRange(new[]
     {
         RunOptionsRules.InputFolderDefined,
         RunOptionsRules.OutputFolderDefined,
     });
 }
コード例 #8
0
ファイル: ValuePointDTO.cs プロジェクト: valdiman/PK-Sim
 public ValuePointDTO(IParameter parameter, TableFormula tableFormula, ValuePoint point)
 {
     _parameter    = parameter;
     _tableFormula = tableFormula;
     X             = convertToDisplayUnit(tableFormula.XDimension, tableFormula.XDisplayUnit, point.X);
     Y             = convertToDisplayUnit(tableFormula.Dimension, tableFormula.YDisplayUnit, point.Y);
     Rules.AddRange(AllRules.All());
 }
コード例 #9
0
 public DistributedParameter()
 {
     Persistable  = false;
     QuantityType = QuantityType.Parameter;
     Info         = new ParameterInfo();
     Origin       = new ParameterOrigin();
     Rules.AddRange(ParameterRules.All());
     NegativeValuesAllowed = true;
 }
コード例 #10
0
        public SeqRule(IEnumerable <Rule> xs)
        {
            Rules.AddRange(xs);

            if (Rules.Count < 2)
            {
                throw new InvalidOperationException("Expecting two or more rules in a sequence");
            }
        }
コード例 #11
0
        public FanControlConfigValidator()
        {
            var rules = typeof(IValidationRule <FanControlConfigV2>)?.Assembly
                        .GetTypes()
                        .Where(x => x.IsClass && typeof(IValidationRule <FanControlConfigV2>).IsAssignableFrom(x))
                        .Select(x => (IValidationRule <FanControlConfigV2>)Activator.CreateInstance(x));

            Rules.AddRange(rules);
        }
コード例 #12
0
        public ExtendedDynamicTileBrushClass()
        {
            // See brush overlay image for intepretation of tile at each coordinate
            Rules.AddRange(new DynamicBrushRule[] {
                new DynamicBrushRule(0, new int[] { 4, 5, 6 }),
                new DynamicBrushRule(1, new int[] { 4, 5, 6, 7, 8 }),
                new DynamicBrushRule(2, new int[] { 6, 7, 8 }),
                new DynamicBrushRule(3, new int[] { 2, 3, 4, 5, 6, 7, 8 }),
                new DynamicBrushRule(4, new int[] { 2, 6, 7, 8 }),
                new DynamicBrushRule(5, new int[] { 4, 5, 6, 8 }),
                new DynamicBrushRule(6, new int[] { 2, 8 }),
                new DynamicBrushRule(7, new int[] { 2, 3, 4, 5, 6, 8 }),
                new DynamicBrushRule(8, new int[] { 2, 6, 8 }),
                new DynamicBrushRule(9, new int[] { 2, 4, 5, 6, 8 }),
                new DynamicBrushRule(10, new int[] { 6 }),
                new DynamicBrushRule(11, new int[] { 2, 6 }),

                new DynamicBrushRule(12, new int[] { 2, 3, 4, 5, 6 }),
                new DynamicBrushRule(13, new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }),
                new DynamicBrushRule(14, new int[] { 1, 2, 6, 7, 8 }),
                new DynamicBrushRule(15, new int[] { 1, 2, 3, 4, 5, 6, 8 }),
                new DynamicBrushRule(16, new int[] { 1, 2, 6, 8 }),
                new DynamicBrushRule(17, new int[] { 2, 3, 4, 8 }),
                new DynamicBrushRule(18, new int[] { 6, 8 }),
                new DynamicBrushRule(19, new int[] { 1, 2, 4, 6, 7, 8 }),
                new DynamicBrushRule(20, new int[] { 2, 4, 6 }),
                new DynamicBrushRule(21, new int[] { 2, 3, 4, 6, 8 }),
                new DynamicBrushRule(22, new int[] { 2 }),
                new DynamicBrushRule(23, new int[] { 4, 8 }),

                new DynamicBrushRule(24, new int[] { 2, 3, 4 }),
                new DynamicBrushRule(25, new int[] { 1, 2, 3, 4, 8 }),
                new DynamicBrushRule(26, new int[] { 1, 2, 8 }),
                new DynamicBrushRule(27, new int[] { 1, 2, 4, 5, 6, 7, 8 }),
                new DynamicBrushRule(28, new int[] { 2, 4, 5, 6 }),
                new DynamicBrushRule(29, new int[] { 4, 6, 7, 8 }),
                new DynamicBrushRule(30, new int[] { 2, 4 }),
                new DynamicBrushRule(31, new int[] { 2, 4, 5, 6, 7, 8 }),
                new DynamicBrushRule(32, new int[] { 2, 4, 8 }),
                new DynamicBrushRule(33, new int[] { 1, 2, 4, 6, 8 }),
                new DynamicBrushRule(34, new int[] { 4 }),
                new DynamicBrushRule(35, new int[] { 2, 4, 6, 8 }),

                new DynamicBrushRule(37, new int[] { 2, 3, 4, 6, 7, 8 }),
                new DynamicBrushRule(38, new int[] { 1, 2, 4, 5, 6, 8 }),
                new DynamicBrushRule(39, new int[] { 1, 2, 3, 4, 6, 7, 8 }),
                new DynamicBrushRule(40, new int[] { 2, 3, 4, 6 }),
                new DynamicBrushRule(41, new int[] { 1, 2, 4, 8 }),
                new DynamicBrushRule(42, new int[] { 4, 6 }),
                new DynamicBrushRule(43, new int[] { 1, 2, 3, 4, 6, 8 }),
                new DynamicBrushRule(44, new int[] { 4, 6, 8 }),
                new DynamicBrushRule(45, new int[] { 2, 4, 6, 7, 8 }),
                new DynamicBrushRule(46, new int[] { 8 }),
                new DynamicBrushRule(47),
            });
        }
コード例 #13
0
ファイル: DefaultEngine.cs プロジェクト: Prinsn/GameOfLife
 private void init()
 {
     Rules.AddRange(new CellLifeRuleList
     {
         DefaultCellRuleDefinitions.UnderPopulation,
         DefaultCellRuleDefinitions.GoodPopulation,
         DefaultCellRuleDefinitions.OverPopulation,
         DefaultCellRuleDefinitions.Reproduction
     });
 }
コード例 #14
0
 public FormulaUsablePathDTO(IFormulaUsablePath formulaUsablePath, IFormula formula)
 {
     FormulaUsablePath = formulaUsablePath;
     _formula          = formula;
     Rules.AddRange(AllRules.AllDefault());
     if (_formula.ObjectPaths.Contains(FormulaUsablePath))
     {
         Rules.Add(AllRules.UniqueNameRule);
     }
 }
コード例 #15
0
        public MetaDataDTO(IEnumerable <IBusinessRule> validationRules = null)
        {
            if (validationRules == null)
            {
                validationRules = MetaDataDTORules.All();
            }

            Rules.AddRange(validationRules);
            NameEditable  = true;
            ValueReadOnly = false;
        }
コード例 #16
0
 public Parameter()
 {
     Persistable  = false;
     BuildMode    = ParameterBuildMode.Local;
     QuantityType = QuantityType.Parameter;
     Info         = new ParameterInfo();
     Icon         = IconNames.PARAMETER;
     Origin       = new ParameterOrigin();
     Rules.AddRange(ParameterRules.All());
     NegativeValuesAllowed = true;
 }
コード例 #17
0
 public BinSizeGroupingDTO()
 {
     NumberOfBins  = 3;
     NamingPattern = LabelGenerationOptions.DEFAULT_NAMING_PATTERN;
     Labels        = new NotifyList <GroupingItemDTO>();
     Strategy      = LabelGenerationStrategies.Numeric;
     Symbol        = Symbols.Circle;
     StartColor    = PKSimColors.StartGroupingColor;
     EndColor      = PKSimColors.EndGroupingColor;
     Rules.AddRange(new[] { atLeastTwoBins, maximumOfBins });
 }
コード例 #18
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Settings storage.</param>
        public void Load(SettingsStorage storage)
        {
            Rules.Clear();
            Rules.AddRange(storage.GetValue <SettingsStorage[]>(nameof(Rules)).Select(s => s.Load <AlertRule>()).Where(r => r.Value != null));

            AlertType   = storage.GetValue <string>(nameof(AlertType)).To <AlertNotifications?>();
            Caption     = storage.GetValue <string>(nameof(Caption));
            Message     = storage.GetValue <string>(nameof(Message));
            IsEnabled   = storage.GetValue(nameof(IsEnabled), IsEnabled);
            Id          = storage.GetValue <Guid>(nameof(Id));
            MessageType = storage.GetValue <string>(nameof(MessageType)).To <Type>();
        }
コード例 #19
0
        public EqualityTester(T targetObject)
        {
            TargetObject = targetObject;
            Analysis     = TypeAnalysis <T> .Analyze();

            Rules.AddRange(Analysis.TypeLevelRules);

            if (!typeof(T).IsValueType)
            {
                Rules.AddRange(Analysis.GetNotEqualRules(TargetObject, default(T), "inequality to null"));
                Rules.AddRange(Analysis.GetEqualityOfTwoNulls());
            }
        }
コード例 #20
0
        public RulesEvaluator EvalMany(IEnumerable <IRule> rules)
        {
            var rulesList     = rules.ToList();
            var filteredRules = rulesList.Where(r => r != null);

            if (rulesList.Contains(null))
            {
                Rules.Add(new InvalidRule());
            }

            Rules.AddRange(filteredRules);

            return(this);
        }
コード例 #21
0
ファイル: Grammar.cs プロジェクト: do9core/SLR1
        public Grammar(string filename)
        {
            var json = File.ReadAllText(filename);

            Rules.AddRange(Rule.FromJson(json));

            List <Symbol> temp = new List <Symbol>();

            foreach (var rule in Rules)
            {
                temp.Add(rule.Define);
                temp.AddRange(rule.Expression);
            }
            Symbols.AddRange(temp.Distinct().ToList());
            Symbols.Add(Grammar.S);
        }
コード例 #22
0
        public RuleService()
        {
            var ironRulesPath = Path.Combine("IronSworn","GameRules.json");
            var starRulesPath = Path.Combine("StarForged", "GameRules.json");
            if (File.Exists(ironRulesPath))
            {
                var root = JsonConvert.DeserializeObject<Rootobject>(File.ReadAllText(ironRulesPath));
                Rules.AddRange(root.MovesReference);
            }

            if (File.Exists(starRulesPath))
            {
                var root = JsonConvert.DeserializeObject<Rootobject>(File.ReadAllText(starRulesPath));
                Rules.AddRange(root.MovesReference);
            }
        }
コード例 #23
0
 public BasicDynamicTileBrushClass()
 {
     // See brush overlay image for intepretation of tile at each coordinate
     Rules.AddRange(new DynamicBrushRule[] {
         new DynamicBrushRule(0, new int[] { 4, 5, 6 }),
         new DynamicBrushRule(1, new int[] { 4, 5, 6, 7, 8 }),
         new DynamicBrushRule(2, new int[] { 6, 7, 8 }),
         new DynamicBrushRule(3, new int[] { 2, 3, 4, 5, 6, 7, 8 }),
         new DynamicBrushRule(4, new int[] { 2, 3, 4, 5, 6 }),
         new DynamicBrushRule(5, new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }),
         new DynamicBrushRule(6, new int[] { 1, 2, 6, 7, 8 }),
         new DynamicBrushRule(7, new int[] { 1, 2, 4, 5, 6, 7, 8 }),
         new DynamicBrushRule(8, new int[] { 2, 3, 4 }),
         new DynamicBrushRule(9, new int[] { 1, 2, 3, 4, 8 }),
         new DynamicBrushRule(10, new int[] { 1, 2, 8 }),
         new DynamicBrushRule(11, new int[] { 1, 2, 3, 4, 5, 6, 8 }),
         new DynamicBrushRule(13, new int[] { 1, 2, 4, 5, 6, 8 }),
         new DynamicBrushRule(14, new int[] { 2, 3, 4, 6, 7, 8 }),
         new DynamicBrushRule(15, new int[] { 1, 2, 3, 4, 6, 7, 8 }),
     });
 }
コード例 #24
0
ファイル: UserSettings.cs プロジェクト: valdiman/PK-Sim
        public UserSettings(DockManager dockManager, RibbonBarManager ribbonManager, INumericFormatterOptions numericFormatterOptions,
                            ISkinManager skinManager, IPKSimConfiguration configuration, DirectoryMapSettings directoryMapSettings)
        {
            _dockManager             = dockManager;
            _ribbonManager           = ribbonManager;
            _numericFormatterOptions = numericFormatterOptions;
            _skinManager             = skinManager;
            _directoryMapSettings    = directoryMapSettings;

            DisplayUnits     = new DisplayUnitsManager();
            ComparerSettings = new ComparerSettings {
                CompareHiddenEntities = false
            };
            ProjectFiles = new List <string>();
            Rules.AddRange(AllRules.All());
            DiagramOptions            = new DiagramOptions();
            TemplateDatabasePath      = configuration.DefaultTemplateUserDatabasePath;
            JournalPageEditorSettings = new JournalPageEditorSettings();
            ParameterIdentificationFeedbackEditorSettings = new ParameterIdentificationFeedbackEditorSettings();
            SensitivityAnalysisFeedbackEditorSettings     = new SensitivityAnalysisFeedbackEditorSettings();
            ResetToDefault();
            _layoutWasExplicitelyReset = false;
        }
コード例 #25
0
 /// <summary>
 /// Adds a bunch of lexing rules to the <see cref="Lexer{TokenType}" />.
 /// </summary>
 /// <param name="newRules">The rules to add.</param>
 public void AddRules(IEnumerable <LexerRule <TokenType> > newRules)
 => Rules.AddRange(newRules);
コード例 #26
0
 public IdentificationParameter()
 {
     Rules?.AddRange(IdentificationParameterRules.All);
 }
コード例 #27
0
ファイル: RuleService.cs プロジェクト: tomtangrx/Papercut
 public void Handle(RulesUpdatedEvent @event)
 {
     Rules.Clear();
     Rules.AddRange(@event.Rules);
     Save();
 }
コード例 #28
0
 public void ResetRules()
 {
     Rules.Clear();
     Rules.AddRange(_defaultRules);
     Save();
 }
コード例 #29
0
 public PopulationSettingsDTO()
 {
     Parameters = new Cache <string, ParameterRangeDTO>(x => x.ParameterName);
     Rules.AddRange(AllRules.All());
 }
コード例 #30
0
 public BuildingBlockSelectionDTO()
 {
     ValidateBuildingBlock = true;
     Rules.AddRange(AllRules.All());
 }