コード例 #1
0
ファイル: Relationship.java プロジェクト: FS1360472174/java
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Relationship that = (Relationship) o;

    if (!getDescription().equals(that.getDescription())) return false;
    if (!getDestination().equals(that.getDestination())) return false;
    if (!getSource().equals(that.getSource())) return false;

    return true;
  }
コード例 #2
0
ファイル: View.java プロジェクト: ronsmits/java
  public RelationshipView add(Relationship relationship) {
    if (relationship != null) {
      if (isElementInView(relationship.getSource())
          && isElementInView(relationship.getDestination())) {
        RelationshipView relationshipView = new RelationshipView(relationship);
        relationshipViews.add(relationshipView);

        return relationshipView;
      }
    }

    return null;
  }
コード例 #3
0
ファイル: View.java プロジェクト: ronsmits/java
  private void addRelationships(Element element) {
    Set<Element> elements =
        getElements().stream().map(ElementView::getElement).collect(Collectors.toSet());

    // add relationships where the destination exists in the view already
    for (Relationship relationship : element.getRelationships()) {
      if (elements.contains(relationship.getDestination())) {
        this.relationshipViews.add(new RelationshipView(relationship));
      }
    }

    // add relationships where the source exists in the view already
    for (Element e : elements) {
      for (Relationship r : e.getRelationships()) {
        if (r.getDestination().equals(element)) {
          this.relationshipViews.add(new RelationshipView(r));
        }
      }
    }
  }
コード例 #4
0
  @Test
  public void test_write_createsAWebSequenceDiagram() throws Exception {
    Model model = workspace.getModel();
    SoftwareSystem a = model.addSoftwareSystem("System A", "");
    SoftwareSystem b = model.addSoftwareSystem("System B", "");
    SoftwareSystem c = model.addSoftwareSystem("System C", "");

    a.uses(b, "");
    Relationship bc = b.uses(c, "");
    bc.setInteractionStyle(InteractionStyle.Asynchronous);

    DynamicView view = workspace.getViews().createDynamicView(a, "A description of the diagram");
    view.add(a, "Does something using", b);
    view.add(b, "Does something then using", c);

    webSequenceDiagramsWriter.write(workspace, stringWriter);
    assertEquals(
        "title System A - Dynamic - A description of the diagram\n"
            + "\n"
            + "System A->System B: Does something using\n"
            + "System B->>System C: Does something then using\n"
            + "\n",
        stringWriter.toString());
  }