Class BeliefAdapter

java.lang.Object
edu.tufts.hrilab.gui.GuiAdapter
edu.tufts.hrilab.belief.BeliefAdapter

public class BeliefAdapter extends GuiAdapter
A WebSocket adapter for communication between the BeliefComponent and the frontend Belief Viewer GUI.

Implementation note: because of the high potential volume of belief changes, this class does not use notifications to receive updates. Instead, it polls the BeliefComponent at regular intervals.

See Also:
  • Field Details

    • UPDATE_PERIOD

      public static final int UPDATE_PERIOD
      Timer update period, in milliseconds.
      See Also:
  • Constructor Details

  • Method Details

    • sendBeliefs

      public void sendBeliefs()
      Updates the user about system beliefs.
    • init

      protected void init()
      Initialization after construction and after TRADE services are registered.
      Overrides:
      init in class GuiAdapter
    • providesTradeServices

      protected boolean providesTradeServices()
      Force implementing classes to declare whether they provide TRADE services. This is to decide whether or not to register any new instances of that class with TRADE.
      Specified by:
      providesTradeServices in class GuiAdapter
      Returns:
      true iff the adapter provides TRADE services.
    • handleMessage

      protected void handleMessage(com.google.gson.JsonObject message)
      Handle a user message.
      Overrides:
      handleMessage in class GuiAdapter
      Parameters:
      message - a JsonObject representing the message.
    • getPathRoot

      public String getPathRoot()
      Enforce implementation of path root getter for getPath(). This is usually based on the component's/adapter's name; e.g., the belief GUI's path root is belief.
      Specified by:
      getPathRoot in class GuiAdapter
      Returns:
      the path root as a String.