1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.diagram.handler;
16 * Defines the meaning of the relationship which must either remain internal
17 * to a specific implementation or be published as API of an implementation
21 * A relationship <em>can</em> also have an inverse relationship but doesn't
26 * Implementations are strongly encouraged to have a <code>toString</code>
27 * that states the name of the relationship.
30 * @author Tuukka Lehtonen
32 public interface Relationship {
35 * @return null if there is no inverse relationship to this
37 Relationship getInverse();
39 // Some standard relationships between elements
42 * A compositional relationship between two elements.
44 Relationship CHILD_OF = new Relationship() {
45 public Relationship getInverse() { return PARENT_OF; }
47 public String toString() { return "CHILD OF"; }
49 Relationship PARENT_OF = new Relationship() {
50 public Relationship getInverse() { return CHILD_OF; }
52 public String toString() { return "PARENT OF"; }
56 * A relationship between two elements without any further semantics.
58 Relationship RELATED_TO = new Relationship() {
59 public Relationship getInverse() { return RELATED_TO; }
61 public String toString() { return "RELATED_TO"; }