Commit ad10bbac authored by Paff's avatar Paff
Browse files

bug fix prettyprinter

parent 7d82b9f8
...@@ -64,7 +64,7 @@ public final class MontiSecArcConstants extends Interfaces2Constants { ...@@ -64,7 +64,7 @@ public final class MontiSecArcConstants extends Interfaces2Constants {
/** /**
* Argument for Analysis configuration * Argument for Analysis configuration
*/ */
public static final String ARG_ANALYSISCONFPATH = "-analsisconfpath"; public static final String ARG_ANALYSISCONFPATH = "-analysisconfpath";
/** /**
* name for pep entry * name for pep entry
......
package secarc.prettyprint; package secarc.prettyprint;
import secarc._ast.ASTMCCompilationUnit;
import secarc._ast.ASTSecArcCPE; import secarc._ast.ASTSecArcCPE;
import secarc._ast.ASTSecArcConfiguration; import secarc._ast.ASTSecArcConfiguration;
import secarc._ast.ASTSecArcConnector;
import secarc._ast.ASTSecArcFilter; import secarc._ast.ASTSecArcFilter;
import secarc._ast.ASTSecArcFilterComponent; import secarc._ast.ASTSecArcFilterComponent;
import secarc._ast.ASTSecArcFilterSubComponent;
import secarc._ast.ASTSecArcIdentity; import secarc._ast.ASTSecArcIdentity;
import secarc._ast.ASTSecArcPEP; import secarc._ast.ASTSecArcPEP;
import secarc._ast.ASTSecArcPort;
import secarc._ast.ASTSecArcRefRole; import secarc._ast.ASTSecArcRefRole;
import secarc._ast.ASTSecArcRole; import secarc._ast.ASTSecArcRole;
import secarc._ast.ASTSecArcRoleInterface; import secarc._ast.ASTSecArcRoleInterface;
import secarc._ast.ASTSecArcSimpleConnector;
import secarc._ast.ASTSecArcTrustlevelRelation; import secarc._ast.ASTSecArcTrustlevelRelation;
import secarc._ast.ASTSecMontiArcAutoConnect;
import mc.ast.ASTNode; import mc.ast.ASTNode;
import mc.ast.AbstractVisitor; import mc.ast.AbstractVisitor;
import mc.ast.ConcretePrettyPrinter; import mc.ast.ConcretePrettyPrinter;
...@@ -28,7 +34,6 @@ import mc.umlp.arcd._ast.ASTArcPort; ...@@ -28,7 +34,6 @@ import mc.umlp.arcd._ast.ASTArcPort;
import mc.umlp.arcd._ast.ASTArcSimpleConnector; import mc.umlp.arcd._ast.ASTArcSimpleConnector;
import mc.umlp.arcd._ast.ASTArcSubComponent; import mc.umlp.arcd._ast.ASTArcSubComponent;
import mc.umlp.arcd._ast.ASTArcSubComponentInstance; import mc.umlp.arcd._ast.ASTArcSubComponentInstance;
import mc.umlp.arcd.prettyprint.ArchitectureDiagramPrettyPrinterConcreteVisitor;
/** /**
* *
...@@ -45,7 +50,7 @@ import mc.umlp.arcd.prettyprint.ArchitectureDiagramPrettyPrinterConcreteVisitor; ...@@ -45,7 +50,7 @@ import mc.umlp.arcd.prettyprint.ArchitectureDiagramPrettyPrinterConcreteVisitor;
public class MontiSecArcConcretePrettyPrinter extends ConcretePrettyPrinter { public class MontiSecArcConcretePrettyPrinter extends ConcretePrettyPrinter {
private static final Class<?>[] RESPONSIBLE_CLASSES = new Class[] { private static final Class<?>[] RESPONSIBLE_CLASSES = new Class[] {
mc.umlp.arcd._ast.ASTMCCompilationUnit.class, ASTMCCompilationUnit.class,
ASTArcComponent.class, ASTArcComponentHead.class, ASTArcComponent.class, ASTArcComponentHead.class,
ASTArcComponentBody.class, ASTArcElement.class, ASTArcElementList.class, ASTArcComponentBody.class, ASTArcElement.class, ASTArcElementList.class,
ASTArcSubComponent.class, ASTArcSubComponent.class,
...@@ -55,7 +60,9 @@ public class MontiSecArcConcretePrettyPrinter extends ConcretePrettyPrinter { ...@@ -55,7 +60,9 @@ public class MontiSecArcConcretePrettyPrinter extends ConcretePrettyPrinter {
ASTSecArcIdentity.class, ASTSecArcTrustlevelRelation.class, ASTSecArcIdentity.class, ASTSecArcTrustlevelRelation.class,
ASTSecArcConfiguration.class, ASTSecArcCPE.class, ASTSecArcFilter.class, ASTSecArcConfiguration.class, ASTSecArcCPE.class, ASTSecArcFilter.class,
ASTSecArcPEP.class, ASTSecArcRole.class, ASTSecArcRefRole.class, ASTSecArcPEP.class, ASTSecArcRole.class, ASTSecArcRefRole.class,
ASTSecArcRoleInterface.class ASTSecArcRoleInterface.class, ASTSecArcFilterComponent.class, ASTSecArcConnector.class,
ASTSecArcSimpleConnector.class, ASTSecMontiArcAutoConnect.class, ASTSecArcFilterSubComponent.class,
ASTSecArcPort.class,
}; };
@Override @Override
......
...@@ -51,8 +51,8 @@ public class MontiSecArcPrettyPrintWorkflow extends DSLWorkflow<MontiSecArcRoot> ...@@ -51,8 +51,8 @@ public class MontiSecArcPrettyPrintWorkflow extends DSLWorkflow<MontiSecArcRoot>
// init and run the acutal visitor // init and run the acutal visitor
PrettyPrinter p = new PrettyPrinter(); PrettyPrinter p = new PrettyPrinter();
p.addConcretePrettyPrinter(new MontiSecArcConcretePrettyPrinter()); p.addConcretePrettyPrinter(new MontiSecArcConcretePrettyPrinter());
p.addConcretePrettyPrinter(new JavaDSLConcretePrettyPrinter()); // p.addConcretePrettyPrinter(new JavaDSLConcretePrettyPrinter());
p.addConcretePrettyPrinter(new OCLConcretePrettyPrinter()); // p.addConcretePrettyPrinter(new OCLConcretePrettyPrinter());
p.prettyPrint(ast, f.getContent()); p.prettyPrint(ast, f.getContent());
} }
......
...@@ -60,7 +60,7 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -60,7 +60,7 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
} else { } else {
this.printer.print("-"); this.printer.print("-");
} }
this.printer.print(a.getValue()); this.printer.print(a.getValue().getValue());
this.printer.print(" "); this.printer.print(" ");
this.printer.print(a.getReason()); this.printer.print(a.getReason());
this.printer.println(";"); this.printer.println(";");
...@@ -93,15 +93,14 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -93,15 +93,14 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
printComment(a.get_PostComments()); printComment(a.get_PostComments());
} }
@Override public void ownVisit(ASTSecArcConnector a) {
public void ownVisit(ASTArcConnector a) {
printComment(a.get_PreComments()); printComment(a.get_PreComments());
if (a.getStereotype() != null) { if (a.getStereotype() != null) {
visitExternal(a.getStereotype()); visitExternal(a.getStereotype());
printer.print(" "); printer.print(" ");
} }
this.printer.print("connect "); this.printer.print("connect ");
if(((ASTSecArcConnector) a).isEncrypted()) { if(a.isEncrypted()) {
this.printer.print("encrypted "); this.printer.print("encrypted ");
} else { } else {
this.printer.print("unencrypted "); this.printer.print("unencrypted ");
...@@ -119,10 +118,9 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -119,10 +118,9 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
printComment(a.get_PostComments()); printComment(a.get_PostComments());
} }
@Override public void ownVisit(ASTSecArcSimpleConnector sc) {
public void ownVisit(ASTArcSimpleConnector sc) {
visitExternal(sc.getStereotype()); visitExternal(sc.getStereotype());
if(((ASTSecArcSimpleConnector) sc).isEncrypted()) { if(sc.isEncrypted()) {
this.printer.print("encrypted "); this.printer.print("encrypted ");
} else { } else {
this.printer.print("unencrypted "); this.printer.print("unencrypted ");
...@@ -138,14 +136,13 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -138,14 +136,13 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
} }
@Override public void ownVisit(ASTSecMontiArcAutoConnect completion) {
public void ownVisit(ASTMontiArcAutoConnect completion) {
printer.print("autoconnect "); printer.print("autoconnect ");
if (completion.getStereotype() != null) { if (completion.getStereotype() != null) {
getVisitor().startVisit(completion.getStereotype()); getVisitor().startVisit(completion.getStereotype());
printer.print(" "); printer.print(" ");
} }
if(((ASTSecMontiArcAutoConnect) completion).isEncrypted()) { if(completion.isEncrypted()) {
this.printer.print("encrypted "); this.printer.print("encrypted ");
} else { } else {
this.printer.print("unencrypted "); this.printer.print("unencrypted ");
...@@ -162,8 +159,7 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -162,8 +159,7 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
printer.println(";"); printer.println(";");
} }
@Override public void ownVisit(ASTSecArcFilterComponent component) {
public void ownVisit(ASTArcComponent component) {
printComment(component.get_PreComments()); printComment(component.get_PreComments());
if (component.getStereotype() != null) { if (component.getStereotype() != null) {
this.startVisit(component.getStereotype()); this.startVisit(component.getStereotype());
...@@ -171,8 +167,8 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -171,8 +167,8 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
} }
this.printer.print("component " + component.getName()); this.printer.print("component " + component.getName());
if(((ASTSecArcFilterComponent) component).getSecArcFilter() != null) { if(component.getSecArcFilter() != null) {
this.printFilter(((ASTSecArcFilterComponent) component).getSecArcFilter()); this.printFilter((component).getSecArcFilter());
} }
if (component.getInstanceName() != null) { if (component.getInstanceName() != null) {
printer.print(" "); printer.print(" ");
...@@ -183,15 +179,14 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -183,15 +179,14 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
printComment(component.get_PostComments()); printComment(component.get_PostComments());
} }
@Override public void ownVisit(ASTSecArcFilterSubComponent ref) {
public void ownVisit(ASTArcSubComponent ref) {
if (ref.getStereotype() != null) { if (ref.getStereotype() != null) {
visitExternal(ref.getStereotype()); visitExternal(ref.getStereotype());
printer.print(" "); printer.print(" ");
} }
printer.print("component "); printer.print("component ");
if(((ASTSecArcFilterSubComponent) ref).getSecArcFilter() != null) { if(ref.getSecArcFilter() != null) {
this.printFilter(((ASTSecArcFilterSubComponent) ref).getSecArcFilter()); this.printFilter(ref.getSecArcFilter());
} }
getVisitor().startVisit(ref.getType()); getVisitor().startVisit(ref.getType());
if (ref.getArguments() != null && !ref.getArguments().isEmpty()) { if (ref.getArguments() != null && !ref.getArguments().isEmpty()) {
...@@ -215,17 +210,16 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint ...@@ -215,17 +210,16 @@ public class MontiSecArcPrettyPrinterConcreteVisitor extends MontiArcPrettyPrint
printer.println(";"); printer.println(";");
} }
@Override public void ownVisit(ASTSecArcPort a) {
public void ownVisit(ASTArcPort a) {
printComment(a.get_PreComments()); printComment(a.get_PreComments());
if (a.getStereotype() != null) { if (a.getStereotype() != null) {
getVisitor().startVisit(a.getStereotype()); getVisitor().startVisit(a.getStereotype());
} }
if(((ASTSecArcPort) a).isCritical()) { if(a.isCritical()) {
this.printer.print("critcal "); this.printer.print("critcal ");
} }
if(((ASTSecArcPort) a).getSecArcFilter() != null) { if(a.getSecArcFilter() != null) {
this.printFilter(((ASTSecArcPort) a).getSecArcFilter()); this.printFilter(a.getSecArcFilter());
} }
if (a.isIncoming()) { if (a.isIncoming()) {
this.printer.print("in "); this.printer.print("in ");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment