Package com.amazon.ion.system
Class SimpleCatalog
java.lang.Object
com.amazon.ion.system.SimpleCatalog
- All Implemented Interfaces:
IonCatalog,IonMutableCatalog,Iterable<SymbolTable>
A basic implementation of
IonCatalog as a hash table. There is no
automatic removal of entries.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets a symbol table with a specific name and the highest version possible.Gets a desired symbol table from this catalog, using an exact match if possible.iterator()Constructs an iterator that enumerates all of the shared symbol tables in this catalog, at the time of method invocation.voidputTable(SymbolTable table) Adds a symbol table to this catalog.removeTable(String name, int version) Removes a symbol table from this catalog.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SimpleCatalog
public SimpleCatalog()
-
-
Method Details
-
getTable
Description copied from interface:IonCatalogGets a symbol table with a specific name and the highest version possible.- Specified by:
getTablein interfaceIonCatalog- Parameters:
name- identifies the desired symbol table.- Returns:
- a shared symbol table with the given name, or
nullif this catalog has no table with the name.
-
getTable
Description copied from interface:IonCatalogGets a desired symbol table from this catalog, using an exact match if possible.Implentations must make a best effort to find an exact match. If an exact match cannot be found, then this method must make a best effort to find the best match available.
- Specified by:
getTablein interfaceIonCatalog- Returns:
- the shared symbol table with the given name and version, when an
exact match is possible. Otherwise, returns the lowest possible version
larger than requested. Otherwise, return the largest possible version
lower than requested. If no table with the name can be found, then
this method returns
null.
-
putTable
Description copied from interface:IonMutableCatalogAdds a symbol table to this catalog. This interface does not define the behavior of this method if this catalog already contains a table with the same name and version.- Specified by:
putTablein interfaceIonMutableCatalog- Parameters:
table- must be shared but not a system table or substitute table.
-
removeTable
Removes a symbol table from this catalog.- Returns:
- the removed table, or
nullif this catalog has no matching table.
-
iterator
Constructs an iterator that enumerates all of the shared symbol tables in this catalog, at the time of method invocation. The result represents a snapshot of the state of this catalog.- Specified by:
iteratorin interfaceIterable<SymbolTable>- Returns:
- a non-null, but potentially empty, iterator.
-