Project

General

Profile

Download (1.04 KB) Statistics
| Branch: | Tag: | Revision:
1 9479da48 Andreas Müller
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
10
package eu.etaxonomy.cdm.model.common;
11
12
import java.util.ArrayList;
13
import java.util.AbstractSet;
14
import java.util.HashSet;
15
16
import javax.persistence.Entity;
17
18
import org.apache.log4j.Logger;
19
20
/**
21 33f9b501 m.doering
 * @author m.doering
22 9479da48 Andreas Müller
 * Special array that takes care that all LanguageString elements have a unique language
23
 */
24
//@Entity
25
public class MultilanguageSet extends HashSet<LanguageString>{
26
	static Logger logger = Logger.getLogger(MultilanguageSet.class);
27
28
	public void add(String text, Language lang){
29
		LanguageString ls = new LanguageString(text, lang);
30
		super.add(ls);
31
	}
32
	public void remove(Language lang){
33
		super.remove(get(lang));
34
	}
35
	public LanguageString get(Language lang){
36
		// FIXME: ...
37
		for (LanguageString ls : this){
38
			if (ls.getLanguage()==lang){
39
				return ls;
40
			}
41
		}
42
		return null;
43
	}
44
}