X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.debug.ui%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fui%2Finternal%2FHashMultiMap.java;h=5fb7c3479d4a091b419acab48ab306ce5b51c266;hb=HEAD;hp=b37a00370c7e265842ce493ba23467a7c2e54011;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/HashMultiMap.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/HashMultiMap.java index b37a00370..5fb7c3479 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/HashMultiMap.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/internal/HashMultiMap.java @@ -1,45 +1,45 @@ -/******************************************************************************* - * 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.debug.ui.internal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class HashMultiMap extends HashMap> { - - private static final long serialVersionUID = 8928508639019379832L; - - public void add(D a, R b) { - List elements = get(a); - if(elements == null) { - elements = new ArrayList(1); - put(a, elements); - } - elements.add(b); - } - -// public boolean remove(D a, R b) { -// List elements = get(a); -// if(elements == null) -// return false; -// if(elements.remove(b)) { -// // This would makes in some applications -// //if(elements.isEmpty()) -// // remove(a); -// return true; -// } -// else -// return false; -// } - -} +/******************************************************************************* + * 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.debug.ui.internal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class HashMultiMap extends HashMap> { + + private static final long serialVersionUID = 8928508639019379832L; + + public void add(D a, R b) { + List elements = get(a); + if(elements == null) { + elements = new ArrayList(1); + put(a, elements); + } + elements.add(b); + } + +// public boolean remove(D a, R b) { +// List elements = get(a); +// if(elements == null) +// return false; +// if(elements.remove(b)) { +// // This would makes in some applications +// //if(elements.isEmpty()) +// // remove(a); +// return true; +// } +// else +// return false; +// } + +}