Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b21561

Browse files
author
Kailiang.He
committed
add comments and add serializable interface
in order to get method reference name using hack way
1 parent42668e6 commit4b21561

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

‎squirrel-foundation/src/main/java/org/squirrelframework/foundation/fsm/GeneralConverter.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public T convertFromString(String value) {
7171
}elseif(Character.class.equals(type) ||char.class.equals(type)) {
7272
returntype.cast(value.charAt(0));
7373
}
74-
thrownewIllegalStateException("Unable to convert type:\'" +
75-
type.getName() +"\' with value\'"+value+"\'.");
74+
thrownewIllegalStateException("Unable to convert type: '" +
75+
type.getName() +"' with value'"+value+"'.");
7676
}
7777

7878
}
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
packageorg.squirrelframework.foundation.fsm;
22

3+
importjava.io.Serializable;
4+
5+
/**
6+
* method reference for reference transaction action using method reference starts from jdk8
7+
*
8+
* @param <T> type of statemachine
9+
* @param <S> type of state
10+
* @param <E> type of event
11+
* @param <C> type of context
12+
*/
313
@FunctionalInterface
4-
publicinterfaceMethodReference<TextendsStateMachine<T,S,E,C>,S,E,C> {
14+
publicinterfaceMethodReference<TextendsStateMachine<T,S,E,C>,S,E,C>extendsSerializable{
515
voidinvoke(Tinstance,Sfrom,Sto,Eevent,Ccontext);
616
}

‎squirrel-foundation/src/test/java/org/squirrelframework/foundation/fsm/HierarchicalStateMachineTest.java‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@ public String consumeLog() {
337337

338338
StateMachineLoggerfsmLogger;
339339

340-
StateMachineBuilder<HierachicalStateMachine,HState,HEvent,Integer>builder;
341-
342340
@BeforeClass
343341
publicstaticvoidbeforeTest() {
344342
}
@@ -358,8 +356,9 @@ public void teardown() {
358356

359357
@Before
360358
publicvoidsetup() {
361-
builder =StateMachineBuilderFactory.create(HierachicalStateMachine.class,
362-
HState.class,HEvent.class,Integer.class,newClass<?>[0]);
359+
StateMachineBuilder<HierachicalStateMachine,HState,HEvent,Integer>builder =
360+
StateMachineBuilderFactory.create(HierachicalStateMachine.class,
361+
HState.class,HEvent.class,Integer.class,newClass<?>[0]);
363362
builder.externalTransition().from(HState.A).to(HState.B).on(HEvent.A2B);
364363
builder.externalTransition().from(HState.B).to(HState.A).on(HEvent.B2A);
365364

@@ -375,15 +374,6 @@ public void setup() {
375374
stateMachine =builder.newStateMachine(HState.A,StateMachineConfiguration.create().enableDebugMode(true));
376375
}
377376

378-
@Test
379-
publicvoidtestIgnoreStateEntryWhenStart() {
380-
stateMachine =builder.newStateMachine(HState.A,
381-
StateMachineConfiguration.create().enableDebugMode(true).disableStartEventTriggerEntryActions(true));
382-
stateMachine.start();
383-
assertThat(stateMachine.consumeLog(),is(equalTo("")));
384-
assertThat(stateMachine.getCurrentState(),is(equalTo(HState.A1)));
385-
}
386-
387377
@Test
388378
publicvoidtestBasicHierarchicalState() {
389379
stateMachine.start();

‎squirrel-foundation/src/test/java/org/squirrelframework/foundation/fsm/PerformanceTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum FSMEvent {
2222
staticclassStateMachineSampleextendsAbstractUntypedStateMachine {
2323
}
2424

25-
@Test(timeout =10000)
25+
@Test(timeout =20000)
2626
publicvoidmanyTransitions() {
2727
performTest(10000,false,null);
2828
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp