Package src.handler
Class ExceptionHandler
Object
ExceptionHandler
Collection of helper functions to deal with exceptions
- Version:
- 1.0
- Author:
- Lee Juin
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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 userstatic boolean
TypeMismatchHandler
(Object o1, Object o2) Handler to handle potential situation of type mismatch.
-
Constructor Details
-
ExceptionHandler
public ExceptionHandler()Constructor
-
-
Method Details
-
TypeMismatchHandler
Handler to handle potential situation of type mismatch. i.e., system expects an int but got aString
instead- Parameters:
o1
- object of type 1o2
- object of type 2- Returns:
true
if type 1 == type 2;false
otherwise
-
OutOfBoundHandler
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 accessarrayList
- ArrayList of generic objects- Returns:
true
if the index is within the array,false
otherwise
-