Skip to content
Snippets Groups Projects
Select Git revision
  • bead0ba5eca3a3b18c6ddc494d46dfbfa4b75a6d
  • master default protected
  • update/angular
  • bugfix/ragdoc
  • 1-add-relast2uml-to-statemachine
5 results

Printing.jrag

Blame
  • Printing.jrag 3.24 KiB
    aspect Printing {
    
        syn String RoleRag.prettyPrint() {
            StringBuilder sb = new StringBuilder();
            sb.append("\n---RoleRag---\n");
            getNaturalTypeList().forEach(n -> sb.append(n.prettyPrint()));
            getRoleTypeList().forEach(r -> sb.append(r.prettyPrint()));
            getCompartmentTypeList().forEach(c -> sb.append(c.prettyPrint()));
            //getFulfillmentList().forEach(f -> sb.append(f.prettyPrint()));
            sb.append("-------------\n");
            return sb.toString();
        }
    
        syn String NamedElement.prettyPrint() = null;
        eq TypedElement.prettyPrint() = null;
        eq NaturalType.prettyPrint() {
            StringBuilder sb = new StringBuilder();
            sb.append("NT " + getName());
            if (!fulfillments().isEmpty())
                sb.append("\n\tPlays ");
            for (Fulfillment f : fulfillments()) {
                sb.append("\n\t\t" + f.getFilled().getName() + " ");
            }
            if (getAttributeList().getNumChild() != 0)
                sb.append("\n\tAttributes ");
            for (Attribute a : getAttributeList()) {
                sb.append("\n\t\t" + a.getName() + " " + getNewestAttribute(a.getName()).getValue());
            }
            sb.append("\n");
            return sb.toString();
        }
        eq RoleType.prettyPrint() {
            StringBuilder sb = new StringBuilder();
            sb.append("RT " + getName());
            if (getAttributeList().getNumChild() != 0)
                sb.append("\n\tAttributes ");
            for (Attribute a : getAttributeList()) {
                sb.append("\n\t\t" + a.getName() + " " + a.getValue());
            }
            sb.append("\n");
            return sb.toString();
        }
        eq CompartmentType.prettyPrint() {
            StringBuilder sb = new StringBuilder();
            sb.append("CT " + getName());
            if (!fulfillments().isEmpty())
                sb.append("\n\tPlays ");
            for (Fulfillment f : fulfillments()) {
                sb.append("\n\t\t" + f.getFilled().getName() + " ");
            }
            if (getPartsList().getNumChild() != 0)
                sb.append("\n\tContains ");
            for (RoleType r : getPartsList()) {
                sb.append("\n\t\t" + r.getName());
            }
            for (CompartmentType c : getContainsList()) {
                sb.append("\n\t\t" + c.getName());
            }
            if (getAttributeList().getNumChild() != 0)
                sb.append("\n\tAttributes ");
            for (Attribute a : getAttributeList()) {
                sb.append("\n\t\t" + a.getName() + " " + a.getValue());
            }
            sb.append("\n");
            return sb.toString();
        }
        //syn String Fulfillment.prettyPrint() = getFiller().getName() + " fills " + getFilled().getName() + ";\n";
    
      /** Return a textual representation of the state machine */
      /*
      syn String StateMachine.prettyPrint() {
        StringBuilder sb = new StringBuilder();
        states().forEach(s -> sb.append(s.prettyPrint()));
        transitions().forEach(t -> sb.append(t.prettyPrint()));
        return sb.toString();
      }
      */
    
      /** Return a textual representation of the state machine */
      //syn String Element.prettyPrint();
      //eq State.prettyPrint() = (isInitial() ? "initial " : "") + (isFinal() ? "final " : "") + "state " + getLabel() + ";\n";
      //eq Transition.prettyPrint() = "trans " + getFrom().getLabel() + " -> " + getTo().getLabel() + (isEpsilon() ? "" : " : " + getLabel()) + ";\n";
    }