Class GuiTreasureObserver

java.lang.Object
javafx.application.Application
eu.su.mas.dedale.mas.agents.observerAgent.guiComponents.GuiTreasureObserver
All Implemented Interfaces:
Serializable

public class GuiTreasureObserver extends javafx.application.Application implements Serializable
JavaFx frame used to display the backPack's state of each observed agent. Design pattern Singleton. One Unique frame for one platform
Author:
hc
See Also:
  • Constructor Details

    • GuiTreasureObserver

      public GuiTreasureObserver()
  • Method Details

    • main

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

      public static GuiTreasureObserver getInstance()
      Design pattern singleton

      Returns:
      Get an instance of the Gui to call the associated update methods. If the instance does not already exist, this method creates it
    • start

      public void start(javafx.stage.Stage stage)
      Automatically called when App.launch() is triggered
      Specified by:
      start in class javafx.application.Application
    • updateAgentTreasure

      public boolean updateAgentTreasure(String agentName, Integer gold, Integer diamond)
      Set the new values for gold and diamonds. If the agent does not exist, it creates it.
      Parameters:
      agentName - localName of the agent
      gold - quantity of gold the agent carries
      diamond - quantity of diamond the agent carries
      Returns:
      true is the agent has been updated, false if created
    • updateAgentGoldValue

      public boolean updateAgentGoldValue(String agentName, Integer goldValue)
      Set the gold to its new value
      Parameters:
      agentName - localName of the agent
      goldValue - new quantity of gold
      Returns:
      true if the value has been updated, false otherwise
    • updateAgentDiamondValue

      public boolean updateAgentDiamondValue(String agentName, Integer diamondValue)
      Set the diamond to its new value
      Parameters:
      agentName - localName
      diamondValue - quantity of diamond to set
      Returns:
      true if the value has been updated, false otherwise
    • addObservedAgent

      public void addObservedAgent(String agentName)
      Add the agent to the observerGui (do nothing if already present)
      Parameters:
      agentName - (unique) name of the agent
    • removeObservedAgent

      public void removeObservedAgent(String agentName)
      Remove the agent from the observerGui
      Parameters:
      agentName - localname of the agent
    • toString

      public String toString()
      Overrides:
      toString in class Object