Skip to main content
summaryrefslogtreecommitdiffstats
blob: edb81abe2994cfbea4fcda41bb5eb4f10999afd1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/****************************************************************************
 * Copyright (c) 2004 Composent, Inc. and others.
 * 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:
 *    Composent, Inc. - initial API and implementation
 *****************************************************************************/

package org.eclipse.ecf.provider.generic;

import java.util.TreeMap;
import java.util.Collections;
import java.util.Map;
import java.util.Iterator;

public class SOContainerGroup {
	String name;
	protected Map map;

	public SOContainerGroup(String name) {
		this.name = name;
		map = Collections.synchronizedMap(new TreeMap());
	}

	public String add(String key, SOContainer aSpace) {
		if (key == null || aSpace == null)
			return null;
		map.put(key, aSpace);
		return key;
	}

	public SOContainer get(String key) {
		if (key == null)
			return null;
		return (SOContainer) map.get(key);
	}

	public SOContainer remove(String key) {
		if (key == null)
			return null;
		return (SOContainer) map.remove(key);
	}

	public boolean contains(String key) {
		if (key == null)
			return false;
		return map.containsKey(key);
	}

	public String getName() {
		return name;
	}

	public Iterator elements() {
		return map.values().iterator();
	}
}

Back to the top