/** * Attaches vertex representing type specification to vertex representing it's type definition. * Creates structure: Type --- [IsTypeDefinitionOf] ---> QualifiedType and sets edge's attributes. * * @param typeVertex A vertex representing a type definition. * @param qualifiedTypeVertex A vertex representing a type specification. */ private void attach(QualifiedType qualifiedTypeVertex, Type typeVertex) { /* IsTypeDefinitionOf isTypeDefinitionOfEdge = */ symbolTable .getGraph() .createIsTypeDefinitionOf(typeVertex, qualifiedTypeVertex); qualifiedTypeVertex.set_fullyQualifiedName(typeVertex.get_fullyQualifiedName()); /* IsExternalDeclarationIn isExternalDeclarationInEdge = */ typeVertex .getFirstIsExternalDeclarationInIncidence(); }
/** * Replaces a vertex representing type specification by another one which was resolved before. * * @param fullyQualifiedName Fully qualified name of type definition. * @param qualifiedTypeVertex Vertex to replace representing type specification. */ protected void replaceByResolvedOne( String fullyQualifiedName, QualifiedType qualifiedTypeVertex) { if (symbolTable.hasResolvedTypeSpecification(fullyQualifiedName)) { QualifiedType resolvedQualifiedTypeVertex = symbolTable.getResolvedTypeSpecification(fullyQualifiedName); replaceBy(qualifiedTypeVertex, resolvedQualifiedTypeVertex); qualifiedTypeVertex.delete(); } }
/** * Replaces vertex representing a fully qualified type specification in graph by another vertex * representing a type specification. * * @param qualifiedTypeVertex Vertex to replace. * @param typeSpecificationVertex Vertex to take the place of the other one. */ protected void replaceBy( QualifiedType qualifiedTypeVertex, TypeSpecification typeSpecificationVertex) { IsTypeOfVariable isTypeOfVariableEdge = qualifiedTypeVertex.getFirstIsTypeOfVariableIncidence(); if (isTypeOfVariableEdge != null) { isTypeOfVariableEdge.setAlpha(typeSpecificationVertex); } IsCastedTypeOf isCastedTypeOfEdge = qualifiedTypeVertex.getFirstIsCastedTypeOfIncidence(); if (isCastedTypeOfEdge != null) { isCastedTypeOfEdge.setAlpha(typeSpecificationVertex); } IsReturnTypeOf isReturnTypeOfEdge = qualifiedTypeVertex.getFirstIsReturnTypeOfIncidence(); if (isReturnTypeOfEdge != null) { isReturnTypeOfEdge.setAlpha(typeSpecificationVertex); } IsImportedTypeOf isImportedTypeOfEdge = qualifiedTypeVertex.getFirstIsImportedTypeOfIncidence(); if (isImportedTypeOfEdge != null) { isImportedTypeOfEdge.setAlpha(typeSpecificationVertex); } IsAnnotationNameOf isAnnotationNameOfEdge = qualifiedTypeVertex.getFirstIsAnnotationNameOfIncidence(); if (isAnnotationNameOfEdge != null) { isAnnotationNameOfEdge.setAlpha(typeSpecificationVertex); } IsTypeOfSimpleArgument isTypeOfSimpleArgumentEdge = qualifiedTypeVertex.getFirstIsTypeOfSimpleArgumentIncidence(); if (isTypeOfSimpleArgumentEdge != null) { isTypeOfSimpleArgumentEdge.setAlpha(typeSpecificationVertex); } IsLowerBoundOfWildcardArgument isLowerBoundOfWildcardArgumentEdge = qualifiedTypeVertex.getFirstIsLowerBoundOfWildcardArgumentIncidence(); if (isLowerBoundOfWildcardArgumentEdge != null) { isLowerBoundOfWildcardArgumentEdge.setAlpha(typeSpecificationVertex); } IsUpperBoundOfWildcardArgument isUpperBoundOfWildcardArgumentEdge = qualifiedTypeVertex.getFirstIsUpperBoundOfWildcardArgumentIncidence(); if (isUpperBoundOfWildcardArgumentEdge != null) { isUpperBoundOfWildcardArgumentEdge.setAlpha(typeSpecificationVertex); } IsElementTypeOf isElementTypeOfEdge = qualifiedTypeVertex.getFirstIsElementTypeOfIncidence(); if (isElementTypeOfEdge != null) { isElementTypeOfEdge.setAlpha(typeSpecificationVertex); } IsUpperBoundOfTypeParameter isUpperBoundOfTypeParameterEdge = qualifiedTypeVertex.getFirstIsUpperBoundOfTypeParameterIncidence(); if (isUpperBoundOfTypeParameterEdge != null) { isUpperBoundOfTypeParameterEdge.setAlpha(typeSpecificationVertex); } IsSuperClassOfClass isSuperClassOfClassEdge = qualifiedTypeVertex.getFirstIsSuperClassOfClassIncidence(); if (isSuperClassOfClassEdge != null) { isSuperClassOfClassEdge.setAlpha(typeSpecificationVertex); } IsSuperClassOfInterface isSuperClassOfInterfaceEdge = qualifiedTypeVertex.getFirstIsSuperClassOfInterfaceIncidence(); if (isSuperClassOfInterfaceEdge != null) { isSuperClassOfInterfaceEdge.setAlpha(typeSpecificationVertex); } IsInterfaceOfClass isInterfaceOfClassEdge = qualifiedTypeVertex.getFirstIsInterfaceOfClassIncidence(); if (isInterfaceOfClassEdge != null) { isInterfaceOfClassEdge.setAlpha(typeSpecificationVertex); } IsInterfaceOfEnum isInterfaceOfEnumEdge = qualifiedTypeVertex.getFirstIsInterfaceOfEnumIncidence(); if (isInterfaceOfEnumEdge != null) { isInterfaceOfEnumEdge.setAlpha(typeSpecificationVertex); } IsElementTypeOfCreatedArray isElementTypeOfCreatedArrayEdge = qualifiedTypeVertex.getFirstIsElementTypeOfCreatedArrayIncidence(); if (isElementTypeOfCreatedArrayEdge != null) { isElementTypeOfCreatedArrayEdge.setAlpha(typeSpecificationVertex); } IsTypeOfObject isTypeOfObjectEdge = qualifiedTypeVertex.getFirstIsTypeOfObjectIncidence(); if (isTypeOfObjectEdge != null) { isTypeOfObjectEdge.setAlpha(typeSpecificationVertex); } IsTypeOfAnnotationField isTypeOfAnnotationFieldEdge = qualifiedTypeVertex.getFirstIsTypeOfAnnotationFieldIncidence(); if (isTypeOfAnnotationFieldEdge != null) { isTypeOfAnnotationFieldEdge.setAlpha(typeSpecificationVertex); } IsExceptionThrownByConstructor isExceptionThrownByConstructorEdge = qualifiedTypeVertex.getFirstIsExceptionThrownByConstructorIncidence(); if (isExceptionThrownByConstructorEdge != null) { isExceptionThrownByConstructorEdge.setAlpha(typeSpecificationVertex); } IsExceptionThrownByMethod isExceptionThrownByMethodEdge = qualifiedTypeVertex.getFirstIsExceptionThrownByMethodIncidence(); if (isExceptionThrownByMethodEdge != null) { isExceptionThrownByMethodEdge.setAlpha(typeSpecificationVertex); } IsTypeOfParameter isTypeOfParameterEdge = qualifiedTypeVertex.getFirstIsTypeOfParameterIncidence(); if (isTypeOfParameterEdge != null) { isTypeOfParameterEdge.setAlpha(typeSpecificationVertex); } IsSpecifiedTypeOf isSpecifiedTypeOfEdge = qualifiedTypeVertex.getFirstIsSpecifiedTypeOfIncidence(); if (isSpecifiedTypeOfEdge != null) { isSpecifiedTypeOfEdge.setAlpha(typeSpecificationVertex); } }