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


C# Region.IsComplete方法代码示例

本文整理汇总了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 ) );
		}
开发者ID:rezn,项目名称:state.cs,代码行数:30,代码来源:Shallow.cs

示例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 );
			}
		}
开发者ID:jjjesus,项目名称:state.cs,代码行数:51,代码来源:Muximise1.cs


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