1 package org.simantics.sysdyn.modelImport.model.element;
\r
3 import org.simantics.databoard.Bindings;
\r
4 import org.simantics.db.ReadGraph;
\r
5 import org.simantics.db.Resource;
\r
6 import org.simantics.db.WriteGraph;
\r
7 import org.simantics.db.exception.DatabaseException;
\r
8 import org.simantics.layer0.Layer0;
\r
9 import org.simantics.sysdyn.SysdynResource;
\r
10 import org.simantics.sysdyn.modelImport.model.WriteContext;
\r
12 public class Dependency extends Connection {
\r
14 private boolean showArrow;
\r
15 private boolean showDelay;
\r
16 private double angle;
\r
18 public Dependency(Symbol head, Symbol tail, boolean showArrow, boolean showDelay, double angle) {
\r
20 this.showArrow = showArrow;
\r
21 this.showDelay = showDelay;
\r
26 public Resource write(WriteGraph graph, Resource parent, WriteContext context) throws DatabaseException {
\r
27 if (head == null || tail == null) {
\r
28 System.err.println("dependency missing head or tail");
\r
32 Layer0 l0 = Layer0.getInstance(graph);
\r
33 SysdynResource sr = SysdynResource.getInstance(graph);
\r
35 Resource dependency = super.write(graph, parent, context);
\r
36 graph.claimLiteral(dependency, l0.HasName, context.getNextDependency(), Bindings.STRING);
\r
38 graph.claimLiteral(getDiagramResource(), sr.Dependency_angle, angle, Bindings.DOUBLE);
\r
44 public Resource getConnectionType(ReadGraph graph) {
\r
45 return SysdynResource.getInstance(graph).Dependency;
\r
49 public Resource getDiagramConnectionType(ReadGraph graph) {
\r
50 return SysdynResource.getInstance(graph).DependencyConnection;
\r