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


C# CubeFlag.HasFlag方法代码示例

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


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

示例1: FirstNotInvalidFlag

 /// <summary>
 /// Returns the first flag in the first parameter which the second parameter does not contain
 /// </summary>
 /// <param name="flags">Defines the posiible flags to be returned</param>
 /// <param name="invalid">Defines the invalid flags</param>
 /// <returns></returns>
 public static CubeFlag FirstNotInvalidFlag(CubeFlag flags, CubeFlag invalid)
 {
     foreach (CubeFlag f in GetFlags(flags))
       {
     if (!invalid.HasFlag(f))
       return f;
       }
       return CubeFlag.None;
 }
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver,代码行数:15,代码来源:CubeFlagService.cs

示例2: ExceptFlag

 /// <summary>
 /// Returns a ClubFlag which contains all single flags in the first parameter which don't exist in the second parameter
 /// </summary>
 /// <param name="flags">Defines all possible flags</param>
 /// <param name="invalid">Defines the flags to be filtered out of the first parameter</param>
 /// <returns></returns>
 public static CubeFlag ExceptFlag(CubeFlag flags, CubeFlag invalid)
 {
     CubeFlag pos = CubeFlag.None;
       foreach (CubeFlag p in GetFlags(flags))
       {
     if (!invalid.HasFlag(p))
       pos |= p;
       }
       return pos;
 }
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver,代码行数:16,代码来源:CubeFlagService.cs

示例3: CommonFlags

 /// <summary>
 /// Returns a CubeFlag which contains all flags which exist in both the first and the second parameter
 /// </summary>
 /// <param name="first">Defines the first CubeFlag</param>
 /// <param name="second">Defines the second CubeFlag</param>
 /// <returns></returns>
 public static CubeFlag CommonFlags(CubeFlag first, CubeFlag second)
 {
     CubeFlag commonFlags = CubeFlag.None;
       foreach (CubeFlag flag in GetFlags(first))
       {
     if (second.HasFlag(flag))
       commonFlags |= flag;
       }
       return commonFlags;
 }
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver,代码行数:16,代码来源:CubeFlagService.cs

示例4: ToNotationString

        /// <summary>
        /// Converts the given CubeFlag into a notation string
        /// </summary>
        public static string ToNotationString(CubeFlag flag)
        {
            var notation = string.Empty;

            if (flag.HasFlag(CubeFlag.TopLayer)) notation += "U";
            if (flag.HasFlag(CubeFlag.BottomLayer)) notation += "D";
            if (flag.HasFlag(CubeFlag.FrontSlice)) notation += "F";
            if (flag.HasFlag(CubeFlag.RightSlice)) notation += "R";
            if (flag.HasFlag(CubeFlag.BackSlice)) notation += "B";
            if (flag.HasFlag(CubeFlag.LeftSlice)) notation += "L";
            if (flag.HasFlag(CubeFlag.MiddleSlice)) notation += "S";
            if (flag.HasFlag(CubeFlag.MiddleSliceSides)) notation += "M";
            if (flag.HasFlag(CubeFlag.MiddleLayer)) notation += "E";

            return notation;
        }
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver_Bewerkt,代码行数:19,代码来源:CubeFlagService.cs

示例5: CommonFlags

 /// <summary>
 /// Returns a CubeFlag which contains all flags which exist in both the first and the second parameter
 /// </summary>
 /// <param name="first">Defines the first CubeFlag</param>
 /// <param name="second">Defines the second CubeFlag</param>
 /// <returns></returns>
 public static CubeFlag CommonFlags(CubeFlag first, CubeFlag second) => GetFlags(first).Cast<CubeFlag>().Where(flag => second.HasFlag(flag)).Aggregate(CubeFlag.None, (current, flag) => current | flag);
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver_Bewerkt,代码行数:7,代码来源:CubeFlagService.cs

示例6: ExceptFlag

 /// <summary>
 /// Returns a ClubFlag which contains all single flags in the first parameter which don't exist in the second parameter
 /// </summary>
 /// <param name="flags">Defines all possible flags</param>
 /// <param name="invalid">Defines the flags to be filtered out of the first parameter</param>
 /// <returns></returns>
 public static CubeFlag ExceptFlag(CubeFlag flags, CubeFlag invalid) => (from CubeFlag p in GetFlags(flags) where !invalid.HasFlag(p) select p).Aggregate(CubeFlag.None, (current, p) => current | p);
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver_Bewerkt,代码行数:7,代码来源:CubeFlagService.cs

示例7: FirstNotInvalidFlag

 /// <summary>
 /// Returns the first flag in the first parameter which the second parameter does not contain
 /// </summary>
 /// <param name="flags">Defines the posiible flags to be returned</param>
 /// <param name="invalid">Defines the invalid flags</param>
 /// <returns></returns>
 public static CubeFlag FirstNotInvalidFlag(CubeFlag flags, CubeFlag invalid) => GetFlags(flags).Cast<CubeFlag>().FirstOrDefault(f => !invalid.HasFlag(f));
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver_Bewerkt,代码行数:7,代码来源:CubeFlagService.cs

示例8: GetFlags

 /// <summary>
 /// Yields each single flag within the parameter
 /// </summary>
 /// <param name="flags">Defines the flag to be 'splitted'</param>
 /// <returns></returns>
 public static IEnumerable<Enum> GetFlags(CubeFlag flags)
 {
     foreach (Enum value in Enum.GetValues(flags.GetType()))
       {
     if (flags.HasFlag(value))
       yield return value;
       }
 }
开发者ID:GertClaeskens,项目名称:RubiksCubeSolver,代码行数:13,代码来源:CubeFlagService.cs


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