public CumulSameCardBehaviour(
			IRule[] rules,
			Stack<UnoCard> playedCardSet)
		{
			_cardBehaviourRules = rules;
			_playedCardSet = playedCardSet;
		}
Example #2
0
 public Category(string title, IRule rule, Turn turn, Dice dice)
 {
     Title = title;
     _rule = rule;
     _turn = turn;
     _dice = dice;
 }
        public void deleteRule(IRule toDelRule)
        {
            if (toDelRule == null || toDelRule.name == null)
                return;

            this._client.Delete<List<lavalampRuleInfo>>("rule/" + toDelRule.name);
        }
Example #4
0
 public void SetUp()
 {
     _turn = Substitute.For<Turn>();
     _dice = Substitute.For<Dice>();
     _onesRule = Substitute.For<IRule>();
     _category = new Category("Ones", _onesRule, _turn, _dice);
 }
 public void TearDown()
 {
     mealFactory = null;
     output = null;
     dishes = null;
     rule = null;
 }
 public void saveRule(IRule save)
 {
     if (_rules.Contains(save))
         this._client.Put<lavalampRuleInfo>("rule", Mapper.Map<IRule, lavalampRuleInfo>(save));
     else
         this._client.Post<lavalampRuleInfo>("rule", Mapper.Map<IRule, lavalampRuleInfo>(save));
 }
