/// <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"); }
/// <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)); }
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); } }
public SeqRule(IEnumerable <Rule> xs) { Rules.AddRange(xs); // We should at least have two sub-rules Trace.Assert(Rules.Count >= 2); }
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); }
public JsonRunOptions() { Rules.AddRange(new[] { RunOptionsRules.InputFolderDefined, RunOptionsRules.OutputFolderDefined, }); }
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()); }
public DistributedParameter() { Persistable = false; QuantityType = QuantityType.Parameter; Info = new ParameterInfo(); Origin = new ParameterOrigin(); Rules.AddRange(ParameterRules.All()); NegativeValuesAllowed = true; }
public SeqRule(IEnumerable <Rule> xs) { Rules.AddRange(xs); if (Rules.Count < 2) { throw new InvalidOperationException("Expecting two or more rules in a sequence"); } }
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); }
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), }); }
private void init() { Rules.AddRange(new CellLifeRuleList { DefaultCellRuleDefinitions.UnderPopulation, DefaultCellRuleDefinitions.GoodPopulation, DefaultCellRuleDefinitions.OverPopulation, DefaultCellRuleDefinitions.Reproduction }); }
public FormulaUsablePathDTO(IFormulaUsablePath formulaUsablePath, IFormula formula) { FormulaUsablePath = formulaUsablePath; _formula = formula; Rules.AddRange(AllRules.AllDefault()); if (_formula.ObjectPaths.Contains(FormulaUsablePath)) { Rules.Add(AllRules.UniqueNameRule); } }
public MetaDataDTO(IEnumerable <IBusinessRule> validationRules = null) { if (validationRules == null) { validationRules = MetaDataDTORules.All(); } Rules.AddRange(validationRules); NameEditable = true; ValueReadOnly = false; }
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; }
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 }); }
/// <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>(); }
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()); } }
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); }
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); }
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); } }
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 }), }); }
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; }
/// <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);
public IdentificationParameter() { Rules?.AddRange(IdentificationParameterRules.All); }
public void Handle(RulesUpdatedEvent @event) { Rules.Clear(); Rules.AddRange(@event.Rules); Save(); }
public void ResetRules() { Rules.Clear(); Rules.AddRange(_defaultRules); Save(); }
public PopulationSettingsDTO() { Parameters = new Cache <string, ParameterRangeDTO>(x => x.ParameterName); Rules.AddRange(AllRules.All()); }
public BuildingBlockSelectionDTO() { ValidateBuildingBlock = true; Rules.AddRange(AllRules.All()); }