本文整理汇总了C#中Strategy.GetCompositeRole方法的典型用法代码示例。如果您正苦于以下问题:C# Strategy.GetCompositeRole方法的具体用法?C# Strategy.GetCompositeRole怎么用?C# Strategy.GetCompositeRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strategy
的用法示例。
在下文中一共展示了Strategy.GetCompositeRole方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
internal override ThreeValuedLogic Evaluate(Strategy strategy)
{
object value = strategy.GetCompositeRole(this.roleType);
if (value == null)
{
return ThreeValuedLogic.False;
}
object equalsValue = this.equals;
if (this.equals is IRoleType)
{
var equalsRole = (IRoleType)this.equals;
equalsValue = strategy.GetCompositeRole(equalsRole);
}
if (equalsValue == null)
{
return ThreeValuedLogic.False;
}
return value.Equals(equalsValue)
? ThreeValuedLogic.True
: ThreeValuedLogic.False;
}
示例2: Evaluate
internal override ThreeValuedLogic Evaluate(Strategy strategy)
{
IObject roleStrategy = strategy.GetCompositeRole(this.roleType);
if (roleStrategy == null)
{
return ThreeValuedLogic.False;
}
return this.containingExtent.Contains(roleStrategy)
? ThreeValuedLogic.True
: ThreeValuedLogic.False;
}
示例3: Evaluate
internal override ThreeValuedLogic Evaluate(Strategy strategy)
{
var containing = new HashSet<IObject>(this.containingEnumerable);
var roleStrategy = strategy.GetCompositeRole(this.roleType);
if (roleStrategy == null)
{
return ThreeValuedLogic.False;
}
return containing.Contains(roleStrategy)
? ThreeValuedLogic.True
: ThreeValuedLogic.False;
}
示例4: Evaluate
internal override ThreeValuedLogic Evaluate(Strategy strategy)
{
var role = strategy.GetCompositeRole(this.roleType);
if (role == null)
{
return ThreeValuedLogic.False;
}
// TODO: Optimize
var roleObjectType = role.Strategy.Class;
if (roleObjectType.Equals(this.objectType))
{
return ThreeValuedLogic.True;
}
var @interface = this.objectType as IInterface;
return (@interface != null && roleObjectType.ExistSupertype(@interface))
? ThreeValuedLogic.True
: ThreeValuedLogic.False;
}