X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2FRouteLink.java;fp=bundles%2Forg.simantics.diagram.connection%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fconnection%2FRouteLink.java;h=d3dccca5d8f145b841d3b09d1bc24e99f7c51f03;hp=27986a03fa59af21c9ffee36981c0fe6714773b9;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLink.java b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLink.java index 27986a03f..d3dccca5d 100644 --- a/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLink.java +++ b/bundles/org.simantics.diagram.connection/src/org/simantics/diagram/connection/RouteLink.java @@ -1,95 +1,95 @@ -/******************************************************************************* - * Copyright (c) 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.diagram.connection; - -import gnu.trove.map.hash.THashMap; - -import java.io.Serializable; - -public class RouteLink extends RoutePoint implements Serializable { - - private static final long serialVersionUID = 1446230300676765986L; - - RouteLine a; - RouteLine b; - - /** - * Default constructor for copy-method - */ - private RouteLink() { - } - - RouteLink(RouteLine a, RouteLine b) { - this.a = a; - this.b = b; - a.addPoint(this); - b.addPoint(this); - } - - void removeFromOther(RouteLine other) { - if(a == other) - b.points.remove(this); - else - a.points.remove(this); - } - - public RouteLine getA() { - return a; - } - - public RouteLine getB() { - return b; - } - - public void setA(RouteLine rl) { - this.a = rl; - rl.addPoint(this); - if(b.isTransient()) - b.terminal.line = rl; - } - - public void setB(RouteLine rl) { - this.b = rl; - rl.addPoint(this); - if(a.isTransient()) - a.terminal.line = rl; - } - - public RouteLine getOther(RouteLine line) { - if(a == line) - return b; - else - return a; - } - - public void replace(RouteLine rl1, RouteLine rl2) { - if(a == rl1) - setA(rl2); - else if(b == rl1) - setB(rl2); - } - - @Override - RouteLink copy(THashMap map) { - RouteLink copy = (RouteLink)map.get(this); - if(copy == null) { - copy = new RouteLink(); - map.put(this, copy); - copy.a = a.copy(map); - copy.b = b.copy(map); - copy.x = x; - copy.y = y; - } - return copy; - } - -} +/******************************************************************************* + * Copyright (c) 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.diagram.connection; + +import gnu.trove.map.hash.THashMap; + +import java.io.Serializable; + +public class RouteLink extends RoutePoint implements Serializable { + + private static final long serialVersionUID = 1446230300676765986L; + + RouteLine a; + RouteLine b; + + /** + * Default constructor for copy-method + */ + private RouteLink() { + } + + RouteLink(RouteLine a, RouteLine b) { + this.a = a; + this.b = b; + a.addPoint(this); + b.addPoint(this); + } + + void removeFromOther(RouteLine other) { + if(a == other) + b.points.remove(this); + else + a.points.remove(this); + } + + public RouteLine getA() { + return a; + } + + public RouteLine getB() { + return b; + } + + public void setA(RouteLine rl) { + this.a = rl; + rl.addPoint(this); + if(b.isTransient()) + b.terminal.line = rl; + } + + public void setB(RouteLine rl) { + this.b = rl; + rl.addPoint(this); + if(a.isTransient()) + a.terminal.line = rl; + } + + public RouteLine getOther(RouteLine line) { + if(a == line) + return b; + else + return a; + } + + public void replace(RouteLine rl1, RouteLine rl2) { + if(a == rl1) + setA(rl2); + else if(b == rl1) + setB(rl2); + } + + @Override + RouteLink copy(THashMap map) { + RouteLink copy = (RouteLink)map.get(this); + if(copy == null) { + copy = new RouteLink(); + map.put(this, copy); + copy.a = a.copy(map); + copy.b = b.copy(map); + copy.x = x; + copy.y = y; + } + return copy; + } + +}