Class TotalOrder

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class TotalOrder extends Frame
Originally written to be a demo for TOTAL order (code to be written by a student). In the meantime, it evolved into a state transfer demo. All members maintain a shared matrix and continually broadcast changes to be applied to a randomly chosen field (e.g. multiplication of field with new value, division, addition, subtraction). Each member can be started independently (starts to broadcast update messages to all members). When "Stop" is pressed, a stop message is broadcast to all members, causing them to stop sending messages. The "Clear" button clears the shared state; "GetState" refreshes it from the shared group state (using the state transfer protocol).

If the demo is to be used to show total order, then the SEQUENCER protocol would have to be added to the stack.

See Also:
  • Field Details

    • def_font

      final Font def_font
    • def_font2

      final Font def_font2
    • canvas

      MyCanvas canvas
    • start

      final Button start
    • stop

      final Button stop
    • clear

      final Button clear
    • get_state

      final Button get_state
    • quit

      final Button quit
    • button_panel

      final Panel button_panel
    • sender

    • channel

      JChannel channel
    • timeout

      long timeout
    • field_size

      int field_size
    • num_fields

      int num_fields
    • x_offset

      static final int x_offset
      See Also:
    • y_offset

      static final int y_offset
      See Also:
    • num

      private int num
    • num_additions

      private int num_additions
    • num_subtractions

      private int num_subtractions
    • num_divisions

      private int num_divisions
    • num_multiplications

      private int num_multiplications
  • Constructor Details

    • TotalOrder

      public TotalOrder(String title, long timeout, int num_fields, int field_size, String props, int num)
  • Method Details

    • error

      static void error(String s)
    • processRequest

      void processRequest(TotOrderRequest req) throws Exception
      Throws:
      Exception
    • startSender

      void startSender()
    • stopSender

      void stopSender()
    • createMenuBar

      private MenuBar createMenuBar()
    • createRandomRequest

      private TotOrderRequest createRandomRequest()
    • main

      public static void main(String[] args)
    • help

      protected static void help()