Example #7
0
 public void Log(IRule rule, Result result)
 {
     foreach (IAnalysisLogger logger in Loggers)
     {
         logger.Log(rule, result);
     }
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RuleContext"/> class.
 /// </summary>
 /// <param name="trackedObject">The tracked object.</param>
 /// <param name="rule">The rule to apply.</param>
 public RuleContext(TrackedObject trackedObject, IRule rule)
 {
     TrackedObject = trackedObject;
     Rule = rule;
     Message = rule.ErrorMessage;
     Success = false;
 }
Example #9
0
		/// <summary> Active by default.  
		/// 
		/// </summary>
		/// <param name="theVersion">see {@link #getVersion()}
		/// </param>
		/// <param name="theScope">see {@link #getScope()}
		/// </param>
		/// <param name="theRule">see {@link #getRule()}
		/// </param>
		public RuleBinding(String theVersion, String theScope, IRule theRule)
		{
			myActiveFlag = true;
			myVersion = theVersion;
			myScope = theScope;
			myRule = theRule;
		}
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasicActivation"/> class.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="inx">The inx.</param>
 public BasicActivation(IRule rule, Index inx)
 {
     theRule = rule;
     index = inx;
     timetag = (DateTime.Now.Ticks - 621355968000000000)/10000;
     calculateTime(inx.Facts);
 }
Example #11
0
 public OrRule(IRule ruleLeft, IRule ruleRigth)
 {
     Guard.NotNull(ruleLeft, "ruleLeft");
     Guard.NotNull(ruleRigth, "ruleRigth");
     LeftRule = ruleLeft;
     RigthRule = ruleRigth;
 }
        private void CreateTask(string id, IRule rule, bool success)
        {
            if (_tasks.ContainsKey(id) && success)
            {
                _tasks.Remove(id);
            }
            else if (!success)
            {
                ErrorTask task = new ErrorTask()
                {
                    Document = id,
                    Line = 1,
                    Column = 1,
                    ErrorCategory = rule.Category,
                    Category = TaskCategory.Html,
                    Text = rule.Message,
                };

                AddHierarchyItem(task);

                task.Navigate += rule.Navigate;

                _tasks[id] = task;
            }
        }
Example #13
0
 public void Rank_RuleEngineGotNoRules_ThorwsException()
 {
     var rules = new IRule[] {}; // TODO: Initialize to an appropriate value
     var target = new RuleEngine(rules); // TODO: Initialize to an appropriate value
     Snippet snippet = null; // TODO: Initialize to an appropriate value
     target.Rank(snippet);
 }
 public bool IsFirend(IRule friendCandidate, IRule main){
     var ruleidentity = (string) main.Params[Constants.Meta.CRFriendshipIdentityString, null];
     if (ruleidentity == null){
         return false;
     }
     return Regex.Match(ruleidentity, regex, RegexOptions.Compiled).Success;
 }
 void _ProcessMessages (MessageCollection messages, IRule rule, object target)                                                                 
          {                                                                                                                                            
                  if (messages == RuleSuccess)                                                                                                         
                          return;                                                                                                                      
                                                                                                                                                       
                  Violations.Add (rule, target, messages);                                                                                             
          }              
        protected void AddRule(IRule rule)
        {
            if (rule == null)
                throw new ArgumentNullException ("rule");

            _rules.Add (rule);
        }
        public void WhenNoOrdersAreFoundThenNothingIsReturned()
        {
            rule = new MultipleOrderRule(map, dishes2, output);
            rule.Execute();

            Assert.AreEqual(0, output.Count);
        }
Example #18
0
        /// <summary>
        /// Apply each rule from collection to passed node, while it possible
        /// </summary>
        /// <param name="node"></param>
        /// <param name="rules"></param>
        /// <returns></returns>
        public static INode ApplyRules(INode node, IRule[] rules)
        {
            var current = node;
            string firstRep;

            do
            {
                firstRep = current.ToString();
                foreach (var r in rules)
                {
                    var instances = r.SelectWhere(current);
                    var whereOutputs = instances as WhereOutput[] ?? instances.ToArray();
                    if (instances == null || !whereOutputs.Any())
                        continue;

                    foreach (var roots in whereOutputs.Select(r.Apply).Where(roots => roots != null && roots.Any() && roots[0] != null))
                    {
                        current = roots[0];
                        break;
                    }
                }
            }
            while (firstRep != current.ToString());

            return current;
        }
 public RuleActivationState GetActivationState(IRuleContext context, IRule rule){
     if (AlwaysPassive.Contains(rule.Module())){
         return RuleActivationState.Never();
     }
     if (AlwaysActive.Contains(rule.Module())){
         return RuleActivationState.Always();
     }
     var modules = context.modules();
     if (null == modules){
         if (rule.Module() == "default"){
             return RuleActivationState.Always();
         }
         else{
             return RuleActivationState.Never();
         }
     }
     else{
         if (modules.IsActive(rule.Module())){
             return RuleActivationState.ActiveVersion(GetVersion(context));
         }
         else{
             return RuleActivationState.PassiveVersion(GetVersion(context));
         }
     }
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RuleViolation"/> class.
 /// </summary>
 /// <param name="rule"><see cref="IRule">Rule</see> that caused the violation.</param>
 /// <param name="offendingObject">Object that caused the violation.</param>
 /// <param name="message">Message for the Violation.</param>
 /// <param name="propertyNames">Property names of <paramref name="offendingObject">object</paramref> that caused the rule violation.</param>
 public RuleViolation( IRule rule, object offendingObject, string message, params string[] propertyNames )
 {
     Rule = rule;
     OffendingObject = offendingObject;
     Message = message;
     PropertyNames = propertyNames;
 }
 public TestCaseRuleApplication(TestCase testCase, IRule rule, IViolationScorer scorer)
 {
     _scorer = scorer;
     TestCase = testCase;
     Rule = rule;
     Apply();
 }
Example #22
0
 public void add(IRule rule)
 {
     if(rule.test(semi)!=0)
        {
        Add(rule);
     }
       Rules.Add(rule);
 }
Example #23
0
        public void TestBadRule()
        {
            var rules = new IRule[] {new BadRule(), new FizzRule(), new BuzzRule()};
            var renderer = new FizzBuzzRenderer(rules);

            var output = renderer.FizzBuzzOutput(15);
            Assert.That(output == "FizzBuzz");
        }
Example #24
0
        public void RegisterRules(IRule rulePassed, IRule ruleFailed)
        {
            if (rulePassed == null) throw new ArgumentNullException("rulePassed");
            if (ruleFailed == null) throw new ArgumentNullException("ruleFailed");

            this.RulePassed += new RuleDelegate(rulePassed.Invoke);
            this.RuleFailed += new RuleDelegate(ruleFailed.Invoke);
        }
Example #25
0
 public BrokenRule(IRule rule, object validatedInstance, string propertyKey, string propertyName, object invalidValue)
 {
     this.rule = rule;
     this.validatedInstance = validatedInstance;
     this.propertyKey = propertyKey;
     this.propertyName = propertyName;
     this.invalidValue = invalidValue;
 }
Example #26
0
 public void OtherwiseEval(IRule alternativeRule)
 {
     if (this.rules.Count == 0)
     {
         throw new ArgumentException("You cannot add ElseIf clause without If!");
     }
     this.rules.Last().ElseRules.Add(new RulesChain(alternativeRule));
 }
Example #27
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fuzzyValues">
 /// The fuzzy Values.
 /// </param>
 /// <param name="connectiveAnd">Function for connective and</param>
 /// <param name="degreeOfFulfillment">degree of Fulfillment</param>
 /// <param name="defuzzifier">Defuzzifier</param>
 /// <returns>
 /// New FuzzyAlgorithm
 /// </returns>
 public RuleBuilder(IFuzzyValues fuzzyValues, 
     IGenericElementFromFuzzyElementsFunction connectiveAnd,
     IGenericDegreeOfFulfillmentFunction degreeOfFulfillment,
     IDefuzzifier defuzzifier)
 {
     this.FuzzyAlgorithm = new FuzzyAlgorithm(connectiveAnd, degreeOfFulfillment, defuzzifier);
     this._fuzzyValues = fuzzyValues;
     this._lastRule = new Rule();
 }
Example #28
0
		public Job(string name, IRule rule, int recordId)
		{
			RecordId = recordId;
			Name = name;
			Rule = rule;
			Triggers = new List<MailTrigger>();
			CheckInterval = JobDefaultSettings.CheckInterval;
			FailureSilenceInterval = JobDefaultSettings.FailureSilenceInterval;
		}
Example #29
0
 public PolicyRule(IPolicyStore policyStore, IPolicy policy, IRule rule, bool readOnly)
     : base(rule, readOnly)
 {
     if (policyStore == null)
         throw new Workshare.Policy.Exceptions.ArgumentNullException("policyStore", "Input policy store is null", null);
     
     m_store = policyStore;
     SetPolicy(policy);
 }
        private string ApplyRule(IRule rule, int number)
        {
            if (rule.IsMatch(number))
            {
                return rule.GetResult();
            }

            return "";
        }
 public RuleTimeDecorator(IRule decoratedRule)
 {
     _decoratedRule = decoratedRule;
 }
Example #32
0
 public MainRule(ValuesUpdateRequest request, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(request, this);
     ParentRule = parentRule;
 }
 public IfElseTransformation(IRule <T> rule, ITransformation <T> transformation, ITransformation <T> elseTransformation)
 {
     myRule               = rule;
     myTransformation     = transformation;
     myElseTransformation = elseTransformation;
 }
Example #34
0
        /// <summary>
        ///     Create a decision node
        /// </summary>
        /// <typeparam name="T">Underlying type</typeparam>
        /// <param name="specification">Specification to test</param>
        /// <param name="ifSatisfied">Rule to process if specification is satisfied</param>
        /// <param name="ifNotSatisfied">Rule to process if specification is not satisfied</param>
        /// <returns>New Rule</returns>
        public static IRule <T> Create <T>(ISpecification <T> specification, IRule <T> ifSatisfied, IRule <T> ifNotSatisfied)
        {
            var satisfiedRuleNotNull   = ifSatisfied ?? NoAction <T>();
            var unsatisfiedRuleNotNull = ifNotSatisfied ?? NoAction <T>();

            return(new DecisionRule <T>(specification, satisfiedRuleNotNull, unsatisfiedRuleNotNull));
        }
Example #35
0
 private IEnumerable <String> GetWordsFromRule(IRule rule)
 {
     return(GetWordsFromRuleElements(rule.Elements.Elements));
 }
 public void Setup()
 {
     this.rule = new EndsOnTwoConsonantsRule();
 }
 public StateValidRule(MainRule.ContextModel context, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(context, this);
     ParentRule = parentRule;
 }
Example #38
0
        public string PrintRule(IRule rule)
        {
            if (rule == null)
            {
                return("");
            }
            if (rule.Properties == null)
            {
                return("");
            }
            var ruleAsString = "";

            ruleAsString += $"{(rule as Rule)?.Selector?.GetSelectorAsString()}{{";

            if (rule.Properties is CssString)
            {
                return(ruleAsString + (rule.Properties as CssString)?.Css + "}");
            }
            else
            {
                var type = rule.Properties.GetType();
                foreach (var property in GetCachedProperties(type))
                {
                    string    cssProperty = "";
                    string    cssValue    = "";
                    Attribute?attribute   = null;

                    //Catch Ignore Propertie
                    attribute = GetCachedCustomAttribute(property, typeof(CsIgnoreAttribute));  // property.GetCustomAttribute(typeof(CsIgnoreAttribute));
                    if (attribute != null)
                    {
                        continue;
                    }

                    if (property.Name == "CssString")
                    {
                        ruleAsString += GetCachedGetter(property, _rulePropertiesGetters).Invoke(rule.Properties)?.ToString();//property.GetValue(rule.Properties)?.ToString();
                        continue;
                    }

                    attribute = GetCachedCustomAttribute(property, typeof(CsPropertyAttribute));  //property.GetCustomAttribute(typeof(CsPropertyAttribute));
                    if (attribute != null)
                    {
                        var propAttribute = attribute as CsPropertyAttribute;
                        if (propAttribute != null)
                        {
                            if (propAttribute.IsCssStringProperty)
                            {
                                ruleAsString += GetCachedGetter(property, _rulePropertiesGetters).Invoke(rule.Properties)?.ToString(); //property.GetValue(rule.Properties)?.ToString();
                                continue;
                            }
                            cssProperty = propAttribute.PropertyName;
                        }
                    }
                    else
                    {
                        cssProperty = property.Name;
                    }
                    // getter could return null so check for null before ToString call.
                    cssValue = GetCachedGetter(property, _rulePropertiesGetters).Invoke(rule.Properties)?.ToString(); //property.GetValue(rule.Properties)?.ToString();
                    if (cssValue != null)
                    {
                        ruleAsString += $"{cssProperty.ToLower()}:{(string.IsNullOrEmpty(cssValue) ? "\"\"" : cssValue)};";
                    }
                }
            }
            ruleAsString += "}";
            return(ruleAsString);
        }
 IProjectTree IProjectTree.SetBrowseObjectProperties(IRule browseObjectProperties)
 {
     throw new NotImplementedException();
 }
