Package com.iizix.server.geo
Class UserLocationHistory
java.lang.Object
com.iizix.server.geo.UserLocationHistory
- All Implemented Interfaces:
- IUserLocationHistory
The implementation of the user location history.
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- boolean- addLocationListener- (IAppSessionGyro appGyro, IUserLocationListener listener) Adds a listener for changes in the user's location.- boolean- addLocationListener- (IClientSessionGyro clientGyro, IUserLocationListener listener) Adds a listener for changes in the user's location.- booleanChecks for equality.- findNearbyUsers- (double maximumDistance, long maximumAge, boolean useAltitude) Finds nearby users from the latest known location in history with a max given distance and a maximum age of the users location.Returns the latest known location of the user received by the server (approximation).Returns the array of user locations.Returns the authenticated user.- int- hashCode()Gets the hash code.- boolean- removeLocationListener- (IUserLocationListener listener) Removes a listener for changes in the user's location.- toString()String representation of the class.- Methods inherited from class java.lang.Object- clone, finalize, getClass, notify, notifyAll, wait, wait, wait- Methods inherited from interface com.iizix.user.geo.IUserLocationHistory- findNearbyUsers
- Constructor Details- UserLocationHistoryConstructor.- Parameters:
- user- The authenticated user.
 
 
- Method Details- getUserInformationReturns the authenticated user.- Specified by:
- getUserInformationin interface- IUserLocationHistory
- Returns:
- The user.
 
- getLocationsReturns the array of user locations.- Specified by:
- getLocationsin interface- IUserLocationHistory
- Returns:
- The array of user locations.
 
- getLatestLocationReturns the latest known location of the user received by the server (approximation). Two locations with very close timestamp might be interchanged. This method returns the last added location from an array of locations.- Specified by:
- getLatestLocationin interface- IUserLocationHistory
- Returns:
- The most up-to-date location of the user, or null if none is found.
 
- findNearbyUsersFinds nearby users from the latest known location in history with a max given distance and a maximum age of the users location.- The distance uses the Haversine method for calculation. - Specified by:
- findNearbyUsersin interface- IUserLocationHistory
- Parameters:
- maximumDistance- The maximum distance in meters.
- maximumAge- The maximum age of the users location in milliseconds.
- useAltitude- Flag to use the altitude in the distance calculation or not.
- Returns:
- A list of nearby users. Do not assume that the list is sorted by timestamp.
 
- addLocationListenerAdds a listener for changes in the user's location. This method will add a dispose listener to the client session and remove the listener if not already done.- Calling this method twice with the same listener will not cause it to be added again. - Specified by:
- addLocationListenerin interface- IUserLocationHistory
- Parameters:
- appGyro- The client session owning the listener.
- listener- The listener.
- Returns:
- true for success, false if listener is already added or if client session is disposed of.
 
- addLocationListenerAdds a listener for changes in the user's location. This method will add a dispose listener to the client session and remove the listener if not already done.- Calling this method twice with the same listener will not cause it to be added again. - Specified by:
- addLocationListenerin interface- IUserLocationHistory
- Parameters:
- clientGyro- The client session owning the listener.
- listener- The listener.
- Returns:
- true for success, false if listener is already added or if client session is disposed of.
 
- removeLocationListenerRemoves a listener for changes in the user's location.- Specified by:
- removeLocationListenerin interface- IUserLocationHistory
- Parameters:
- listener- The listener.
- Returns:
- true for success, false if listener is not previously added or has been removed.
 
- equalsChecks for equality.
- hashCodepublic int hashCode()Gets the hash code.
- toStringString representation of the class.