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<org.aya.syntax.concrete.stmt.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 ClassesModifier and TypeClassDescriptionstatic enumstatic final record -
Constructor Summary
ConstructorsConstructorDescriptionModuleSymbol(@NotNull kala.collection.mutable.MutableMap<String, kala.collection.mutable.MutableMap<org.aya.syntax.concrete.stmt.ModuleName, T>> table) Creates an instance of aModuleSymbolrecord class.ModuleSymbol(@NotNull ModuleSymbol<T> other) -
Method Summary
Modifier and TypeMethodDescriptionkala.control.Option<T> Adding a new symbol which can be referred by `{componentName}::{name}`booleanbooleanfinal booleanIndicates whether some other object is "equal to" this one.voidforEach(@NotNull BiConsumer<String, kala.collection.Map<org.aya.syntax.concrete.stmt.ModuleName, T>> action) @NotNull kala.control.Result<T, ModuleSymbol.Error> getMaybe(@NotNull org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.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> kala.control.Result<T, ModuleSymbol.Error> removeDefinitely(@NotNull String unqualifiedName) kala.control.Result<T, ModuleSymbol.Error> removeDefinitely(@NotNull org.aya.syntax.concrete.stmt.ModuleName component, @NotNull String unqualifiedName) @NotNull ModuleSymbol.UnqualifiedResolve<T> resolveUnqualified(@NotNull String unqualifiedName) Getting the candidates of an unqualified name@NotNull kala.collection.mutable.MutableMap<String, kala.collection.mutable.MutableMap<org.aya.syntax.concrete.stmt.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<org.aya.syntax.concrete.stmt.ModuleName, T>> view()
-
Constructor Details
-
ModuleSymbol
public ModuleSymbol() -
ModuleSymbol
-
ModuleSymbol
public ModuleSymbol(@NotNull @NotNull kala.collection.mutable.MutableMap<String, kala.collection.mutable.MutableMap<org.aya.syntax.concrete.stmt.ModuleName, T>> table) Creates an instance of aModuleSymbolrecord class.- Parameters:
table- the value for thetablerecord component
-
-
Method Details
-
resolveUnqualified
@NotNull public @NotNull ModuleSymbol.UnqualifiedResolve<T> resolveUnqualified(@NotNull @NotNull String unqualifiedName) Getting the candidates of an unqualified name- Parameters:
unqualifiedName- the unqualified name
-
getQualifiedMaybe
@NotNull public @NotNull kala.control.Option<T> getQualifiedMaybe(@NotNull @NotNull org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.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 org.aya.syntax.concrete.stmt.ModuleName component, @NotNull @NotNull String unqualified) -
add
public kala.control.Option<T> add(@NotNull @NotNull org.aya.syntax.concrete.stmt.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
-
removeDefinitely
public kala.control.Result<T,ModuleSymbol.Error> removeDefinitely(@NotNull @NotNull String unqualifiedName) -
removeDefinitely
public kala.control.Result<T,ModuleSymbol.Error> removeDefinitely(@NotNull @NotNull org.aya.syntax.concrete.stmt.ModuleName component, @NotNull @NotNull String unqualifiedName) -
keysView
-
view
-
forEach
public void forEach(@NotNull @NotNull BiConsumer<String, kala.collection.Map<org.aya.syntax.concrete.stmt.ModuleName, T>> action) -
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<org.aya.syntax.concrete.stmt.ModuleName, table()T>> Returns the value of thetablerecord component.- Returns:
- the value of the
tablerecord component
-