Example #40
0
        /// <summary>
        /// Calls the appropriate Parsing function based on the element type
        /// </summary>
        private void ProcessChildNodes(SrgsElement srgsElement, IElement parent, IRule rule)
        {
            Type     elementType = srgsElement.GetType();
            IElement child       = null;
            IRule    parentRule  = parent as IRule;
            IItem    parentItem  = parent as IItem;

            if (elementType == typeof(SrgsRuleRef))
            {
                child = ParseRuleRef((SrgsRuleRef)srgsElement, parent);
            }
            else if (elementType == typeof(SrgsOneOf))
            {
                child = ParseOneOf((SrgsOneOf)srgsElement, parent, rule);
            }
            else if (elementType == typeof(SrgsItem))
            {
                child = ParseItem((SrgsItem)srgsElement, parent, rule);
            }
            else if (elementType == typeof(SrgsToken))
            {
                child = ParseToken((SrgsToken)srgsElement, parent);
            }
            else if (elementType == typeof(SrgsNameValueTag))
            {
                child = ParseNameValueTag((SrgsNameValueTag)srgsElement, parent);
            }
            else if (elementType == typeof(SrgsSemanticInterpretationTag))
            {
                child = ParseSemanticTag((SrgsSemanticInterpretationTag)srgsElement, parent);
            }
            else if (elementType == typeof(SrgsSubset))
            {
                child = ParseSubset((SrgsSubset)srgsElement, parent);
            }
            else if (elementType == typeof(SrgsText))
            {
                SrgsText srgsText = (SrgsText)srgsElement;
                string   content  = srgsText.Text;

                // Create the SrgsElement for the text
                IElementText textChild = _parser.CreateText(parent, content);

                // Split it in pieces
                ParseText(parent, content, null, null, -1f);

                if (parentRule != null)
                {
                    _parser.AddElement(parentRule, textChild);
                }
                else
                {
                    if (parentItem != null)
                    {
                        _parser.AddElement(parentItem, textChild);
                    }
                    else
                    {
                        XmlParser.ThrowSrgsException(SRID.InvalidElement);
                    }
                }
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "Unsupported Srgs element");
                XmlParser.ThrowSrgsException(SRID.InvalidElement);
            }

            // if the parent is a one of, then the children must be an Item
            IOneOf parentOneOf = parent as IOneOf;

            if (parentOneOf != null)
            {
                IItem childItem = child as IItem;
                if (childItem != null)
                {
                    _parser.AddItem(parentOneOf, childItem);
                }
                else
                {
                    XmlParser.ThrowSrgsException(SRID.InvalidElement);
                }
            }
            else
            {
                if (parentRule != null)
                {
                    _parser.AddElement(parentRule, child);
                }
                else
                {
                    if (parentItem != null)
                    {
                        _parser.AddElement(parentItem, child);
                    }
                    else
                    {
                        XmlParser.ThrowSrgsException(SRID.InvalidElement);
                    }
                }
            }
        }
