Top Description Fields Constructors Methods
tools.jackson.core.sym

public final Class BinaryNameMatcher

extends HashedMatcherBase
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.nio.charset.StandardCharsets, java.util.Arrays, .List, .Locale, tools.jackson.core.util.Named

Simplified static symbol table used instead of global quad-based canonicalizer when we have smaller set of symbols (like properties of a POJO class).
Since
3.0

Field Summary

Modifier and TypeField and Description
private int
_count

Total number of Strings in the symbol table

private int[]
_hashArea

Primary hash information area: consists of 2 * _hashSize entries of 16 bytes (4 ints), arranged in a cascading lookup structure (details of which may be tweaked depending on expected rates of collisions).

private int
_hashSize

Number of slots for primary entries within _hashArea; which is at most 1/8 of actual size of the underlying array (4-int slots, primary covers only half of the area; plus, additional area for longer symbols after hash area).

private int
_longNameOffset

Offset within _hashArea that follows main slots and contains quads for longer names (13 bytes or longer), and points to the first available int that may be used for appending quads of the next long name.

private int
_secondaryStart

Offset within _hashArea where secondary entries start

private int
_spilloverEnd

Pointer to the offset within spill-over area where there is room for more spilled over entries (if any).

private int
_tertiaryShift

Constant that determines size of buckets for tertiary entries: 1 << _tertiaryShift is the size, and shift value is also used for translating from primary offset into tertiary bucket (shift right by 4 + _tertiaryShift).

private int
_tertiaryStart

Offset within _hashArea where tertiary entries start

public static final int
private static final int
private static final int
private static final int
private static final int
private static final long
Inherited from tools.jackson.core.sym.HashedMatcherBase:
_mask_names_offsets

Constructor Summary

