Fixup use of using on short namespaces

This commit is contained in:
Marc Hernandez 2025-10-17 01:42:06 -07:00
parent f310982890
commit fb96548db2

View File

@ -2,28 +2,27 @@
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using imm; // Ensure this namespace is available
/// <summary> /// <summary>
/// Base context for an FSM. /// Base context for an FSM.
/// MUST inherit from Recorded<TSelf> or Timed<TSelf> in your concrete class. /// MUST inherit from imm.Recorded<TSelf> or Timed<TSelf> in your concrete class.
/// </summary> /// </summary>
/// <typeparam name="TSelf">The concrete Context type.</typeparam> /// <typeparam name="TSelf">The concrete Context type.</typeparam>
public abstract record class FsmContextBase<TSelf> : Recorded<TSelf> public abstract record class FsmContextBase<TSelf> : imm.Recorded<TSelf>
where TSelf : FsmContextBase<TSelf> where TSelf : FsmContextBase<TSelf>
{ {
// Required for 'with' expressions. // Required for 'with' expressions.
protected FsmContextBase(Recorded<TSelf> original) : base(original) { } protected FsmContextBase(imm.Recorded<TSelf> original) : base(original) { }
protected FsmContextBase() { } protected FsmContextBase() { }
} }
/// <summary> /// <summary>
/// Base state for an FSM. /// Base state for an FSM.
/// MUST inherit from Recorded<TSelf> or Timed<TSelf> in your concrete class. /// MUST inherit from imm.Recorded<TSelf> or Timed<TSelf> in your concrete class.
/// </summary> /// </summary>
/// <typeparam name="TSelf">The concrete State type.</typeparam> /// <typeparam name="TSelf">The concrete State type.</typeparam>
/// <typeparam name="TCtx">The concrete Context type (must be based on FsmContextBase).</typeparam> /// <typeparam name="TCtx">The concrete Context type (must be based on FsmContextBase).</typeparam>
public abstract record class FsmStateBase<TSelf, TCtx> : Recorded<TSelf> public abstract record class FsmStateBase<TSelf, TCtx> : imm.Recorded<TSelf>
where TSelf : FsmStateBase<TSelf, TCtx> where TSelf : FsmStateBase<TSelf, TCtx>
where TCtx : FsmContextBase<TCtx> where TCtx : FsmContextBase<TCtx>
{ {
@ -44,18 +43,18 @@ public abstract record class FsmStateBase<TSelf, TCtx> : Recorded<TSelf>
} }
// Required for 'with' expressions. // Required for 'with' expressions.
protected FsmStateBase(Recorded<TSelf> original) : base(original) { } protected FsmStateBase(imm.Recorded<TSelf> original) : base(original) { }
protected FsmStateBase() { } protected FsmStateBase() { }
} }
/// <summary> /// <summary>
/// An immutable FSM base class. /// An immutable FSM base class.
/// MUST inherit from Recorded<TSelf> or Timed<TSelf> in your concrete class. /// MUST inherit from imm.Recorded<TSelf> or Timed<TSelf> in your concrete class.
/// </summary> /// </summary>
/// <typeparam name="TSelf">The concrete FSM type.</typeparam> /// <typeparam name="TSelf">The concrete FSM type.</typeparam>
/// <typeparam name="TState">The concrete State type.</typeparam> /// <typeparam name="TState">The concrete State type.</typeparam>
/// <typeparam name="TCtx">The concrete Context type.</typeparam> /// <typeparam name="TCtx">The concrete Context type.</typeparam>
public abstract record class FsmBase<TSelf, TState, TCtx> : Recorded<TSelf> public abstract record class FsmBase<TSelf, TState, TCtx> : imm.Recorded<TSelf>
where TSelf : FsmBase<TSelf, TState, TCtx> where TSelf : FsmBase<TSelf, TState, TCtx>
where TState : FsmStateBase<TState, TCtx> where TState : FsmStateBase<TState, TCtx>
where TCtx : FsmContextBase<TCtx> where TCtx : FsmContextBase<TCtx>
@ -70,7 +69,7 @@ public abstract record class FsmBase<TSelf, TState, TCtx> : Recorded<TSelf>
} }
// Required for 'with' expressions. // Required for 'with' expressions.
protected FsmBase(Recorded<TSelf> original) : base(original) protected FsmBase(imm.Recorded<TSelf> original) : base(original)
{ {
var o = original as FsmBase<TSelf, TState, TCtx>; var o = original as FsmBase<TSelf, TState, TCtx>;
Context = o!.Context; Context = o!.Context;
@ -79,7 +78,7 @@ public abstract record class FsmBase<TSelf, TState, TCtx> : Recorded<TSelf>
/// <summary> /// <summary>
/// Transitions the FSM. It automatically uses the 'Process' /// Transitions the FSM. It automatically uses the 'Process'
/// method appropriate for Recorded or Timed, thanks to virtual overrides. /// method appropriate for imm.Recorded or Timed, thanks to virtual overrides.
/// </summary> /// </summary>
public TSelf Transition( public TSelf Transition(
TState newState, TState newState,
@ -94,7 +93,7 @@ public abstract record class FsmBase<TSelf, TState, TCtx> : Recorded<TSelf>
var (ctxAfterExit, stateAfterExit) = State.OnExit(Context, newState); var (ctxAfterExit, stateAfterExit) = State.OnExit(Context, newState);
var (ctxAfterEnter, stateAfterEnter) = newState.OnEnter(ctxAfterExit, stateAfterExit); var (ctxAfterEnter, stateAfterEnter) = newState.OnEnter(ctxAfterExit, stateAfterExit);
// Since 'this' is at least 'Recorded<TSelf>', we can call the // Since 'this' is at least 'imm.Recorded<TSelf>', we can call the
// detailed 'Process'. If 'this' is actually 'Timed<TSelf>', C#'s // detailed 'Process'. If 'this' is actually 'Timed<TSelf>', C#'s
// virtual dispatch will call the 'Timed' override automatically. // virtual dispatch will call the 'Timed' override automatically.
return Process( return Process(