Example #41
0
 public void add(IRule rule)
 {
     Rules.Add(rule);
 }
Example #42
0
 private void DeleteRule(IRule parameter)
 {
     state.ImportRules.Remove(parameter);
 }
Example #43
0
 public CliPolicyException(IRule <ICliSpecification> policy, IViolation <ICliSpecification> violation)
     : base($"{policy.Description}: {violation.Description}")
 {
     Policy    = policy;
     Violation = violation;
 }
Example #44
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     DefaultDocumentSettingsRule = new DefaultDocumentSettingsRule(context.Request.CustomerId, rule);
 }
Example #45
0
 public ContextModel(ValuesUpdateRequest parent, IRule rule) : base(parent, rule)
 {
 }
Example #46
0
        public void TestSimpleSearch()
        {
            IRule[] rules = new IRule[] {
                new OsobaId("osobaid:", "ico:"),
                new Holding("holdingprijemce:", "icoprijemce:"),
                new Holding("holdingplatce:", "icoplatce:"),
                new Holding("holdingdodavatel:", "icoprijemce:"),
                new Holding("holdingzadavatel:", "icoplatce:"),
                new Holding(null, "ico:"),

                new TransformPrefixWithValue("ds:", "(prijemce.datovaSchranka:${q} OR platce.datovaSchranka:${q}) ", null),
                new TransformPrefix("dsprijemce:", "prijemce.datovaSchranka:", null),
                new TransformPrefix("dsplatce:", "platce.datovaSchranka:", null),
                new TransformPrefixWithValue("ico:", "(prijemce.ico:${q} OR platce.ico:${q}) ", null),
                new TransformPrefix("icoprijemce:", "prijemce.ico:", null),
                new TransformPrefix("icoplatce:", "platce.ico:", null),
                new TransformPrefix("jmenoprijemce:", "prijemce.nazev:", null),
                new TransformPrefix("jmenoplatce:", "platce.nazev:", null),
                new TransformPrefix("id:", "id:", null),
                new TransformPrefix("idverze:", "id:", null),
                new TransformPrefix("idsmlouvy:", "identifikator.idSmlouvy:", null),
                new TransformPrefix("predmet:", "predmet:", null),
                new TransformPrefix("cislosmlouvy:", "cisloSmlouvy:", null),
                new TransformPrefix("mena:", "ciziMena.mena:", null),
                new TransformPrefix("cenasdph:", "hodnotaVcetneDph:", null),
                new TransformPrefix("cenabezdph:", "hodnotaBezDph:", null),
                new TransformPrefix("cena:", "calculatedPriceWithVATinCZK:", null),
                new TransformPrefix("zverejneno:", "casZverejneni:", "[<>]?[{\\[]+"),
                new TransformPrefix("zverejneno:", "casZverejneni:", "[<>]?[{\\[]+"),
                new TransformPrefixWithValue("zverejneno:", "casZverejneni:[${q} TO ${q}||+1d}", "\\d+"),
                new TransformPrefix("podepsano:", "datumUzavreni:[", "[<>]?[{\\[]+"),
                new TransformPrefixWithValue("podepsano:", "datumUzavreni:${q}", "[<>]?[{\\[]+"),
                new TransformPrefixWithValue("podepsano:", "datumUzavreni:[${q} TO ${q}||+1d}", "\\d+"),
                new TransformPrefix("schvalil:", "schvalil:", null),
                new TransformPrefix("textsmlouvy:", "prilohy.plainTextContent:", null),
                new Smlouva_Chyby(),
            };

            Assert.AreEqual <string>("cpv:15,16",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("cpv:15,16", rules).FullQuery());

            Assert.AreEqual <string>("( ( ( prijemce.ico:04711157 OR platce.ico:04711157 ) ) OR ( ( prijemce.ico:02795281 OR platce.ico:02795281 ) ) OR ( ( prijemce.ico:04156528 OR platce.ico:04156528 ) ) OR ( ( prijemce.ico:25854631 OR platce.ico:25854631 ) ) OR ( ( prijemce.ico:27233545 OR platce.ico:27233545 ) ) OR ( ( prijemce.ico:28275918 OR platce.ico:28275918 ) ) OR ( ( prijemce.ico:29010969 OR platce.ico:29010969 ) ) OR ( ( prijemce.ico:08178607 OR platce.ico:08178607 ) ) OR ( ( prijemce.ico:05965527 OR platce.ico:05965527 ) ) OR ( ( prijemce.ico:27169685 OR platce.ico:27169685 ) ) OR ( ( prijemce.ico:04096908 OR platce.ico:04096908 ) ) )",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("osobaId:michal-blaha-2", rules).FullQuery());

            Assert.AreEqual <string>("( prijemce.ico:00551023 OR platce.ico:00551023 ) AND ( prijemce.ico:27233545 OR platce.ico:27233545 )",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("ico:00551023 AND ico:27233545", rules).FullQuery());

            Assert.AreEqual <string>("( prijemce.ico:27233545 OR platce.ico:27233545 ) nalezení částí systému s nízkou výkonností",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("ico:27233545  nalezení částí systému s nízkou výkonností", rules).FullQuery());

            Assert.AreEqual <string>("( prijemce.ico:27233545 OR platce.ico:27233545 ) \"nalezení částí systému s nízkou výkonností\"",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("ico:27233545  \"nalezení částí systému s nízkou výkonností\"", rules).FullQuery());

            Assert.AreEqual <string>("( prijemce.ico:27233545 OR platce.ico:27233545 ) classification.types.typeValue:10005",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("ico:27233545 classification.types.typeValue:10005", rules).FullQuery());


            Assert.AreEqual <string>("( prijemce.ico:27233545 OR platce.ico:27233545 ) calculatedPriceWithVATinCZK:>2000 NEN",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("ico:27233545 cena:>2000 NEN", rules).FullQuery());

            Assert.AreEqual <string>("( ( ( prijemce.ico:04711157 OR platce.ico:04711157 ) ) OR ( ( prijemce.ico:02795281 OR platce.ico:02795281 ) ) OR ( ( prijemce.ico:04156528 OR platce.ico:04156528 ) ) OR ( ( prijemce.ico:25854631 OR platce.ico:25854631 ) ) OR ( ( prijemce.ico:27233545 OR platce.ico:27233545 ) ) OR ( ( prijemce.ico:28275918 OR platce.ico:28275918 ) ) OR ( ( prijemce.ico:29010969 OR platce.ico:29010969 ) ) OR ( ( prijemce.ico:08178607 OR platce.ico:08178607 ) ) OR ( ( prijemce.ico:05965527 OR platce.ico:05965527 ) ) OR ( ( prijemce.ico:27169685 OR platce.ico:27169685 ) ) OR ( ( prijemce.ico:04096908 OR platce.ico:04096908 ) ) ) AND casZverejneni:[2012-12-01 TO 2019-12-10] 2229001\\/0710",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("osobaid:michal-blaha-2 AND zverejneno:[2012-12-01 TO 2019-12-10] 2229001/0710", rules).FullQuery());


            Assert.AreEqual <string>("datumUzavreni:[2019-01-01 TO 2019-01-01||+1d}",
                                     Searching.SimpleQueryCreator.GetSimpleQuery("podepsano:2019-01-01", rules).FullQuery());
        }
