Draw on the right, write (Umple) model code on the left. Analyse models and generate code. This tool stores your data in cookies and on a server. I understand. Click to learn about privacy. Download Donate For help: User manual Ask questions Report issue
// Test of pooled state machines. // The word pooled results in a thread being // created to process events, and 'pooled' // semantics being employed. Events which cannot // be handled are kept waiting until entry into a // state where they can be handled. class TestSM { String ev=""; pooled sm{ s1 { e1 /{ev="e1";} ->s2; e5 /{ev="e5";} ->s2; } s2 { e2 /{ev="e2";} ->s3; } s3 { e3 /{ev="e3";} ->s4; } s4 { e4 /{ev="e4";} ->s1; } } after e* { if(wasEventProcessed) System.out.println(ev); } public static void main(String [] ags){ TestSM test=new TestSM(); test.e1(); // processed s2 // Will only be processed in the test.e5(); // pooled case (eventually) test.e2(); // processed s3 test.e3(); // processed s4 test.e4(); // processed s1 test.e1(); // processed s2 // queued: ignored // pooled: left in queue, until we test.e3(); // are next in s3 // pooled: left in queue, until test.e4(); // next in s4 // pooled: processed goes to s3 // pooled: process e3 from queue // goes to s4 // pooled: process s4 from queue test.e2(); // goes to s1 test.e1(); test.e3(); test.e2(); test.e4(); test.e1(); test.e2(); test.e3(); test.e4(); test.e1(); test.e2(); test.e4(); test.e3(); test.e4(); test.e1(); test.e3(); test.e2(); test.e3(); test.e1(); test.e4(); test.e2(); test.e1(); test.e2(); } } //$?[End_of_model]$? // @@@skipcppcompile - Contains Java Code // @@@skipphpcompile - Contains Java Code // @@@skiprubycompile - Contains Java Code // @@@skippythoncompile - Contains Java Code