Record Class Quad

java.lang.Object
java.lang.Record
io.datarouter.types.Quad
All Implemented Interfaces:
Comparable<Quad>

public record Quad(long bits) extends Record implements Comparable<Quad>
Represents a Microsoft style String "quad" like 03112003 in a 64 bit long. https://learn.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system The leftmost bit is blank. The last 5 bits represent the level which can be 0 through 29. The 58 remaining "grid" bits are left justified so that the "bits" field can also be used as an efficient hashCode y is the direction that is shifted left one bit Natural ordering is the same as ordering Microsoft style quad strings
  • Field Details

    • TOP_QUAD

      public static final Quad TOP_QUAD
    • EMPTY_STRING_QUAD

      public static final Quad EMPTY_STRING_QUAD
    • SIXTEEN_ZERO_STRING

      public static final String SIXTEEN_ZERO_STRING
      See Also:
    • RIGHT_BIT_TABLE_MASK

      public static final int RIGHT_BIT_TABLE_MASK
      See Also:
    • RIGHT_BIT_LOOK_UP_TABLE

      public static final int[] RIGHT_BIT_LOOK_UP_TABLE
  • Constructor Details

    • Quad

      public Quad()
    • Quad

      public Quad(long bits)
      Creates an instance of a Quad record class.
      Parameters:
      bits - the value for the bits record component
    • Quad

      public Quad(long level, long xPosition, long yPosition)
    • Quad

      public Quad(String str)
  • Method Details

    • getNumQuadsAcross

      public long getNumQuadsAcross()
    • isRoot

      public boolean isRoot()
    • getAtLevel

      public Quad getAtLevel(int level)
    • getLastPossibleSubQuad

      public Quad getLastPossibleSubQuad()
    • getLastPossibleSubQuadAtLevel

      public Quad getLastPossibleSubQuadAtLevel(int level)
    • getLevel

      public int getLevel()
    • getX

      public long getX()
    • getY

      public long getY()
    • isXEven

      public boolean isXEven()
    • isYEven

      public boolean isYEven()
    • getGridBits

      public long getGridBits()
    • getParent

      public Quad getParent()
    • getChildren

      public List<Quad> getChildren()
    • getDescendantAtLevel

      public List<Quad> getDescendantAtLevel(int level)
    • get3Siblings

      public List<Quad> get3Siblings()
    • isParentOfOrEqualTo

      public boolean isParentOfOrEqualTo(Quad other)
    • isChildOfOrEqualTo

      public boolean isChildOfOrEqualTo(Quad other)
    • isChildOf

      public boolean isChildOf(Quad other)
    • shiftLeft

      public Quad shiftLeft()
    • shiftRight

      public Quad shiftRight()
    • shiftUp

      public Quad shiftUp()
    • shiftDown

      public Quad shiftDown()
    • toMicrosoftStyleString

      public String toMicrosoftStyleString()
    • getMicrosoftStyleString

      @Deprecated public String getMicrosoftStyleString()
      Deprecated.
    • getLastPossibleSubQuadFromString

      public static String getLastPossibleSubQuadFromString(String quadString)
    • fromMicrosoftStyleStrings

      public static List<Quad> fromMicrosoftStyleStrings(Collection<String> microsoftStrings)
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • compareTo

      public int compareTo(Quad other)
      Specified by:
      compareTo in interface Comparable<Quad>
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • bits

      public long bits()
      Returns the value of the bits record component.
      Returns:
      the value of the bits record component