Example #47
0
 public ContextModel(int parent, IRule rule) : base(parent, rule)
 {
 }
Example #48
0
 public RulesBundle(ContextModel context, IRule rule)
 {
     AddressResourceRule = new ResourceRule <Olma.Address>(context.Request.Key, rule);
 }
Example #49
0
 /// <summary>
 ///     Create rule that operates on each member of a collection
 /// </summary>
 /// <typeparam name="T">Type of item in collection</typeparam>
 /// <param name="rule">Rule to call for each item</param>
 /// <returns>New Rule</returns>
 public static IRule <IEnumerable <T> > CreateForeach <T>(IRule <T> rule)
 {
     return(rule != null ? new ForeachRule <T>(rule) : new NoActionRule <IEnumerable <T> >() as IRule <IEnumerable <T> >);
 }
            public IProjectTree SetProperties(string caption = null, string filePath = null, IRule browseObjectProperties = null, ProjectImageMoniker icon = null, ProjectImageMoniker expandedIcon = null, bool?visible = default(bool?), ProjectTreeFlags?flags = default(ProjectTreeFlags?), IProjectPropertiesContext context = null, IPropertySheet propertySheet = null, bool?isLinked = default(bool?), bool resetFilePath = false, bool resetBrowseObjectProperties = false, bool resetIcon = false, bool resetExpandedIcon = false)
            {
                if (caption != null)
                {
                    Caption = caption;
                }

                if (filePath != null)
                {
                    FilePath = filePath;
                }

                if (visible != null)
                {
                    Visible = visible.Value;
                }

                if (flags != null)
                {
                    Flags = flags.Value;
                }

                return(this);
            }
