本文整理汇总了C#中Region.IsComplete方法的典型用法代码示例。如果您正苦于以下问题:C# Region.IsComplete方法的具体用法?C# Region.IsComplete怎么用?C# Region.IsComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region.IsComplete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public static void Test()
{
var machine = new Region( "history" );
var initial = new PseudoState( "initial", PseudoStateKind.Initial, machine );
var shallow = new CompositeState( "shallow", machine );
var deep = new SimpleState( "deep", machine );
var final = new FinalState( "final", machine );
var s1 = new SimpleState( "s1", shallow );
var s2 = new SimpleState( "s2", shallow );
new Transition( initial, shallow );
new Transition( new PseudoState( "shallow", PseudoStateKind.ShallowHistory, shallow ), s1 );
new Transition<String>( s1, s2, c => c.Equals( "move" ) );
new Transition<String>( shallow, deep, c => c.Equals( "go deep" ) );
new Transition<String>( deep, shallow, c => c.Equals( "go shallow" ) );
new Transition<String>( s2, final, c => c.Equals( "end" ) );
var state = new State();
machine.Initialise( state );
Trace.Assert( machine.Process( state, "move" ) );
Trace.Assert( machine.Process( state, "go deep" ) );
Trace.Assert( machine.Process( state, "go shallow" ) );
Trace.Assert( !machine.Process( state, "go shallow" ) );
Trace.Assert( machine.Process( state, "end" ) );
Trace.Assert( machine.IsComplete( state ) );
}
示例2: Test
public static void Test()
{
try
{
var main = new Region<State>( "muximise1" );
var initial = new PseudoState<State>( "initial", PseudoStateKind.Initial, main );
var ortho = new OrthogonalState<State>( "ortho", main );
var simple = new SimpleState<State>( "simple", main );
var final = new FinalState<State>( "final", main );
var r1 = new Region<State>( "r1", ortho );
var r2 = new Region<State>( "r2", ortho );
var i1 = new PseudoState<State>( "initial", PseudoStateKind.ShallowHistory, r1 );
var i2 = new PseudoState<State>( "initial", PseudoStateKind.ShallowHistory, r2 );
var s1 = new SimpleState<State>( "s1", r1 );
var s2 = new SimpleState<State>( "s2", r2 );
var f1 = new FinalState<State>( "f1", r1 );
var f2 = new FinalState<State>( "f2", r2 );
new Transition<State>( initial, ortho );
new Transition<State>( i1, s1 );
new Transition<State>( i2, s2 );
new Transition<State>( ortho, final ); // This should happen once all regions in ortho are complete?
new Transition<State, String>( s1, f1, ( s, c ) => c == "complete1" );
new Transition<State, String>( s2, f2, ( s, c ) => c == "complete2" );
new Transition<State, String>( ortho, simple, ( s, c ) => c == "jump" );
new Transition<State, String>( simple, ortho, ( s, c ) => c == "back" );
var state = new State();
main.Initialise( state );
main.Process( state, "complete1" );
main.Process( state, "complete2" );
Trace.Assert( main.IsComplete( state ) );
}
catch( Exception x )
{
Trace.Fail( x.Message );
}
}