--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.g2d.diagram.handler;\r
+\r
+\r
+/**\r
+ * Defines the meaning of the relationship which must either remain internal\r
+ * to a specific implementation or be published as API of an implementation\r
+ * of this handler.\r
+ * \r
+ * <p>\r
+ * A relationship <em>can</em> also have an inverse relationship but doesn't\r
+ * have to.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * Implementations are strongly encouraged to have a <code>toString</code>\r
+ * that states the name of the relationship.\r
+ * </p>\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ */\r
+public interface Relationship {\r
+\r
+ /**\r
+ * @return null if there is no inverse relationship to this\r
+ */\r
+ Relationship getInverse();\r
+\r
+ // Some standard relationships between elements\r
+\r
+ /**\r
+ * A compositional relationship between two elements. \r
+ */\r
+ Relationship CHILD_OF = new Relationship() {\r
+ public Relationship getInverse() { return PARENT_OF; }\r
+ @Override\r
+ public String toString() { return "CHILD OF"; }\r
+ };\r
+ Relationship PARENT_OF = new Relationship() {\r
+ public Relationship getInverse() { return CHILD_OF; }\r
+ @Override\r
+ public String toString() { return "PARENT OF"; }\r
+ };\r
+\r
+ /**\r
+ * A relationship between two elements without any further semantics.\r
+ */\r
+ Relationship RELATED_TO = new Relationship() {\r
+ public Relationship getInverse() { return RELATED_TO; }\r
+ @Override\r
+ public String toString() { return "RELATED_TO"; }\r
+ };\r
+\r
+}
\ No newline at end of file