Package bit.connect
Class Grid
java.lang.Object
bit.connect.Grid
Represents a grid in a coordinate system.
A grid is defined by its ID, latitude and longitude bounds, and the list of current users within the grid.
It also maintains a mapping of users and their matched students.
-
Constructor Summary
ConstructorsConstructorDescriptionGrid
(int id, double lowerLat, double higherLat, double lowerLong, double higherLong) Class constructor. -
Method Summary
-
Constructor Details
-
Grid
public Grid(int id, double lowerLat, double higherLat, double lowerLong, double higherLong) Class constructor.- Parameters:
id
- defining number for each grid sectionlowerLat
- lower bound for latitudehigherLat
- higher bound for latitudelowerLong
- lower bound for longitudehigherLong
- higher bound for longitude
-
-
Method Details
-
refresh
public void refresh()Refreshes the grid by updating the list of current users and their matches. This method clears the current user list and user match map, and then iterates through the active users. For each active user, it checks if their current location falls within the specified latitude and longitude bounds. If a user's location is within the bounds, they are added to the current user list and a new empty list is created for their matches. Finally, it iterates through the current user list and checks for matches between users based on their filters. If a match is found, it inserts the users into each other's match lists. -
getId
public int getId()Returns the ID of the grid.- Returns:
- the ID of the grid
-