13.07.2015 Views

5 Model Programs

5 Model Programs

5 Model Programs

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Systems with Finite <strong>Model</strong>s 119namespace ClientServer{...static class ClientServer{// State variables used by all featuresinternal static Socket serverSocket = Socket.None;...}}[Feature]static class Server{// Server action methods and enabling conditions...public static bool ServerSocketEnabled()...[Action]public static void ServerSocket()...}[Feature]class Client{// Client action methods and enabling conditions...}// Factory class, several factory methods select different featurespublic static class Factory{// No features argument in constructor, include all featurespublic static <strong>Model</strong>Program Create(){return new Library<strong>Model</strong>Program(typeof(Factory).Assembly,"ClientServer");}}// Features argument in constructor, include just that featurepublic static <strong>Model</strong>Program CreateServerOnly(){return new Library<strong>Model</strong>Program(typeof(Factory).Assembly,"ClientServer",new Set("Server")); //feature}Figure 7.3. Client/server: model program with features (excerpts).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!