< Summary

Information
Class: Lattice.ECS.Framework.SystemSchedulerBoundary
Assembly: Lattice
File(s): /home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Framework/SystemSchedulerBoundary.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 136
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_SchedulerKind()100%11100%
get_SupportedCapabilities()100%11100%
get_UnsupportedCapabilities()100%11100%
Supports(...)100%11100%
ExplicitlyDoesNotSupport(...)100%11100%

File(s)

/home/runner/work/Sideline/Sideline/godot/scripts/lattice/ECS/Framework/SystemSchedulerBoundary.cs

#LineLine coverage
 1using System;
 2
 3namespace Lattice.ECS.Framework
 4{
 5    /// <summary>
 6    /// 当前 `SystemScheduler` 的正式调度模型类型。
 7    /// </summary>
 8    public enum SystemSchedulerKind
 9    {
 10        /// <summary>
 11        /// 单线程、平面、按注册顺序执行的最小系统调度模型。
 12        /// </summary>
 13        FlatOrdered = 0,
 14
 15        /// <summary>
 16        /// 单线程、平面、按 phase 再按注册顺序执行的轻量系统调度模型。
 17        /// </summary>
 18        FlatPhasedOrdered = 1
 19    }
 20
 21    /// <summary>
 22    /// 当前 `SystemScheduler` 公开承诺的调度能力。
 23    /// </summary>
 24    [Flags]
 25    public enum SystemSchedulerCapability
 26    {
 27        None = 0,
 28
 29        /// <summary>
 30        /// 支持按注册顺序稳定执行系统。
 31        /// </summary>
 32        OrderedExecution = 1 << 0,
 33
 34        /// <summary>
 35        /// 支持显式初始化与关闭生命周期。
 36        /// </summary>
 37        ExplicitLifecycle = 1 << 1,
 38
 39        /// <summary>
 40        /// 支持在初始化前静态注册系统集合。
 41        /// </summary>
 42        StaticRegistrationBeforeInitialize = 1 << 2,
 43
 44        /// <summary>
 45        /// 支持轻量 phase 执行语义。
 46        /// </summary>
 47        PhasedExecution = 1 << 3,
 48
 49        /// <summary>
 50        /// 支持对系统作者契约进行显式校验与执行期守卫。
 51        /// </summary>
 52        AuthoringContractValidation = 1 << 4
 53    }
 54
 55    /// <summary>
 56    /// 当前 `SystemScheduler` 明确不承诺的调度能力。
 57    /// </summary>
 58    [Flags]
 59    public enum UnsupportedSystemSchedulerCapability
 60    {
 61        None = 0,
 62
 63        /// <summary>
 64        /// 不支持初始化后的动态系统增删。
 65        /// </summary>
 66        RuntimeMutation = 1 << 0,
 67
 68        /// <summary>
 69        /// 不支持 phase / stage 调度。
 70        /// 该标记保留用于描述旧边界或其他不支持 phase 的调度器。
 71        /// </summary>
 72        SystemPhase = 1 << 1,
 73
 74        /// <summary>
 75        /// 不支持系统 enable / disable 开关。
 76        /// </summary>
 77        EnableDisable = 1 << 2,
 78
 79        /// <summary>
 80        /// 不支持显式依赖排序图。
 81        /// </summary>
 82        DependencyOrdering = 1 << 3,
 83
 84        /// <summary>
 85        /// 不支持 `SystemGroup` 一类的层级分组。
 86        /// </summary>
 87        HierarchicalGrouping = 1 << 4,
 88
 89        /// <summary>
 90        /// 不支持多线程系统调度。
 91        /// </summary>
 92        ThreadedExecution = 1 << 5
 93    }
 94
 95    /// <summary>
 96    /// `SystemScheduler` 的正式调度边界描述。
 97    /// 用于把“当前系统层正式支持什么、不支持什么”显式暴露在代码层。
 98    /// </summary>
 99    public sealed class SystemSchedulerBoundary
 100    {
 1101        public SystemSchedulerBoundary(
 1102            SystemSchedulerKind schedulerKind,
 1103            SystemSchedulerCapability supportedCapabilities,
 1104            UnsupportedSystemSchedulerCapability unsupportedCapabilities)
 105        {
 1106            SchedulerKind = schedulerKind;
 1107            SupportedCapabilities = supportedCapabilities;
 1108            UnsupportedCapabilities = unsupportedCapabilities;
 1109        }
 110
 111        /// <summary>
 112        /// 当前调度模型类型。
 113        /// </summary>
 1114        public SystemSchedulerKind SchedulerKind { get; }
 115
 116        /// <summary>
 117        /// 当前正式支持的调度能力。
 118        /// </summary>
 5119        public SystemSchedulerCapability SupportedCapabilities { get; }
 120
 121        /// <summary>
 122        /// 当前明确不承诺的调度能力。
 123        /// </summary>
 5124        public UnsupportedSystemSchedulerCapability UnsupportedCapabilities { get; }
 125
 126        public bool Supports(SystemSchedulerCapability capability)
 127        {
 5128            return (SupportedCapabilities & capability) == capability;
 129        }
 130
 131        public bool ExplicitlyDoesNotSupport(UnsupportedSystemSchedulerCapability capability)
 132        {
 5133            return (UnsupportedCapabilities & capability) == capability;
 134        }
 135    }
 136}