Top Description Fields Constructors Methods
com.amazon.ion.impl

pack-priv Class SymbolTableStructCache

extends Object
Class Inheritance
Imports
com.amazon.ion.IonList, .IonStruct, .IonType, .IonValue, .SymbolTable, .ValueFactory, java.util.Iterator

Caches the IonStruct representation of a SymbolTable.

Field Summary

Modifier and TypeField and Description
private final int
private IonStruct
image

Memoized result of getIonRepresentation(ValueFactory); Once this is created, it may be mutated as symbols are added using addSymbol(String, int).

private final SymbolTable[]
private final SymbolTable

Constructor Summary

AccessConstructor and Description
pack-priv
SymbolTableStructCache(SymbolTable
the SymbolTable to represent as an IonStruct.
symbolTable
,
SymbolTable[]
the symbol table's imported shared symbol tables.
importedTables
,
IonStruct
the IonStruct representation, if available. If null, an IonStruct will be created lazily.
image
)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addSymbol(String
can be null when there's a gap in the local symbols list.
symbolName
,
int
the symbol ID to assign to the new symbol.
sid
)

Adds a new symbol table with the given symbol ID to the IonStruct's 'symbols' list.

public IonStruct

Returns:

an IonStruct representing the symbol table.
getIonRepresentation
(ValueFactory
the ValueFactory from which to construct the IonStruct.
factory
)

Returns the IonStruct representation of the symbol table.

public boolean

Returns:

true if an IonStruct has already been created for the symbol table; otherwise, false.
hasStruct
()

private void
makeIonRepresentation(ValueFactory
the ValueFactory from which to construct the IonStruct.
factory
)

Create a new IonStruct representation of the symbol table.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstLocalSidback to summary
private final int firstLocalSid
imageback to summary
private IonStruct image

Memoized result of getIonRepresentation(ValueFactory); Once this is created, it may be mutated as symbols are added using addSymbol(String, int).

importedTablesback to summary
private final SymbolTable[] importedTables
symbolTableback to summary
private final SymbolTable symbolTable

Constructor Detail

SymbolTableStructCacheback to summary
pack-priv SymbolTableStructCache(SymbolTable symbolTable, SymbolTable[] importedTables, IonStruct image)
Parameters
symbolTable:SymbolTable

the SymbolTable to represent as an IonStruct.

importedTables:SymbolTable[]

the symbol table's imported shared symbol tables.

image:IonStruct

the IonStruct representation, if available. If null, an IonStruct will be created lazily.

Method Detail

addSymbolback to summary
pack-priv void addSymbol(String symbolName, int sid)

Adds a new symbol table with the given symbol ID to the IonStruct's 'symbols' list.

Parameters
symbolName:String

can be null when there's a gap in the local symbols list.

sid:int

the symbol ID to assign to the new symbol.

getIonRepresentationback to summary
public IonStruct getIonRepresentation(ValueFactory factory)

Returns the IonStruct representation of the symbol table. Creates and stores a new IonStruct on the first invocation.

Parameters
factory:ValueFactory

the ValueFactory from which to construct the IonStruct.

Returns:IonStruct

an IonStruct representing the symbol table.

hasStructback to summary
public boolean hasStruct()
Returns:boolean

true if an IonStruct has already been created for the symbol table; otherwise, false.

makeIonRepresentationback to summary
private void makeIonRepresentation(ValueFactory factory)

Create a new IonStruct representation of the symbol table.

Parameters
factory:ValueFactory

the ValueFactory from which to construct the IonStruct.