Package gw.internal.gosu.parser
Class TypeUsesMap
java.lang.Object
gw.internal.gosu.parser.TypeUsesMap
- All Implemented Interfaces:
ITypeUsesMap,Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate DynamicArray<String>private DynamicArray<IFeatureInfo>private DynamicArray<String>private booleanprivate DynamicArray<String>private DynamicArray<String>private HashMap<String,IUsesStatement> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToDefaultTypeUses(String strType) Add the specified type to the set of default types.voidvoidaddToFeatureSpaces(String strType) voidaddToSpecialTypeUses(String strType) voidaddToTypeUses(IUsesStatement usesSmt) Adds a type to the current set of types.voidaddToTypeUses(String strType) Adds a type to the current set of types.private voidaddToTypeUses(String strQualifiedType, Map<String, String> mapQualifiedNameByRelativeName, List<String> namespacesSet) private voidvoidClears all types not in the default set of types;booleancontainsType(String typeName) copy()Returns a shallow copy of this map.Copies the type uses map but alias the global map from this.Returns the set of strings representing the namespaces that are currently used by this parser.Returns the set of strings representing the types that are currently used by this parser.Return the set of uses-statements that participate in this map.booleanlock()Locks this ITypeUsesMap so that it cannot be mutated in the futureresolveRelativeNamespaceInAllNamespaces(String strRelativeName) private ITyperesolveSubType(String strRelativeName) resolveType(String strRelativeName) Resolve the type of a relative name via the type uses.private ITyperesolveType(String strRelativeName, String strNs) private ITyperesolveTypesInAllNamespaces(String strRelativeName) voidsetSupportRelativePackageResolution(boolean bSupportRelativePackageResolution) private ITypeverifyTypeNameDoesNotHaveRelativePackage(IType type, String strNs, String strRelativeName)
-
Field Details
-
_bSupportRelativePackageResolution
private boolean _bSupportRelativePackageResolution -
_specialTypeUsesByRelativeName
-
_typeUsesByRelativeName
-
_defaultNamespaces
-
_namespaces
-
_specialNamespaces
-
_featureSpaces
-
_featureLiterals
-
_usesStmts
-
_locked
private boolean _locked
-
-
Constructor Details
-
TypeUsesMap
-
TypeUsesMap
public TypeUsesMap()
-
-
Method Details
-
copy
Description copied from interface:ITypeUsesMapReturns a shallow copy of this map.- Specified by:
copyin interfaceITypeUsesMap
-
copyLocalScope
Description copied from interface:ITypeUsesMapCopies the type uses map but alias the global map from this.- Specified by:
copyLocalScopein interfaceITypeUsesMap- Returns:
- a copy of this type uses map.
-
lock
Description copied from interface:ITypeUsesMapLocks this ITypeUsesMap so that it cannot be mutated in the future- Specified by:
lockin interfaceITypeUsesMap- Returns:
- this ITypeUsesMap, so that this method can be used in a builder-like manner.
-
containsType
- Specified by:
containsTypein interfaceITypeUsesMap- Returns:
- if a type wit the given name can be resolved via this type uses map.
-
getTypeUses
Description copied from interface:ITypeUsesMapReturns 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:
getTypeUsesin interfaceITypeUsesMap
-
getNamespaces
Description copied from interface:ITypeUsesMapReturns the set of strings representing the namespaces that are currently used by this parser.- Specified by:
getNamespacesin interfaceITypeUsesMap
-
getFeatureSpaces
- Specified by:
getFeatureSpacesin interfaceITypeUsesMap
-
getFeatureLiterals
- Specified by:
getFeatureLiteralsin interfaceITypeUsesMap
-
addToTypeUses
Description copied from interface:ITypeUsesMapAdds 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:
addToTypeUsesin interfaceITypeUsesMap
-
addToFeatureSpaces
- Specified by:
addToFeatureSpacesin interfaceITypeUsesMap
-
addToFeatureLiterals
- Specified by:
addToFeatureLiteralsin interfaceITypeUsesMap
-
addToTypeUses
Description copied from interface:ITypeUsesMapAdds 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:
addToTypeUsesin interfaceITypeUsesMap
-
getUsesStatements
Description copied from interface:ITypeUsesMapReturn the set of uses-statements that participate in this map. Note these are the uses-statements compiled from source.- Specified by:
getUsesStatementsin interfaceITypeUsesMap
-
addToDefaultTypeUses
Description copied from interface:ITypeUsesMapAdd 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:
addToDefaultTypeUsesin interfaceITypeUsesMap
-
checkLocked
private void checkLocked() -
addToSpecialTypeUses
- Specified by:
addToSpecialTypeUsesin interfaceITypeUsesMap
-
resolveType
Description copied from interface:ITypeUsesMapResolve 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:
resolveTypein interfaceITypeUsesMap
-
resolveSubType
-
clearNonDefaultTypeUses
public void clearNonDefaultTypeUses()Description copied from interface:ITypeUsesMapClears all types not in the default set of types;- Specified by:
clearNonDefaultTypeUsesin interfaceITypeUsesMap
-
resolveTypesInAllNamespaces
-
resolveType
-
verifyTypeNameDoesNotHaveRelativePackage
-
resolveRelativeNamespaceInAllNamespaces
- Specified by:
resolveRelativeNamespaceInAllNamespacesin 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:
isSupportRelativePackageResolutionin interfaceITypeUsesMap
-
setSupportRelativePackageResolution
public void setSupportRelativePackageResolution(boolean bSupportRelativePackageResolution) - Specified by:
setSupportRelativePackageResolutionin interfaceITypeUsesMap
-
addToTypeUses
private void addToTypeUses(String strQualifiedType, Map<String, String> mapQualifiedNameByRelativeName, List<String> namespacesSet) throws ClassNotFoundException- Throws:
ClassNotFoundException
-