本文整理汇总了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);
}
示例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;
}
示例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;
}
示例4: Log
public void Log(IRule rule, Result result)
{
foreach (IAnalysisLogger logger in Loggers)
{
logger.Log(rule, result);
}
}
示例5: Category
public Category(string title, IRule rule, Turn turn, Dice dice)
{
Title = title;
_rule = rule;
_turn = turn;
_dice = dice;
}
示例6: CumulSameCardBehaviour
public CumulSameCardBehaviour(
IRule[] rules,
Stack<UnoCard> playedCardSet)
{
_cardBehaviourRules = rules;
_playedCardSet = playedCardSet;
}
示例7: SetUp
public void SetUp()
{
_turn = Substitute.For<Turn>();
_dice = Substitute.For<Dice>();
_onesRule = Substitute.For<IRule>();
_category = new Category("Ones", _onesRule, _turn, _dice);
}
示例8: AddRule
protected void AddRule(IRule rule)
{
if (rule == null)
throw new ArgumentNullException ("rule");
_rules.Add (rule);
}
示例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);
}
示例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));
}
}
}
示例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;
}
}
示例12: OrRule
public OrRule(IRule ruleLeft, IRule ruleRigth)
{
Guard.NotNull(ruleLeft, "ruleLeft");
Guard.NotNull(ruleRigth, "ruleRigth");
LeftRule = ruleLeft;
RigthRule = ruleRigth;
}
示例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;
}
示例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;
}
示例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;
}