Package src.handler

Class ExceptionHandler

Object
ExceptionHandler

public class ExceptionHandler extends Object
Collection of helper functions to deal with exceptions
Version:
1.0
Author:
Lee Juin
  • Constructor Details

    • ExceptionHandler

      public ExceptionHandler()
      Constructor
  • Method Details

    • TypeMismatchHandler

      public static boolean TypeMismatchHandler(Object o1, Object o2)
      Handler to handle potential situation of type mismatch. i.e., system expects an int but got a String instead
      Parameters:
      o1 - object of type 1
      o2 - object of type 2
      Returns:
      true if type 1 == type 2; false otherwise
    • OutOfBoundHandler

      public static <E> boolean OutOfBoundHandler(int index, ArrayList<E> arrayList)
      Handler to handle situation when user attempts to access outside index of an array i.e., 5 selections but given int 6 by user
      Type Parameters:
      E - generic object for ArrayList
      Parameters:
      index - index that the user is trying to access
      arrayList - ArrayList of generic objects
      Returns:
      true if the index is within the array, false otherwise