Package models.handlers
Class RoutesHandler
java.lang.Object
models.handlers.RoutesHandler
- All Implemented Interfaces:
CollectionHandler<HashSet<Route>,
Route>
Current implementation of CollectionsHandler for HashSet of Route.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds element to collection.void
Provides method for fast clear element in collection.Returns actual collection reference.Returns first element of collection.Provides method for get collection initDate.static RoutesHandler
Singletone moment.Returns last element of collection.getMax
(Comparator<Route> comparator) Gets max element by given comparatorgetMin
(Comparator<Route> comparator) Gets min element by given comparatorvoid
setCollection
(HashSet<Route> routes) Overrides current collection by provided value.void
sort()
Sorts elements by ID Field in Route.void
Validates all elements in collection
-
Method Details
-
getInstance
Singletone moment.- Returns:
- Single instance of handler.
-
getCollection
Returns actual collection reference.- Specified by:
getCollection
in interfaceCollectionHandler<HashSet<Route>,
Route> - Returns:
- Current collection
-
setCollection
Overrides current collection by provided value.- Specified by:
setCollection
in interfaceCollectionHandler<HashSet<Route>,
Route> - Parameters:
routes
- Collection
-
addElementToCollection
Adds element to collection.- Specified by:
addElementToCollection
in interfaceCollectionHandler<HashSet<Route>,
Route> - Parameters:
e
- Element to add
-
clearCollection
public void clearCollection()Description copied from interface:CollectionHandler
Provides method for fast clear element in collection.- Specified by:
clearCollection
in interfaceCollectionHandler<HashSet<Route>,
Route>
-
sort
public void sort()Sorts elements by ID Field in Route.- Specified by:
sort
in interfaceCollectionHandler<HashSet<Route>,
Route>
-
getFirstOrNew
Returns first element of collection.- Specified by:
getFirstOrNew
in interfaceCollectionHandler<HashSet<Route>,
Route> - Returns:
- First element of collection. If collection is empty, returns new object.
-
getInitDate
Description copied from interface:CollectionHandler
Provides method for get collection initDate.- Specified by:
getInitDate
in interfaceCollectionHandler<HashSet<Route>,
Route> - Returns:
- Date instance -- Collection created time.
- See Also:
-
getLastElement
Returns last element of collection.- Specified by:
getLastElement
in interfaceCollectionHandler<HashSet<Route>,
Route> - Returns:
- Last element of collection of null if collection is empty
-
validateElements
public void validateElements()Validates all elements in collection- Specified by:
validateElements
in interfaceCollectionHandler<HashSet<Route>,
Route>
-
getMin
Gets min element by given comparator- Specified by:
getMin
in interfaceCollectionHandler<HashSet<Route>,
Route> - Parameters:
comparator
- Comparator to compare.- Returns:
- Min element or null if collection is empty
-
getMax
Gets max element by given comparator- Specified by:
getMax
in interfaceCollectionHandler<HashSet<Route>,
Route> - Parameters:
comparator
- Comparator to compare.- Returns:
- Max element or null if collection is empty
-