Package com.adobe.xfa
Class SchemaStrings
java.lang.Object
com.adobe.xfa.SchemaStrings
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.
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
ConstructorsConstructorDescriptionSchemaStrings(int size) Constructor that allocates our internal data structures to the specified size. -
Method Summary
-
Constructor Details
-
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 Details
-
put
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
Find the tag integer matching this schema string- Parameters:
sStr- the schema string to look up.- Returns:
- the corresponding tag. -1 if not found.
-