Class GuiTreasureObserver

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

public class GuiTreasureObserver
extends javafx.application.Application
implements java.io.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:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from class javafx.application.Application

    javafx.application.Application.Parameters
  • Field Summary

    Fields inherited from class javafx.application.Application

    STYLESHEET_CASPIAN, STYLESHEET_MODENA
  • Constructor Summary

    Constructors 
    Constructor Description
    GuiTreasureObserver()  
  • Method Summary

    Modifier and Type Method Description
    void addObservedAgent​(java.lang.String agentName)
    Add the agent to the observerGui (do nothing if already present)
    static GuiTreasureObserver getInstance()
    Design pattern singleton
    static void main​(java.lang.String[] args)  
    void removeObservedAgent​(java.lang.String agentName)
    Remove the agent from the observerGui
    void start​(javafx.stage.Stage stage)
    Automatically called when App.launch() is triggered
    java.lang.String toString()  
    boolean updateAgentDiamondValue​(java.lang.String agentName, java.lang.Integer diamondValue)
    Set the diamond to its new value
    boolean updateAgentGoldValue​(java.lang.String agentName, java.lang.Integer goldValue)
    Set the gold to its new value
    boolean updateAgentTreasure​(java.lang.String agentName, java.lang.Integer gold, java.lang.Integer diamond)
    Set the new values for gold and diamonds.

    Methods inherited from class javafx.application.Application

    getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stop

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • main

      public static void main​(java.lang.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​(java.lang.String agentName, java.lang.Integer gold, java.lang.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​(java.lang.String agentName, java.lang.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​(java.lang.String agentName, java.lang.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​(java.lang.String agentName)
      Add the agent to the observerGui (do nothing if already present)
      Parameters:
      agentName - (unique) name of the agent
    • removeObservedAgent

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

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object