1
|
/**
|
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
|
* @author m.doering
|
22
|
* 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
|
}
|