KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CDL > EnumList


1 /* $Id: EnumList.java,v 1.1.1.1 2003/02/11 16:19:40 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3
4 /** List for unique strings */
5 class EnumList extends List {
6   public EnumList() { super(); }
7   public boolean addName(String JavaDoc what) {
8     akt = first;
9     for (int i=0;i<count;i++) {
10       if (what.compareTo(((String JavaDoc)akt.item))==0)
11         return false;
12       toNext();
13     }
14     add(what);
15     return true;
16   }
17
18   public boolean isIn(String JavaDoc what) {
19     akt = first;
20     for (int i=0;i<count;i++) {
21       if (what.compareTo(((String JavaDoc)akt.item))==0)
22         return true;
23       toNext();
24     }
25     return false;
26   }
27
28   public String JavaDoc[] toArray() {
29     String JavaDoc[] ret = new String JavaDoc [count];
30     toFirst();
31     for (int i=0;i<count;i++) {
32       ret[i] = new String JavaDoc((String JavaDoc) aktual());
33       toNext();
34     }
35     return ret;
36   }
37 }
38
Popular Tags