Package crosby.binary

Class StringTable


  • public class StringTable
    extends java.lang.Object
    Class for mapping a set of strings to integers, giving frequently occurring strings small integers.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<java.lang.String,​java.lang.Integer> counts  
      private java.lang.String[] set  
      private java.util.HashMap<java.lang.String,​java.lang.Integer> stringmap  
    • Constructor Summary

      Constructors 
      Constructor Description
      StringTable()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      void finish()  
      int getIndex​(java.lang.String s)
      After the stringtable has been built, return the offset of a string in it.
      void incr​(java.lang.String s)
      Increments the count of the given string
      Osmformat.StringTable.Builder serialize()  
      • Methods inherited from class java.lang.Object

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

      • counts

        private java.util.HashMap<java.lang.String,​java.lang.Integer> counts
      • stringmap

        private java.util.HashMap<java.lang.String,​java.lang.Integer> stringmap
      • set

        private java.lang.String[] set
    • Constructor Detail

      • StringTable

        public StringTable()
    • Method Detail

      • incr

        public void incr​(java.lang.String s)
        Increments the count of the given string
        Parameters:
        s - the string
      • getIndex

        public int getIndex​(java.lang.String s)
        After the stringtable has been built, return the offset of a string in it. Note, value '0' is reserved for use as a delimiter and will not be returned.
        Parameters:
        s - the string to lookup
        Returns:
        the offset of the string
      • finish

        public void finish()
      • clear

        public void clear()