Package com.adobe.xfa

Class SchemaStrings


  • public class SchemaStrings
    extends 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 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​(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​(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.