Package com.adobe.xfa

Class SchemaStrings


  • public class SchemaStrings
    extends java.lang.Object
    This class is used to correlate schema strings to their eTag (int) values. The lookup mechanism is unique in that we want to avoid string comparisons at all costs. Lookups are based on the fact that all Strings are interned and we match by string identity.
    The lookup algorithm is a simple fixed-size hash table. The table size is always a power of 2, which is typically not ideal for linear probing, but using a prime number (and the associated modulus operation) would make the lookup significantly more expensive.
    • Constructor Summary

      Constructors 
      Constructor Description
      SchemaStrings​(int size)
      Constructor that allocates our internal data structures to the specified size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getInt​(java.lang.String sStr)
      Find the tag integer matching this schema string
      void put​(java.lang.String sStr, int eTag)
      This method populates the data structures.
      • Methods inherited from class java.lang.Object

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

      • SchemaStrings

        public SchemaStrings​(int size)
        Constructor that allocates our internal data structures to the specified size.
        Parameters:
        size - - the size of our internal arrays. (They can't grow!)
    • Method Detail

      • put

        public void put​(java.lang.String sStr,
                        int eTag)
        This method populates the data structures. It assumes that the array does not need to be resized.
        Parameters:
        sStr - the String to add.
        eTag - the corresponding eTag
      • getInt

        public int getInt​(java.lang.String sStr)
        Find the tag integer matching this schema string
        Parameters:
        sStr - the schema string to look up.
        Returns:
        the corresponding tag. -1 if not found.