コード例 #1
0
 private void compareMinValue(
     de.uni_koblenz.jgralab.schema.IncidenceClass incidence, IncidenceClass gIncidence) {
   assertEquals(
       currentName + ": Both \"IncidenceClasses\" should have the same min value.",
       incidence.getMin(),
       gIncidence.get_min());
 }
コード例 #2
0
 private void compareDirection(
     de.uni_koblenz.jgralab.schema.IncidenceClass incidence, IncidenceDirection gDirection) {
   assertEquals(
       "The directions are not equal: " + incidence.getDirection() + " != " + gDirection,
       incidence.getDirection().toString(),
       gDirection.toString());
 }
コード例 #3
0
  /**
   * Compares two IncidenceClasses objects.
   *
   * @param incidence IncidenceClasses from the Schema.
   * @param gIncidence IncidenceClasses from the SchemaGraph.
   */
  private final void compareIncidenceClass(
      de.uni_koblenz.jgralab.schema.IncidenceClass incidence,
      IncidenceClass gIncidence,
      IncidenceDirection gDirection) {

    currentName = "IncidenceClass";

    checkExistingsOfSchemaElement(incidence);
    checkExistingsOfSchemaGraphElement(gIncidence);

    compareVertexClassesOfIncidenceClasses(incidence, gIncidence);

    currentName =
        incidence.getVertexClass().getQualifiedName()
            + " -- "
            + incidence.getEdgeClass().getQualifiedName();

    // Qualified Name, min, max and rolename are compared.
    compareAggregationKind(incidence, gIncidence);
    compareMaxValue(incidence, gIncidence);
    compareMinValue(incidence, gIncidence);
    compareRoleNames(incidence, gIncidence);
    compareDirection(incidence, gDirection);
    compareSubsettedIncidenceClasses(incidence, gIncidence);
  }
コード例 #4
0
  private void compareAggregationKind(
      de.uni_koblenz.jgralab.schema.IncidenceClass type, IncidenceClass gType) {

    assertEquals(
        currentName + ": These objects should have the same Type.",
        type.getAggregationKind().toString(),
        gType.get_aggregation().toString());
  }
コード例 #5
0
  private void compareRoleNames(
      de.uni_koblenz.jgralab.schema.IncidenceClass incidence, IncidenceClass gIncidence) {
    assertEquals(
        currentName + ": Both \"IncidenceClasses\" should have the same Rolename.",
        incidence.getRolename(),
        gIncidence.get_roleName());

    // Gets the redefined roles
  }
コード例 #6
0
  private Set<String> getherAllSubsettedEdgeClassQualifiedNames(
      de.uni_koblenz.jgralab.schema.IncidenceClass incidence) {
    Set<String> subsettedIncidenceClasses =
        new HashSet<String>(incidence.getSubsettedIncidenceClasses().size());

    for (de.uni_koblenz.jgralab.schema.IncidenceClass subsettedIncidenceClass :
        incidence.getSubsettedIncidenceClasses()) {
      de.uni_koblenz.jgralab.schema.EdgeClass edgeClass = subsettedIncidenceClass.getEdgeClass();
      if (edgeClass.isInternal()) {
        continue;
      }
      subsettedIncidenceClasses.add(edgeClass.getQualifiedName());
    }
    return subsettedIncidenceClasses;
  }
コード例 #7
0
  private void getherAllSubsettedEdgeClassQaulifiedNames(
      Set<String> gSubsettedIncidenceClasses, Subsets subsets) {
    IncidenceClass subsettedIncidenceClass = (IncidenceClass) subsets.getThat();
    Edge edgeToEdgeClass = subsettedIncidenceClass.getFirstGoesToIncidence();
    if (edgeToEdgeClass == null) {
      edgeToEdgeClass = subsettedIncidenceClass.getFirstComesFromIncidence();
    }
    assertFalse(
        "There is no edge defined to connected this IncidenceClass to its EdgeClass.",
        edgeToEdgeClass == null);
    EdgeClass edgeClass = (EdgeClass) edgeToEdgeClass.getThat();
    gSubsettedIncidenceClasses.add(edgeClass.get_qualifiedName());

    for (Subsets subSubsets : subsettedIncidenceClass.getSubsetsIncidences(OUTGOING)) {
      getherAllSubsettedEdgeClassQaulifiedNames(gSubsettedIncidenceClasses, subSubsets);
    }
  }
コード例 #8
0
  private Set<String> getherAllSubsettedEdgeClassQualifiedNames(IncidenceClass gIncidence) {
    Set<String> gSubsettedIncidenceClasses = new HashSet<String>();

    for (Subsets subsets : gIncidence.getSubsetsIncidences(OUTGOING)) {
      getherAllSubsettedEdgeClassQaulifiedNames(gSubsettedIncidenceClasses, subsets);
    }
    return gSubsettedIncidenceClasses;
  }
コード例 #9
0
  private void compareVertexClassesOfIncidenceClasses(
      de.uni_koblenz.jgralab.schema.IncidenceClass incidence, IncidenceClass gIncidence) {
    EndsAt edgeToVertexClass = gIncidence.getFirstEndsAtIncidence();
    assertTrue(
        "That should be an instance of \"VertexClass\".",
        edgeToVertexClass.getThat() instanceof VertexClass);

    VertexClass gVertexClass = (VertexClass) edgeToVertexClass.getThat();
    assertTrue(edgeToVertexClass.getNextEndsAtIncidence(OUTGOING) == null);
    de.uni_koblenz.jgralab.schema.VertexClass vertexClass = incidence.getVertexClass();

    assertFalse("There is no \"VertexClass\" defined in the schema.", vertexClass == null);
    assertFalse("There is no \"VertexClass\" defined in the schema graph.", gVertexClass == null);

    assertEquals(
        "The qualifed names of both \"VertexClasses\" do not match: "
            + vertexClass.getQualifiedName()
            + " != "
            + gVertexClass.get_qualifiedName(),
        vertexClass.getQualifiedName(),
        gVertexClass.get_qualifiedName());
  }