return symbols.iterator().next();
}
+ public void remove(WriteGraph g) throws DatabaseException{
+ Layer0 L0 = Layer0.getInstance(g);
+ StructuralResource2 STR = StructuralResource2.getInstance(g);
+ DiagramResource DIA = DiagramResource.getInstance(g);
+ OrderedSetUtils.remove(g, diagram.getDiagram(), element);
+ if (component != null)
+ g.deny(component, L0.PartOf);
+ Collection<Statement> statements = g.getStatements(element, STR.IsConnectedTo);
+ for (Statement s : statements) {
+ if (g.isInstanceOf(s.getObject(),DIA.Connector)) {
+ Resource connectedConnector = g.getPossibleObject(s.getObject(), DIA.AreConnected);
+ if (connectedConnector != null)
+ g.deny(connectedConnector);
+ g.deny(s.getObject());
+ }
+ }
+ if (component != null) {
+ statements = g.getStatements(component, STR.IsConnectedTo);
+ for (Statement s : statements) {
+ if (g.isInstanceOf(s.getObject(),STR.Connection)) {
+ g.deny(s.getObject());
+ }
+ }
+ }
+ g.deny(element);
+ if (component != null)
+ g.deny(component);
+ }
+
public void dispose() {
diagram = null;
component = null;
}
}
- private static class PointConnectionDataImpl implements PointConnectionData {
-
- private Symbol point;
-
- public PointConnectionDataImpl(Symbol point) {
- this.point = point;
- }
-
- @Override
- public Symbol getPoint() {
- return point;
- }
- }
-
- private static class SignalConnectionDataImpl implements SignalConnectionData, DiagramConnectionData{
-
- private Resource signalComponent;
- private Resource[] connectors;
-
- public SignalConnectionDataImpl(Resource signalComponent, Resource... connectors) {
- this.signalComponent = signalComponent;
- this.connectors = connectors;
- }
-
- @Override
- public Resource getSignalComponent() {
- return signalComponent;
- }
-
- @Override
- public Resource getConnection(int index) {
- return connectors[index];
- }
-
- @Override
- public int getConnectionCount() {
- return connectors.length;
- }
-
- }
-
private static class FlagConnectionDataImpl implements FlagConnectionData, DiagramConnectionData {
private Symbol firstFlag;