Example #51
0
 /// <summary>
 ///     Add a follow on rule to be processed after this one
 /// </summary>
 /// <param name="firstRule">First rule in chain</param>
 /// <param name="followOnRule">Rule to process after first one</param>
 /// <returns>New rule representing this follewed by other</returns>
 public static IRule <T> FollowOn <T>(this IRule <T> firstRule, IRule <T> followOnRule)
 {
     return(MultipleRules <T> .Create(firstRule, followOnRule));
 }
Example #52
0
 public Discount3For2(IRule <Phonecall, decimal> priceCalculator)
 {
     this.priceCalculator = priceCalculator;
 }
Example #53
0
 public static IRule <T> WithValidationMessage <T>(this IRule <T> rule, string message)
 {
     rule.ValidationMessage = new ValidationMessage(message);
     return(rule);
 }
Example #54
0
 public ContextModel(CustomerDivisionCreateRequest parent, IRule rule) : base(parent, rule)
 {
 }
Example #55
0
 /**
  * Constructor.
  * @param rule1 a trading rule
  * @param rule2 another trading rule
  */
 public OrRule(IRule rule1, IRule rule2)
 {
     _rule1 = rule1;
     _rule2 = rule2;
 }
Example #56
0
 public MainRule(CustomerDivisionCreateRequest request, IRule parentRule = null)
 {
     // Create Context
     Context    = new ContextModel(request, this);
     ParentRule = parentRule;
 }
Example #57
0
        /// <summary>
        /// Traces the rule and extract the RequiredValue properties from all IsRule.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rule"></param>
        /// <returns></returns>
        public static IEnumerable <T> GetReferenceValues <T>(this IRule <T> rule)
        {
            IEnumerable <T> result = rule.GetRules().OfType <IReferenceValueRule <T> >().Select(x => x.ReferenceValue);

            return(result);
        }
Example #58
0
 protected virtual IEnumerable <TData> ApplyRule(IRule <TData, TOffset> rule, int index, TData input)
 {
     return(rule.Apply(input));
 }
 IOneOf IElementFactory.CreateOneOf(IElement parent, IRule rule)
 {
     return(new OneOf((Rule)rule, _backend));
 }
 public void UpdateRule(int handle, IRule rule)
 {
     UpsertRule(rule, ref handle);
 }