本文整理汇总了C#中IState类的典型用法代码示例。如果您正苦于以下问题:C# IState类的具体用法?C# IState怎么用?C# IState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IState类属于命名空间,在下文中一共展示了IState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchNextInstruction
public static Op FetchNextInstruction(IState state, ref ushort pc, ref ushort sp)
{
var firstWord = state.Get(pc++);
return 0 == (firstWord & 0xF) ?
(Op)DecodeNonBasic(state, firstWord, ref pc, ref sp) :
(Op)DecodeBasic(state, firstWord, ref pc, ref sp);
}
示例2: EncounteredBlockageState
/// <summary>
/// Constructor
/// </summary>
/// <param name="tacticalBlockage"></param>
/// <param name="currentState"></param>
public EncounteredBlockageState(ITacticalBlockage tacticalBlockage, IState planningState, BlockageRecoveryDEFCON defcon, SAUDILevel saudi)
{
this.TacticalBlockage = tacticalBlockage;
this.PlanningState = planningState;
this.Saudi = saudi;
this.Defcon = defcon;
}
示例3: state_StateChanged
static void state_StateChanged(IState newState)
{
state.StateChanged -= state_StateChanged;
state = newState;
state.StateChanged += state_StateChanged;
state.Start();
}
示例4: StateInfo
/// <summary>
/// Constructs a <b>StateInfo</b> with the given configuration settings
/// and states collection.
/// </summary>
/// <param name="configSettings">The configuration settings.</param>
/// <param name="states">The collection of states.</param>
public StateInfo(
Hashtable configSettings,
IState[] states)
{
this.configSettings = configSettings;
this.States = states;
}
示例5: OperationFailedException
internal OperationFailedException(IReadOnlyList<IState> operationStates, IReadOnlyList<IState> successStates, IState actualState)
: base($"Operation failed. Expected a transition from one of [{String.Join(", ", operationStates)}] to one of [{String.Join(", ", successStates)}], but actually reached {actualState}")
{
this.OperationStates = operationStates;
this.SuccessStates = successStates;
this.ActualState = actualState;
}
示例6: NewsCrawlerState
public NewsCrawlerState(MachineContext context, IState prev)
: base(context)
{
this.prev = prev;
this._timer = new Util.StaticTimer(TimeSpan.FromMinutes(3));
InitRssFeed();
}
示例7: Set
public void Set(AudioClip changeClip, float fadeTime, IState<PlayState> nextState)
{
this.audio.SwapSource();
this.audio.main.clip = changeClip;
this.fadeTime = fadeTime;
this.nextState = nextState;
}
示例8: StayInLaneState
/// <summary>
/// Constructor
/// </summary>
/// <param name="lane"></param>
public StayInLaneState(ArbiterLane lane, Probability confidence, IState previous)
{
this.Lane = lane;
this.internalLaneState = new InternalState(lane.LaneId, lane.LaneId, confidence);
this.IgnorableWaypoints = new List<IgnorableWaypoint>();
this.CheckPreviousState(previous);
}
示例9: StepHandler
public void StepHandler(IState state)
{
//IEnumerable<AbstractStep> availableSteps = state.GetAvailableSteps();
//BuildGraph(availableSteps);
AbstractStep optimalStep = MakeDecision(state);
_Game.DoStep(optimalStep, _PlayerType);
}
示例10: GoldState
public GoldState(IState state)
: base(state)
{
Interest = 0.05m;
LowerLimit = 1000m;
UpperLimit = 10000000m;
}
示例11: Start
public async Task Start(IState initialState, Session session,
CancellationToken cancellationToken = default(CancellationToken))
{
Logging.Logger.Write("Version 1.0.5 : 2016.08.02 14:18", Logging.LogLevel.Self, ConsoleColor.Yellow);
var state = initialState;
do
{
try
{
state = await state.Execute(session, cancellationToken);
}
catch (InvalidResponseException)
{
session.EventDispatcher.Send(new ErrorEvent
{
Message = "Niantic Servers unstable, throttling API Calls."
});
}
catch (OperationCanceledException)
{
session.EventDispatcher.Send(new ErrorEvent { Message = "Current Operation was canceled." });
state = _initialState;
}
catch (Exception ex)
{
session.EventDispatcher.Send(new ErrorEvent { Message = ex.ToString() });
state = _initialState;
}
} while (state != null);
}
示例12: Explore
public override void Explore(IState state, string description)
{
_state = ((IQuantumState)state);
this.Text = description;
Start();
}
示例13: ChangeState
public bool ChangeState(StateContext context, IState toState, string oldStateName)
{
try
{
var filterInfo = GetFilters(context.Job);
var electStateContext = new ElectStateContext(context, toState, oldStateName);
var electedState = ElectState(electStateContext, filterInfo.ElectStateFilters);
var applyStateContext = new ApplyStateContext(context, electedState, oldStateName);
ApplyState(applyStateContext, filterInfo.ApplyStateFilters);
// State transition was succeeded.
return true;
}
catch (Exception ex)
{
var failedState = new FailedState(ex)
{
Reason = "An exception occurred during the transition of job's state"
};
var applyStateContext = new ApplyStateContext(context, failedState, oldStateName);
// We should not use any state changed filters, because
// some of the could cause an exception.
ApplyState(applyStateContext, Enumerable.Empty<IApplyStateFilter>());
// State transition was failed due to exception.
return false;
}
}
示例14: Find
public virtual bool Find(IState initialState)
{
if (Strategy == null) return false;
Strategy.Add(new Node(initialState));
while (Strategy.Count() > 0)
{
var n = Strategy.Remove();
if (n.Parent != null && n.Successor != null)
{
var eventArgs = new StateExpansionEventArgs(n.Parent.State, n.Successor, n.Cost, n.Depth);
OnSuccessorExpanded(this, eventArgs);
if (eventArgs.CancelExpansion)
return false;
}
if (n.State.IsTerminal)
{
CreateSolution(n);
return true;
}
foreach (var node in n.Expand(_closed))
{
Strategy.Add(node);
if (_closed != null) _closed.Add(node.State);
}
}
return false;
}
示例15: JsonWriter
/// <summary>
/// Creates a json writer that writes to the <paramref name="writer"/> and uses
/// the InvariantCulture for any formatting.
/// </summary>
/// <param name="writer">the text writer that will be written to</param>
/// <param name="indent">setting that specifies whether to indent</param>
/// <param name="culture">The culture to use for formatting</param>
public JsonWriter(TextWriter writer, bool indent, CultureInfo culture)
{
this._writer = writer;
_currentState = new InitialState(this);
if (!indent)
indentSize = 0;
}