Package bit.connect

Class Grid

java.lang.Object
bit.connect.Grid

public class Grid extends Object
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

    Constructors
    Constructor
    Description
    Grid(int id, double lowerLat, double higherLat, double lowerLong, double higherLong)
    Class constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the ID of the grid.
    void
    Refreshes the grid by updating the list of current users and their matches.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Grid

      public Grid(int id, double lowerLat, double higherLat, double lowerLong, double higherLong)
      Class constructor.
      Parameters:
      id - defining number for each grid section
      lowerLat - lower bound for latitude
      higherLat - higher bound for latitude
      lowerLong - lower bound for longitude
      higherLong - 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