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


C# Strategy.GetInternalizedUnitRole方法代码示例

本文整理汇总了C#中Strategy.GetInternalizedUnitRole方法的典型用法代码示例。如果您正苦于以下问题:C# Strategy.GetInternalizedUnitRole方法的具体用法?C# Strategy.GetInternalizedUnitRole怎么用?C# Strategy.GetInternalizedUnitRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Strategy的用法示例。


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

示例1: Evaluate

        internal override ThreeValuedLogic Evaluate(Strategy strategy)
        {
            var compareValue = this.compare;

            var compareRole = this.compare as IRoleType;
            if (compareRole != null)
            {
                compareValue = strategy.GetInternalizedUnitRole(compareRole);
            }
            else
            {
                if (this.roleType.ObjectType is IUnit)
                {
                    compareValue = this.roleType.Normalize(this.compare);
                }
            }

            var comparable = strategy.GetInternalizedUnitRole(this.roleType) as IComparable;

            if (comparable == null)
            {
                return ThreeValuedLogic.Unknown;
            }

            return comparable.CompareTo(compareValue) < 0
                       ? ThreeValuedLogic.True
                       : ThreeValuedLogic.False;
        }
开发者ID:whesius,项目名称:allors,代码行数:28,代码来源:RoleLessThan.cs

示例2: Evaluate

        internal override ThreeValuedLogic Evaluate(Strategy strategy)
        {
            var value = strategy.GetInternalizedUnitRole(this.roleType);

            if (value == null)
            {
                return ThreeValuedLogic.Unknown;
            }

            var equalsValue = this.equals;

            if (this.equals is IRoleType)
            {
                var equalsRole = (IRoleType)this.equals;
                equalsValue = strategy.GetInternalizedUnitRole(equalsRole);
            }
            else
            {
                if (this.roleType.ObjectType is IUnit)
                {
                    equalsValue = RoleTypeExtensions.Normalize(this.roleType, [email protected]);
                }
            }

            if (equalsValue == null)
            {
                return ThreeValuedLogic.False;
            }

            return value.Equals(equalsValue)
                       ? ThreeValuedLogic.True
                       : ThreeValuedLogic.False;
        }
开发者ID:whesius,项目名称:allors,代码行数:33,代码来源:RoleUnitEquals.cs

示例3: Evaluate

        internal override ThreeValuedLogic Evaluate(Strategy strategy)
        {
            var firstValue = this.first;
            var secondValue = this.second;

            var firstRole = this.first as IRoleType;
            if (firstRole != null)
            {
                firstValue = strategy.GetInternalizedUnitRole(firstRole);
            }
            else
            {
                if (this.roleType.ObjectType is IUnit)
                {
                    firstValue = this.roleType.Normalize(this.first);
                }
            }

            var secondRole = this.second as IRoleType;
            if (secondRole != null)
            {
                secondValue = strategy.GetInternalizedUnitRole(secondRole);
            }
            else
            {
                if (this.roleType.ObjectType is IUnit)
                {
                    secondValue = this.roleType.Normalize(this.second);
                }
            }

            var comparable = strategy.GetInternalizedUnitRole(this.roleType) as IComparable;

            if (comparable == null)
            {
                return ThreeValuedLogic.Unknown;
            }

            return (comparable.CompareTo(firstValue) >= 0 && comparable.CompareTo(secondValue) <= 0)
                       ? ThreeValuedLogic.True
                       : ThreeValuedLogic.False;
        }
开发者ID:whesius,项目名称:allors,代码行数:42,代码来源:RoleBetween.cs

示例4: Evaluate

        internal override ThreeValuedLogic Evaluate(Strategy strategy)
        {
            var value = (string)strategy.GetInternalizedUnitRole(this.roleType);

            if (value == null)
            {
                return ThreeValuedLogic.Unknown;
            }

            if (this.isEmpty)
            {
                return ThreeValuedLogic.False;
            }

            return this.regex.Match(value).Success
                       ? ThreeValuedLogic.True
                       : ThreeValuedLogic.False;
        }
开发者ID:whesius,项目名称:allors,代码行数:18,代码来源:RoleLike.cs


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