Class PackageDeliveryControl

java.lang.Object
cmpt213.assignment4.packagedeliveries.webappserver.control.PackageDeliveryControl

public class PackageDeliveryControl extends Object
This class creates a PackageDeliveryControl object which manages data for the program. This class handles data loading and saving.
  • Field Details

  • Constructor Details

    • PackageDeliveryControl

      public PackageDeliveryControl()
      Constructs a PackageDeliveryControl Object. Initializes class fields and also loads in any data from the JSON list.
  • Method Details

    • adjustPackage

      public void adjustPackage(int pkgIndex, int option, boolean newDeliveryStatus, Util.SCREEN_STATE currentState)
      Helper method for adjusting a given Package. Will either remove package or change its delivery state.
      Parameters:
      pkgIndex - The index of the package in the list.
      option - Remove or set delivery status
      newDeliveryStatus - The new delivery status, false if Remove is option.
    • arrayData

      public void arrayData(int dataMode)
      Helper method for loading or saving application data into JSON format.
      Parameters:
      dataMode - - Determines if method will save data from or load data to JSON.
    • getListAsJSON

      public com.google.gson.JsonArray getListAsJSON(Util.SCREEN_STATE currentState)
      Helper method that returns master list as.
      Returns:
      Returns master list as JSON object.
    • updateLists

      public final void updateLists()
      Helper method to update all lists; lists are also sorted after update. Current time is updated to LocalDateTime.now() here.