Package edu.tufts.hrilab.belief
Class BeliefAdapter
java.lang.Object
edu.tufts.hrilab.gui.GuiAdapter
edu.tufts.hrilab.belief.BeliefAdapter
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intTimer update period, in milliseconds.Fields inherited from class edu.tufts.hrilab.gui.GuiAdapter
groups, log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEnforce implementation of path root getter forgetPath().protected voidhandleMessage(com.google.gson.JsonObject message) Handle a user message.protected voidinit()Initialization after construction and after TRADE services are registered.protected booleanForce implementing classes to declare whether they provide TRADE services.voidUpdates the user about system beliefs.Methods inherited from class edu.tufts.hrilab.gui.GuiAdapter
createAndRegisterInstance, getPath, sendMessage
-
Field Details
-
UPDATE_PERIOD
public static final int UPDATE_PERIODTimer update period, in milliseconds.- See Also:
-
-
Constructor Details
-
BeliefAdapter
Constructor.
-
-
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:
initin classGuiAdapter
-
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:
providesTradeServicesin classGuiAdapter- Returns:
- true iff the adapter provides TRADE services.
-
handleMessage
protected void handleMessage(com.google.gson.JsonObject message) Handle a user message.- Overrides:
handleMessagein classGuiAdapter- Parameters:
message- a JsonObject representing the message.
-
getPathRoot
Enforce implementation of path root getter forgetPath(). This is usually based on the component's/adapter's name; e.g., the belief GUI's path root isbelief.- Specified by:
getPathRootin classGuiAdapter- Returns:
- the path root as a
String.
-