Package Orders

Class OrderData

java.lang.Object
Orders.OrderData

public class OrderData extends Object
This class creates an order data object and provides methods to add, search, list, and remove orders. It also provides methods to get a new order number and check if an order exists. It uses a hashmap to store orders with the order number used as the key.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new MenuData object and loads the default menu items from the default_menu_items.txt file.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addOrder(int orderNumber, Order order)
    This adds an order object to the orderData hashmap
    int
    This method returns an order number and then increments the order number
    getOrder(int orderNumber)
    This method returns an order object from the orderData hashmap
    boolean
    isOrder(int orderNum)
    This method checks if an order number exists in the orderData hashmap
    This method prints out all the information for all the orders in the orderData hashmap
    void
    remOrder(int orderNumber)
    Removes the order object with this order number
    searchOrder(int orderNumber)
    This method searches the orderData hashmap for an order number and, if found, build a string of its information and returns that string

    Methods inherited from class java.lang.Object

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

    • OrderData

      public OrderData()
      Constructs a new MenuData object and loads the default menu items from the default_menu_items.txt file.
  • Method Details

    • addOrder

      public void addOrder(int orderNumber, Order order)
      This adds an order object to the orderData hashmap
      Parameters:
      orderNumber - takes the order number key
      order - takes the order object
    • getOrder

      public Order getOrder(int orderNumber)
      This method returns an order object from the orderData hashmap
      Parameters:
      orderNumber - the order number to search for
      Returns:
      returns the order object
    • searchOrder

      public String searchOrder(int orderNumber)
      This method searches the orderData hashmap for an order number and, if found, build a string of its information and returns that string
      Parameters:
      orderNumber - this is the order number searched for
      Returns:
      returns the built string of order information
    • listOrders

      public String listOrders()
      This method prints out all the information for all the orders in the orderData hashmap
    • isOrder

      public boolean isOrder(int orderNum)
      This method checks if an order number exists in the orderData hashmap
      Parameters:
      orderNum - The order number to be searched for
      Returns:
      returns true if the order number is found
    • remOrder

      public void remOrder(int orderNumber)
      Removes the order object with this order number
      Parameters:
      orderNumber - this is the order number of the order object to be removed
    • getNewOrderNum

      public int getNewOrderNum()
      This method returns an order number and then increments the order number
      Returns:
      the current value of the order number index