Package gw.internal.gosu.parser
Class TypeUsesMap
- java.lang.Object
-
- gw.internal.gosu.parser.TypeUsesMap
-
- All Implemented Interfaces:
ITypeUsesMap
,Serializable
public class TypeUsesMap extends Object implements ITypeUsesMap
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TypeUsesMap()
TypeUsesMap(List<String> specialTypeUses)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToDefaultTypeUses(String strType)
Add the specified type to the set of default types.void
addToFeatureLiterals(IFeatureInfo fi)
void
addToFeatureSpaces(String strType)
void
addToSpecialTypeUses(String strType)
void
addToTypeUses(IUsesStatement usesSmt)
Adds a type to the current set of types.void
addToTypeUses(String strType)
Adds a type to the current set of types.void
clearNonDefaultTypeUses()
Clears all types not in the default set of types;boolean
containsType(String typeName)
ITypeUsesMap
copy()
Returns a shallow copy of this map.ITypeUsesMap
copyLocalScope()
Copies the type uses map but alias the global map from this.Set<IFeatureInfo>
getFeatureLiterals()
Set<String>
getFeatureSpaces()
Set<String>
getNamespaces()
Returns the set of strings representing the namespaces that are currently used by this parser.Set<String>
getTypeUses()
Returns the set of strings representing the types that are currently used by this parser.Set<IUsesStatement>
getUsesStatements()
Return the set of uses-statements that participate in this map.boolean
isSupportRelativePackageResolution()
ITypeUsesMap
lock()
Locks this ITypeUsesMap so that it cannot be mutated in the futureINamespaceType
resolveRelativeNamespaceInAllNamespaces(String strRelativeName)
IType
resolveType(String strRelativeName)
Resolve the type of a relative name via the type uses. if the relative type matches uses-type, resolves the type as such.void
setSupportRelativePackageResolution(boolean bSupportRelativePackageResolution)
-
-
-
Method Detail
-
copy
public ITypeUsesMap copy()
Description copied from interface:ITypeUsesMap
Returns a shallow copy of this map.- Specified by:
copy
in interfaceITypeUsesMap
-
copyLocalScope
public ITypeUsesMap copyLocalScope()
Description copied from interface:ITypeUsesMap
Copies the type uses map but alias the global map from this.- Specified by:
copyLocalScope
in interfaceITypeUsesMap
- Returns:
- a copy of this type uses map.
-
lock
public ITypeUsesMap lock()
Description copied from interface:ITypeUsesMap
Locks this ITypeUsesMap so that it cannot be mutated in the future- Specified by:
lock
in interfaceITypeUsesMap
- Returns:
- this ITypeUsesMap, so that this method can be used in a builder-like manner.
-
containsType
public boolean containsType(String typeName)
- Specified by:
containsType
in interfaceITypeUsesMap
- Returns:
- if a type wit the given name can be resolved via this type uses map.
-
getTypeUses
public Set<String> getTypeUses()
Description copied from interface:ITypeUsesMap
Returns the set of strings representing the types that are currently used by this parser. The set of types includes both those declared in #uses statements and those set via setDefaultTypeUses.- Specified by:
getTypeUses
in interfaceITypeUsesMap
-
getNamespaces
public Set<String> getNamespaces()
Description copied from interface:ITypeUsesMap
Returns the set of strings representing the namespaces that are currently used by this parser.- Specified by:
getNamespaces
in interfaceITypeUsesMap
-
getFeatureSpaces
public Set<String> getFeatureSpaces()
- Specified by:
getFeatureSpaces
in interfaceITypeUsesMap
-
getFeatureLiterals
public Set<IFeatureInfo> getFeatureLiterals()
- Specified by:
getFeatureLiterals
in interfaceITypeUsesMap
-
addToTypeUses
public void addToTypeUses(String strType)
Description copied from interface:ITypeUsesMap
Adds a type to the current set of types. Can be a complete type or a wildcard namespace e.g., java.util.HashMap and java.util.* are both legal.- Specified by:
addToTypeUses
in interfaceITypeUsesMap
-
addToFeatureSpaces
public void addToFeatureSpaces(String strType)
- Specified by:
addToFeatureSpaces
in interfaceITypeUsesMap
-
addToFeatureLiterals
public void addToFeatureLiterals(IFeatureInfo fi)
- Specified by:
addToFeatureLiterals
in interfaceITypeUsesMap
-
addToTypeUses
public void addToTypeUses(IUsesStatement usesSmt)
Description copied from interface:ITypeUsesMap
Adds a type to the current set of types. Can be a complete type or a wildcard namespace e.g., java.util.HashMap and java.util.* are both legal.- Specified by:
addToTypeUses
in interfaceITypeUsesMap
-
getUsesStatements
public Set<IUsesStatement> getUsesStatements()
Description copied from interface:ITypeUsesMap
Return the set of uses-statements that participate in this map. Note these are the uses-statements compiled from source.- Specified by:
getUsesStatements
in interfaceITypeUsesMap
-
addToDefaultTypeUses
public void addToDefaultTypeUses(String strType)
Description copied from interface:ITypeUsesMap
Add the specified type to the set of default types. NOTE: The type is always treated as a package. If it ends in .* then it will be stripped- Specified by:
addToDefaultTypeUses
in interfaceITypeUsesMap
-
addToSpecialTypeUses
public void addToSpecialTypeUses(String strType)
- Specified by:
addToSpecialTypeUses
in interfaceITypeUsesMap
-
resolveType
public IType resolveType(String strRelativeName)
Description copied from interface:ITypeUsesMap
Resolve the type of a relative name via the type uses. if the relative type matches uses-type, resolves the type as such. If the type matches, but does not resove, throws an exception, otherwise returns null if there is no match.- Specified by:
resolveType
in interfaceITypeUsesMap
-
clearNonDefaultTypeUses
public void clearNonDefaultTypeUses()
Description copied from interface:ITypeUsesMap
Clears all types not in the default set of types;- Specified by:
clearNonDefaultTypeUses
in interfaceITypeUsesMap
-
resolveRelativeNamespaceInAllNamespaces
public INamespaceType resolveRelativeNamespaceInAllNamespaces(String strRelativeName)
- Specified by:
resolveRelativeNamespaceInAllNamespaces
in interfaceITypeUsesMap
- Parameters:
strRelativeName
- A relative path name. E.g., "lang" is a relative package name of "java.lang"- Returns:
- The absolute namespace type for the relative name or null if not found.
-
isSupportRelativePackageResolution
public boolean isSupportRelativePackageResolution()
- Specified by:
isSupportRelativePackageResolution
in interfaceITypeUsesMap
-
setSupportRelativePackageResolution
public void setSupportRelativePackageResolution(boolean bSupportRelativePackageResolution)
- Specified by:
setSupportRelativePackageResolution
in interfaceITypeUsesMap
-
-