AccessConstructor and Description
private
BinaryNameMatcher(SimpleNameMatcher
Backup matcher used if efficient primary matching cannot be used
matcher
,
String[]
Set of names to match
nameLookup
,
int
Estimated basic hash area size to use (slightly bigger than number of entries in nameLookup array
hashSize
)

Constructor used for creating per-TokenStreamFactory "root" symbol tables (for formats that use such approach): ones used for merging and sharing common symbols

Method Summary

Modifier and TypeMethod and Description
private int
_appendLongName(int[] quads, int qlen)

private final int
_calcOffset(int hash)

pack-priv static int
_calcTertiaryShift(int primarySlots)

private static BinaryNameMatcher
private static int
_decodeFull(byte[] b, int offset)

private static int
_decodeLast(byte[] b, int offset, int bytes)

private int
_findOffsetForAdd(int hash)

Method called to find the location within hash table to add a new symbol in.

private int
_findTertiary(int origOffset, int q1)

private int
_findTertiary(int origOffset, int q1, int q2)

private int
_findTertiary(int origOffset, int q1, int q2, int q3)

private int
_findTertiary(int origOffset, int hash, int[] q, int qlen)

private int
_lengthAndIndex(int qlen)

public static int[]
_quads(String name)

private int
_spilloverStart()

Helper method that calculates start of the spillover area

private boolean
_verifyLongName(int[] q, int qlen, int spillOffset)

private boolean
_verifyLongName2(int[] q, int qlen, int spillOffset)

public int
private int
addName(String name, int q1)

private int
addName(String name, int q1, int q2)

private int
addName(String name, int q1, int q2, int q3)

private int
addName(String name, int[] q, int qlen)

public int
public int
calcHash(int q1)

public int
calcHash(int q1, int q2)

public int
calcHash(int q1, int q2, int q3)

public int
calcHash(int[] q, int qlen)

public static BinaryNameMatcher
construct(List<String> symbols)

public static BinaryNameMatcher
constructCaseInsensitive(Locale locale, List<Named> propertyNames, boolean alreadyInterned)

public static BinaryNameMatcher
constructFrom(List<Named> propertyNames, boolean alreadyInterned)

public int
public int
public int
matchByQuad(int q1, int q2, int q3)

Implements abstract tools.jackson.core.sym.PropertyNameMatcher.matchByQuad.

public int
public int
public int
public int
size()

public int
public int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public int
Inherited from tools.jackson.core.sym.HashedMatcherBase:
_matchSpillmatchNamesecondaryCountspillCount

Field Detail

_countback to summary
private int _count

Total number of Strings in the symbol table

_hashAreaback to summary
private int[] _hashArea

Primary hash information area: consists of 2 * _hashSize entries of 16 bytes (4 ints), arranged in a cascading lookup structure (details of which may be tweaked depending on expected rates of collisions).

_hashSizeback to summary
private int _hashSize

Number of slots for primary entries within _hashArea; which is at most 1/8 of actual size of the underlying array (4-int slots, primary covers only half of the area; plus, additional area for longer symbols after hash area).

_longNameOffsetback to summary
private int _longNameOffset

Offset within _hashArea that follows main slots and contains quads for longer names (13 bytes or longer), and points to the first available int that may be used for appending quads of the next long name. Note that long name area follows immediately after the fixed-size main hash area (_hashArea).

_secondaryStartback to summary
private int _secondaryStart

Offset within _hashArea where secondary entries start

_spilloverEndback to summary
private int _spilloverEnd

Pointer to the offset within spill-over area where there is room for more spilled over entries (if any). Spill over area is within fixed-size portion of _hashArea.

_tertiaryShiftback to summary
private int _tertiaryShift

Constant that determines size of buckets for tertiary entries: 1 << _tertiaryShift is the size, and shift value is also used for translating from primary offset into tertiary bucket (shift right by 4 + _tertiaryShift).

Default value is 2, for buckets of 4 slots; grows bigger with bigger table sizes.

_tertiaryStartback to summary
private int _tertiaryStart

Offset within _hashArea where tertiary entries start

MAX_ENTRIESback to summary
public static final int MAX_ENTRIES
MAX_LENGTH_IN_QUADSback to summary
private static final int MAX_LENGTH_IN_QUADS
MULTback to summary
private static final int MULT
MULT2back to summary
private static final int MULT2
MULT3back to summary
private static final int MULT3
serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.core.sym.HashedMatcherBase.serialVersionUID.

Constructor Detail

BinaryNameMatcherback to summary
private BinaryNameMatcher(SimpleNameMatcher matcher, String[] nameLookup, int hashSize)

Constructor used for creating per-TokenStreamFactory "root" symbol tables (for formats that use such approach): ones used for merging and sharing common symbols

Parameters
matcher:SimpleNameMatcher

Backup matcher used if efficient primary matching cannot be used

nameLookup:String[]

Set of names to match

hashSize:int

Estimated basic hash area size to use (slightly bigger than number of entries in nameLookup array

Method Detail

_appendLongNameback to summary
private int _appendLongName(int[] quads, int qlen)
_calcOffsetback to summary
private final int _calcOffset(int hash)
_calcTertiaryShiftback to summary
pack-priv static int _calcTertiaryShift(int primarySlots)
_constructback to summary
private static BinaryNameMatcher _construct(List<String> symbols, SimpleNameMatcher base)
_decodeFullback to summary
private static int _decodeFull(byte[] b, int offset)
_decodeLastback to summary
private static int _decodeLast(byte[] b, int offset, int bytes)
_findOffsetForAddback to summary
private int _findOffsetForAdd(int hash)

Method called to find the location within hash table to add a new symbol in.

_findTertiaryback to summary
private int _findTertiary(int origOffset, int q1)
_findTertiaryback to summary
private int _findTertiary(int origOffset, int q1, int q2)
_findTertiaryback to summary
private int _findTertiary(int origOffset, int q1, int q2, int q3)
_findTertiaryback to summary
private int _findTertiary(int origOffset, int hash, int[] q, int qlen)
_lengthAndIndexback to summary
private int _lengthAndIndex(int qlen)
_quadsback to summary
public static int[] _quads(String name)
_spilloverStartback to summary
private int _spilloverStart()

Helper method that calculates start of the spillover area

_verifyLongNameback to summary
private boolean _verifyLongName(int[] q, int qlen, int spillOffset)
_verifyLongName2back to summary
private boolean _verifyLongName2(int[] q, int qlen, int spillOffset)
addNameback to summary
public int addName(String name)
addNameback to summary
private int addName(String name, int q1)
addNameback to summary
private int addName(String name, int q1, int q2)
addNameback to summary
private int addName(String name, int q1, int q2, int q3)
addNameback to summary
private int addName(String name, int[] q, int qlen)
bucketCountback to summary
public int bucketCount()
calcHashback to summary
public int calcHash(int q1)
calcHashback to summary
public int calcHash(int q1, int q2)
calcHashback to summary
public int calcHash(int q1, int q2, int q3)
calcHashback to summary
public int calcHash(int[] q, int qlen)
constructback to summary
public static BinaryNameMatcher construct(List<String> symbols)
constructCaseInsensitiveback to summary
public static BinaryNameMatcher constructCaseInsensitive(Locale locale, List<Named> propertyNames, boolean alreadyInterned)
constructFromback to summary
public static BinaryNameMatcher constructFrom(List<Named> propertyNames, boolean alreadyInterned)
matchByQuadback to summary
public int matchByQuad(int q1)

Implements abstract tools.jackson.core.sym.PropertyNameMatcher.matchByQuad.

Annotations
@Override
matchByQuadback to summary
public int matchByQuad(int q1, int q2)

Implements abstract tools.jackson.core.sym.PropertyNameMatcher.matchByQuad.

Annotations
@Override
matchByQuadback to summary
public int matchByQuad(int q1, int q2, int q3)

Implements abstract tools.jackson.core.sym.PropertyNameMatcher.matchByQuad.

Annotations
@Override
matchByQuadback to summary
public int matchByQuad(int[] q, int qlen)

Implements abstract tools.jackson.core.sym.PropertyNameMatcher.matchByQuad.

Annotations
@Override
primaryQuadCountback to summary
public int primaryQuadCount()
secondaryQuadCountback to summary
public int secondaryQuadCount()
sizeback to summary
public int size()
spilloverQuadCountback to summary
public int spilloverQuadCount()
tertiaryQuadCountback to summary
public int tertiaryQuadCount()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
totalCountback to summary
public int totalCount()