Package controller

Class Controller

java.lang.Object
controller.Controller

public class Controller
extends java.lang.Object
Controller class which handles the GUI, modules and a list of objects of the highest hierarchy (satellites).
  • Field Summary

    Fields
    Modifier and Type Field Description
    private java.util.ArrayList<IAggregate> aggregationModules  
    private static Controller controller
    Singleton instance of Controller
    private GUI gui  
    private java.util.ArrayList<IOutput> outputModules  
    private java.util.ArrayList<Satellite> satelliteList  
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    private Controller()
    Constructor of Controller, holds GUI instance and passes itself to the GUI.
  • Method Summary

    Modifier and Type Method Description
    void aggregate()
    Fetches the selected method of aggregation and performs it on the data.
    static Controller getInstance()
    Singleton getter for Controller, instantiates itself if and only if not already existent.
    private static java.lang.String getSourceFile()
    Asks the user for the file path of the JSON.
    void init​(java.lang.String file)
    Makes sure file path to JSON file is existent and gets list of Satellites.
    void initModules()
    Loads aggregation and output modules and passes them to the GUI.
    private void loadAggregationModules()
    Takes all modules in "/Aggregation_Modules", instantiates them and saves the objects in the aggregationModules list of aggregates.
    private void loadOutputModules()
    Takes all modules in "/Output_Modules", instantiates them and saves the objects in the outputModules list of outputs.
    private void output​(CompositeContainer aggregationResult)
    Fetches the selected method of output and outputs the result of the aggregation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • controller

      private static Controller controller
      Singleton instance of Controller
    • gui

      private GUI gui
    • satelliteList

      private java.util.ArrayList<Satellite> satelliteList
    • aggregationModules

      private java.util.ArrayList<IAggregate> aggregationModules
    • outputModules

      private java.util.ArrayList<IOutput> outputModules
  • Constructor Details

    • Controller

      private Controller()
      Constructor of Controller, holds GUI instance and passes itself to the GUI.
  • Method Details

    • getInstance

      public static Controller getInstance()
      Singleton getter for Controller, instantiates itself if and only if not already existent.
      Returns:
      controller Controller object
    • init

      public void init​(java.lang.String file)
      Makes sure file path to JSON file is existent and gets list of Satellites.
      Parameters:
      file - path of the given JSON file or null if not given
    • initModules

      public void initModules()
      Loads aggregation and output modules and passes them to the GUI.
    • getSourceFile

      private static java.lang.String getSourceFile()
      Asks the user for the file path of the JSON.
      Returns:
      file path of the JSON file, if not given program exits with status -42
    • aggregate

      public void aggregate()
      Fetches the selected method of aggregation and performs it on the data.
    • output

      private void output​(CompositeContainer aggregationResult)
      Fetches the selected method of output and outputs the result of the aggregation.
      Parameters:
      aggregationResult - The result of the aggregation
    • loadAggregationModules

      private void loadAggregationModules()
      Takes all modules in "/Aggregation_Modules", instantiates them and saves the objects in the aggregationModules list of aggregates.
    • loadOutputModules

      private void loadOutputModules()
      Takes all modules in "/Output_Modules", instantiates them and saves the objects in the outputModules list of outputs.