@Immutable
public class SymbolTable
extends java.lang.Object
A symbol table keeps a list of instances of Symbol, each one with a unique pair
class / name. Tables have two main attributes: a name and package. These should be unique and
are used to generate the R.java file. Actually, the name of the table is the class name
and the package is the java package so, traditionally, all symbol tables are named R.
| Modifier and Type | Class and Description |
|---|---|
static class |
SymbolTable.Builder
Builder that creates a symbol table.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableCollection<Symbol> |
allSymbols()
Obtains all symbols in the table.
|
static SymbolTable.Builder |
builder()
Creates a new builder to create a
SymbolTable. |
boolean |
contains(java.lang.String resourceType,
java.lang.String name)
Checks if the table contains a symbol with the given resource type / name.
|
boolean |
equals(java.lang.Object obj) |
SymbolTable |
filter(SymbolTable table)
Produces a subset of this symbol table that has the symbols with resource type / name defined
in
filter. |
java.lang.String |
getTableName()
Obtains the table name.
|
java.lang.String |
getTablePackage()
Obtains the table package.
|
int |
hashCode() |
static SymbolTable |
merge(java.util.List<SymbolTable> tables)
Merges a list of tables into a single table.
|
SymbolTable |
merge(SymbolTable m)
Short for merging
this and m. |
SymbolTable |
rename(java.lang.String tablePackage,
java.lang.String tableName)
Builds a new symbol table that has the same symbols as this one, but was renamed with
the given package and table name.
|
@NonNull public java.lang.String getTableName()
@NonNull public java.lang.String getTablePackage()
public boolean contains(@NonNull
java.lang.String resourceType,
@NonNull
java.lang.String name)
resourceType - the resource typename - the name@NonNull public com.google.common.collect.ImmutableCollection<Symbol> allSymbols()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object@NonNull public SymbolTable filter(@NonNull SymbolTable table)
filter. In other words, a symbol s will exist in the result if and only
if s exists in this and there is a symbol s1 in table
such that s.resourceType == s1.resourceType && s.name == s1.name.table - the filter table@NonNull public SymbolTable merge(@NonNull SymbolTable m)
this and m.m - the table to add to thisthis with m@NonNull public SymbolTable rename(@NonNull java.lang.String tablePackage, @NonNull java.lang.String tableName)
tablePackage - the table packagetableName - the table name@NonNull public static SymbolTable merge(@NonNull java.util.List<SymbolTable> tables)
tables - the tables to mergetables, or the default one if there are no tables in
tables@NonNull public static SymbolTable.Builder builder()
SymbolTable.