当前位置: 首页>>代码示例>>C#>>正文


C# IRule类代码示例

本文整理汇总了C#中IRule的典型用法代码示例。如果您正苦于以下问题:C# IRule类的具体用法?C# IRule怎么用?C# IRule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRule类属于命名空间,在下文中一共展示了IRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BasicActivation

 /// <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);
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例2: RuleViolation

 /// <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;
 }
开发者ID:divyang4481,项目名称:REM,代码行数:14,代码来源:RuleViolation.cs

示例3: ApplyRules

        /// <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;
        }
开发者ID:vadimostanin,项目名称:CA,代码行数:32,代码来源:RulesLibrary.cs

示例4: Log

 public void Log(IRule rule, Result result)
 {
     foreach (IAnalysisLogger logger in Loggers)
     {
         logger.Log(rule, result);
     }
 }
开发者ID:Microsoft,项目名称:sarif-sdk,代码行数:7,代码来源:AggregatingLogger.cs

示例5: Category

 public Category(string title, IRule rule, Turn turn, Dice dice)
 {
     Title = title;
     _rule = rule;
     _turn = turn;
     _dice = dice;
 }
开发者ID:Gryff,项目名称:yahtzee-kata,代码行数:7,代码来源:Category.cs

示例6: CumulSameCardBehaviour

		public CumulSameCardBehaviour(
			IRule[] rules,
			Stack<UnoCard> playedCardSet)
		{
			_cardBehaviourRules = rules;
			_playedCardSet = playedCardSet;
		}
开发者ID:mathieucans,项目名称:2015.UnoByExample,代码行数:7,代码来源:InterruptionCumuCardBehaviour.cs

示例7: SetUp

 public void SetUp()
 {
     _turn = Substitute.For<Turn>();
     _dice = Substitute.For<Dice>();
     _onesRule = Substitute.For<IRule>();
     _category = new Category("Ones", _onesRule, _turn, _dice);
 }
开发者ID:Gryff,项目名称:yahtzee-kata,代码行数:7,代码来源:CategoryShould.cs

示例8: AddRule

        protected void AddRule(IRule rule)
        {
            if (rule == null)
                throw new ArgumentNullException ("rule");

            _rules.Add (rule);
        }
开发者ID:nomit007,项目名称:MvcCustomizableFormAuthentication,代码行数:7,代码来源:AbstractAutintificateAttribute.cs

示例9: Rank_RuleEngineGotNoRules_ThorwsException

 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);
 }
开发者ID:graylikeme,项目名称:CodeRoom,代码行数:7,代码来源:RuleEngineTest.cs

示例10: GetActivationState

 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));
         }
     }
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:25,代码来源:ModuleActivationChecker.cs

示例11: CreateTask

        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;
            }
        }
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:25,代码来源:BestPracticesBrowserLink.cs

示例12: OrRule

 public OrRule(IRule ruleLeft, IRule ruleRigth)
 {
     Guard.NotNull(ruleLeft, "ruleLeft");
     Guard.NotNull(ruleRigth, "ruleRigth");
     LeftRule = ruleLeft;
     RigthRule = ruleRigth;
 }
开发者ID:OxPatient,项目名称:Rule-Engine,代码行数:7,代码来源:OrRule.cs

示例13: RuleBinding

		/// <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;
		}
开发者ID:RickIsWright,项目名称:nHapi,代码行数:16,代码来源:RuleBinding.cs

示例14: RuleContext

 /// <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;
 }
开发者ID:mattfrerichs,项目名称:Templates,代码行数:12,代码来源:RuleContext.cs

示例15: IsFirend

 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;
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:7,代码来源:RegularExpressionBasedFriendshipMatcher.cs


注:本文中的IRule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。