java.lang.Object
java.lang.Record
org.aya.resolve.context.ModuleSymbol<T>
- Record Components:
table- `Unqualified -> (Component -> Symbol)`
It says a `Symbol` can be referred by `{Component}::{Unqualified}`
public record ModuleSymbol<T>(@NotNull kala.collection.mutable.MutableMap<String,kala.collection.mutable.MutableMap<ModuleName,T>> table)
extends Record
A container of symbols.
- API Note:
- the methods that end with `Definitely` will get/remove only one symbol or fail if ambiguous.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionModuleSymbol(@NotNull kala.collection.mutable.MutableMap<String, kala.collection.mutable.MutableMap<ModuleName, T>> table) Creates an instance of aModuleSymbolrecord class.ModuleSymbol(@NotNull ModuleSymbol<T> other) -
Method Summary
Modifier and TypeMethodDescriptionkala.control.Option<T>add(@NotNull ModuleName componentName, @NotNull String name, T ref) Adding a new symbol which can be referred by `{componentName}::{name}`booleanbooleancontains(@NotNull ModuleName component, @NotNull String unqualified) final booleanIndicates whether some other object is "equal to" this one.voidforEach(@NotNull BiConsumer<String, kala.collection.Map<ModuleName, T>> action) @NotNull kala.control.Result<T,ModuleSymbol.Error> getMaybe(@NotNull ModuleName component, @NotNull String unqualifiedName) Trying to get a symbol of an optional component and an unqualified name.@NotNull kala.control.Option<T>getQualifiedMaybe(@NotNull ModuleName component, @NotNull String unqualifiedName) Getting a symbol of an unqualified name in component@NotNull kala.control.Result<T,ModuleSymbol.Error> getUnqualifiedMaybe(@NotNull String unqualifiedName) Trying to get a symbol of an unqualified name definitely.final inthashCode()Returns a hash code value for this object.@NotNull kala.collection.SetView<String>keysView()kala.control.Option<T>remove(@NotNull ModuleName component, @NotNull String unqualifiedName) kala.control.Result<T,ModuleSymbol.Error> removeDefinitely(@NotNull String unqualifiedName) kala.control.Result<T,ModuleSymbol.Error> removeDefinitely(@NotNull ModuleName component, @NotNull String unqualifiedName) @NotNull kala.collection.mutable.MutableMap<ModuleName,T> resolveUnqualified(@NotNull String unqualifiedName) Getting the candidates of an unqualified name@NotNull kala.collection.mutable.MutableMap<String,kala.collection.mutable.MutableMap<ModuleName, T>> table()Returns the value of thetablerecord component.final StringtoString()Returns a string representation of this record class.@NotNull kala.collection.MapView<String,kala.collection.Map<ModuleName, T>> view()
-
Constructor Details
-
ModuleSymbol
public ModuleSymbol() -
ModuleSymbol
-
ModuleSymbol
public ModuleSymbol(@NotNull @NotNull kala.collection.mutable.MutableMap<String, kala.collection.mutable.MutableMap<ModuleName, T>> table) Creates an instance of aModuleSymbolrecord class.- Parameters:
table- the value for thetablerecord component
-
-
Method Details
-
resolveUnqualified
@NotNull public @NotNull kala.collection.mutable.MutableMap<ModuleName,T> resolveUnqualified(@NotNull @NotNull String unqualifiedName) Getting the candidates of an unqualified name- Parameters:
unqualifiedName- the unqualified name- Returns:
- the candidates, probably empty
-
getQualifiedMaybe
@NotNull public @NotNull kala.control.Option<T> getQualifiedMaybe(@NotNull @NotNull ModuleName component, @NotNull @NotNull String unqualifiedName) Getting a symbol of an unqualified name in component- Parameters:
component- the componentunqualifiedName- the unqualified name- Returns:
- none if not found
-
getUnqualifiedMaybe
@NotNull public @NotNull kala.control.Result<T,ModuleSymbol.Error> getUnqualifiedMaybe(@NotNull @NotNull String unqualifiedName) Trying to get a symbol of an unqualified name definitely.- Parameters:
unqualifiedName- the unqualified name
-
getMaybe
@NotNull public @NotNull kala.control.Result<T,ModuleSymbol.Error> getMaybe(@NotNull @NotNull ModuleName component, @NotNull @NotNull String unqualifiedName) Trying to get a symbol of an optional component and an unqualified name.- Parameters:
component- an optional component, none if `This`unqualifiedName- the unqualified name
-
contains
-
contains
public boolean contains(@NotNull @NotNull ModuleName component, @NotNull @NotNull String unqualified) -
add
public kala.control.Option<T> add(@NotNull @NotNull ModuleName componentName, @NotNull @NotNull String name, @NotNull T ref) Adding a new symbol which can be referred by `{componentName}::{name}`- Implementation Note:
- This method always overwrites the symbol that is added in the past.
-
remove
public kala.control.Option<T> remove(@NotNull @NotNull ModuleName component, @NotNull @NotNull String unqualifiedName) -
removeDefinitely
public kala.control.Result<T,ModuleSymbol.Error> removeDefinitely(@NotNull @NotNull String unqualifiedName) -
removeDefinitely
public kala.control.Result<T,ModuleSymbol.Error> removeDefinitely(@NotNull @NotNull ModuleName component, @NotNull @NotNull String unqualifiedName) -
keysView
-
view
-
forEach
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
table
@NotNull public @NotNull kala.collection.mutable.MutableMap<String,kala.collection.mutable.MutableMap<ModuleName, table()T>> Returns the value of thetablerecord component.- Returns:
- the value of the
tablerecord component
-