X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fcontent%2FTerminalMap.java;fp=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fcontent%2FTerminalMap.java;h=45ed01a21f7ee137a1f724a2895b0a2664425b91;hp=d1164ae0f9ded400bac00919948aeb14ed62d0be;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/content/TerminalMap.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/content/TerminalMap.java index d1164ae0f..45ed01a21 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/content/TerminalMap.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/content/TerminalMap.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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.content; - -import java.util.HashMap; -import java.util.Map; - -import org.simantics.db.Resource; - -/** - * terminal <-> connection point - * - * @author Tuukka Lehtonen - */ -public class TerminalMap { - - public static final TerminalMap EMPTY = new TerminalMap(0) { - public void put(Resource terminal, Resource connectionPoint) { - throw new UnsupportedOperationException("immutable TerminalMap"); - } - }; - - private final Map leftToRight; - private final Map rightToLeft; - - public TerminalMap(int initialCapacity) { - leftToRight = new HashMap(initialCapacity); - rightToLeft = new HashMap(initialCapacity); - } - - public Resource getConnectionPoint(Resource terminal) { - return leftToRight.get(terminal); - } - - public Resource getTerminal(Resource connectionPoint) { - return rightToLeft.get(connectionPoint); - } - - public void put(Resource terminal, Resource connectionPoint) { - leftToRight.put(terminal, connectionPoint); - rightToLeft.put(connectionPoint, terminal); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 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.content; + +import java.util.HashMap; +import java.util.Map; + +import org.simantics.db.Resource; + +/** + * terminal <-> connection point + * + * @author Tuukka Lehtonen + */ +public class TerminalMap { + + public static final TerminalMap EMPTY = new TerminalMap(0) { + public void put(Resource terminal, Resource connectionPoint) { + throw new UnsupportedOperationException("immutable TerminalMap"); + } + }; + + private final Map leftToRight; + private final Map rightToLeft; + + public TerminalMap(int initialCapacity) { + leftToRight = new HashMap(initialCapacity); + rightToLeft = new HashMap(initialCapacity); + } + + public Resource getConnectionPoint(Resource terminal) { + return leftToRight.get(terminal); + } + + public Resource getTerminal(Resource connectionPoint) { + return rightToLeft.get(connectionPoint); + } + + public void put(Resource terminal, Resource connectionPoint) { + leftToRight.put(terminal, connectionPoint); + rightToLeft.put(connectionPoint, terminal); + } + +}