コード例 #1
0
ファイル: PTFamily.java プロジェクト: Jiacheng10/RESOLVE
  @Override
  public PTType instantiateGenerics(
      Map<String, PTType> genericInstantiations, FacilityEntry instantiatingFacility) {

    Map<String, MTType> stringToMathType =
        SymbolTableEntry.buildMathTypeGenerics(genericInstantiations);

    @SuppressWarnings("unchecked")
    Map<MTType, MTType> mathTypeToMathType =
        (Map<MTType, MTType>)
            (Map<?, MTType>) MTNamed.toMTNamedMap(getTypeGraph(), stringToMathType);

    MTType newModel = myModel.getCopyWithVariablesSubstituted(stringToMathType);

    PExp newConstraint = myConstraint.withTypesSubstituted(mathTypeToMathType);

    PExp newInitializationRequires =
        myInitializationRequires.withTypesSubstituted(mathTypeToMathType);

    PExp newInitializationEnsures =
        myInitializationEnsures.withTypesSubstituted(mathTypeToMathType);

    PExp newFinalizationRequires = myFinalizationRequires.withTypesSubstituted(mathTypeToMathType);

    PExp newFinalizationEnsures = myFinalizationEnsures.withTypesSubstituted(mathTypeToMathType);

    return new PTFamily(
        newModel,
        myName,
        myExemplarName,
        newConstraint,
        newInitializationRequires,
        newInitializationEnsures,
        newFinalizationRequires,
        newFinalizationEnsures);
  }