2 This class represents a list of (unique) flags, which may exist,
3 but only once at max. If we add some flag twice, nothing really
6 Flaglists can also be used to collect things like search path
11 void add(String name) -> add some flag
12 void clear(String name) -> clear some flag
13 String[] getFlagNames() -> lists all flags to an String array
17 package org
.de
.metux
.util
;
19 import java
.util
.Hashtable
;
20 import java
.util
.Enumeration
;
22 public class UniqueNameList
24 Hashtable ht
= new Hashtable();
26 public void add(String name
)
28 if ((name
!=null)&&(name
.length()!=0))
32 public void add(String name
[])
35 for (int x
=0; x
<name
.length
; x
++)
39 public void clear(String name
)
41 if ((name
!=null)&&(name
.length()!=0))
45 public String
[] getNames()
47 String res
[] = new String
[ht
.size()];
49 for (Enumeration e
=ht
.keys(); e
.hasMoreElements();)
50 res
[x
++]=(String
)e
.nextElement();
54 public boolean exists(String name
)
56 return (ht
.get(name
) != null);
59 public String
toString()
62 for (Enumeration e
=ht
.keys(); e
.hasMoreElements();)
63 s
= ((s
==null)?
("{ \""):", \"")+e
.nextElement()+"\"";