Ejemplo n.º 1
0
 public PTFamily(
     MTType model,
     String familyName,
     String exemplarName,
     Exp constraint,
     Exp initializationRequires,
     Exp initializationEnsures,
     Exp finalizationRequires,
     Exp finalizationEnsures) {
   this(
       model,
       familyName,
       exemplarName,
       normalize(model.getTypeGraph(), constraint),
       normalize(model.getTypeGraph(), initializationRequires),
       normalize(model.getTypeGraph(), initializationEnsures),
       normalize(model.getTypeGraph(), finalizationRequires),
       normalize(model.getTypeGraph(), finalizationEnsures));
 }
Ejemplo n.º 2
0
  public PTFamily(
      MTType model,
      String familyName,
      String exemplarName,
      PExp constraint,
      PExp initializationRequires,
      PExp initializationEnsures,
      PExp finalizationRequires,
      PExp finalizationEnsures) {
    super(model.getTypeGraph());

    myName = familyName;
    myModel = model;
    myExemplarName = exemplarName;
    myConstraint = constraint;
    myInitializationRequires = initializationRequires;
    myInitializationEnsures = initializationEnsures;
    myFinalizationRequires = finalizationRequires;
    myFinalizationEnsures = finalizationEnsures;
  }
Ejemplo n.º 3
0
  @Override
  public boolean equals(Object o) {
    boolean result = (o instanceof PTFamily);

    if (result) {
      PTFamily oAsPTFamily = (PTFamily) o;

      result =
          (myModel.equals(oAsPTFamily.myModel))
              && (myName.equals(oAsPTFamily.myName))
              && (myExemplarName.equals(oAsPTFamily.myExemplarName))
              && (myConstraint.equals(oAsPTFamily.myConstraint))
              && (myInitializationRequires.equals(oAsPTFamily.myInitializationRequires))
              && (myInitializationEnsures.equals(oAsPTFamily.myInitializationEnsures))
              && (myFinalizationRequires.equals(oAsPTFamily.myFinalizationRequires))
              && (myFinalizationEnsures.equals(oAsPTFamily.myFinalizationEnsures));
    }

    return result;
  }
Ejemplo n.º 4
0
  @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);
  }