Package worldBuilder

Class MeshPointHasher


  • public class MeshPointHasher
    extends java.lang.Object
    class generates a single unique MapPoint for each unique coordinate pair, and find the already allocated point when coordinates are repeated. I have chosen to do this with an open hash table for time efficiency.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int numVertices
      number of (already) recorded MeshPoints
      MeshPoint[] vertices
      list of (already) recorded MeshPoints
    • Constructor Summary

      Constructors 
      Constructor Description
      MeshPointHasher​(int max, double x_extent, double y_extent)
      allocate a hash table and vertex list
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MeshPoint findPoint​(double x, double y)
      find or create reference to MeshPoint at MapPoint(x,y)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • numVertices

        public int numVertices
        number of (already) recorded MeshPoints
      • vertices

        public MeshPoint[] vertices
        list of (already) recorded MeshPoints
    • Constructor Detail

      • MeshPointHasher

        public MeshPointHasher​(int max,
                               double x_extent,
                               double y_extent)
        allocate a hash table and vertex list
        Parameters:
        max - ... max # of vertices
        x_extent - ... x diameter (in -0.5 to 0.5 map coordinates)
        y_extent - ... y_diameter (in -0.5 to 0.5 map coordinates)
    • Method Detail

      • findPoint

        public MeshPoint findPoint​(double x,
                                   double y)
        find or create reference to MeshPoint at MapPoint(x,y)
        Parameters:
        x - desired location (in -0.5 to 0.5 map coordinates)
        y - desired location (in -0.5 to 0.5 map coordinates)
        Returns:
        new (or already associated) MeshPoint We use an open hash table to note index associated w/each hash value