annotate dwtx/dwtxhelper/Collection.d @ 187:293a2f22f944

Add Collection impl
author Frank Benoit <benoit@tionex.de>
date Sun, 26 Oct 2008 14:04:17 +0100
parents 26589d623405
children 6d35b9960800
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 module dwtx.dwtxhelper.Collection;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 import dwt.dwthelper.utils;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
5 static import tango.core.Exception;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 static import tango.util.container.CircularList;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 static import tango.util.container.HashMap;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
8 static import tango.util.container.HashSet;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 static import tango.util.container.SortedMap;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
10 static import tango.util.container.more.Vector;
119
35f1d208f3c3 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 116
diff changeset
11 static import tango.core.Array;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
13 // class AListIterator {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
14 //
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
15 // ArraySeq!(Object) c;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
16 // int i;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
17 //
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
18 // this( ArraySeq!(Object) c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
19 // this.c = c;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
20 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
21 //
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
22 // Object next(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
23 // return c.get(++i);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
24 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
25 // Object previous(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
26 // return c.get(--i);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
27 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
28 //
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
29 // bool hasNext(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
30 // return i+1 < c.size();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
31 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
32 // bool hasPrevious(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
33 // return i > 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
34 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
35 //
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
36 // void remove(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
37 // c.removeAt(i);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
38 // if( i is c.size() ) i--;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
39 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
40 // int nextIndex(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
41 // return i+1;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
42 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
43 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
44
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
45
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
46 interface Iterator {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 public bool hasNext();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 public Object next();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 public void remove();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
52 interface Enumeration {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
53 public bool hasMoreElements();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
54 public Object nextElement();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
55 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
56
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 interface Collection {
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 public bool add(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
59 public bool add(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 public bool addAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 public void clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 public bool contains(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 public bool containsAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 public int opEquals(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 public hash_t toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 public bool isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 public Iterator iterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 public bool remove(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
69 public bool remove(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 public bool removeAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 public bool retainAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 public int size();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 public Object[] toArray();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 public Object[] toArray(Object[] a);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
75
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
76 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
77 public int opApply (int delegate(ref Object value) dg);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
80 interface Map {
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
81 interface Entry {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
82 int opEquals(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
83 Object getKey();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
84 Object getValue();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
85 hash_t toHash();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
86 Object setValue(Object value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
87 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 public void clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89 public bool containsKey(Object key);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
90 public bool containsKey(String key);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 public bool containsValue(Object value);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 public Set entrySet();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 public int opEquals(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 public Object get(Object key);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
95 public Object get(String key);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 public hash_t toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97 public bool isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 public Set keySet();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99 public Object put(Object key, Object value);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
100 public Object put(String key, Object value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
101 public Object put(Object key, String value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
102 public Object put(String key, String value);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
103 public void putAll(Map t);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 public Object remove(Object key);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
105 public Object remove(String key);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 public int size();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 public Collection values();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109 // only for D
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 public int opApply (int delegate(ref Object value) dg);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 public int opApply (int delegate(ref Object key, ref Object value) dg);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
113
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
114 interface List : Collection {
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
115 public void add(int index, Object element);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
116 public bool add(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
117 public bool add(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118 public bool addAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
119 public bool addAll(int index, Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 public void clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
121 public bool contains(Object o);
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
122 public bool contains(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 public bool containsAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 public int opEquals(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 public Object get(int index);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 public hash_t toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 public int indexOf(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128 public bool isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 public Iterator iterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 public int lastIndexOf(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 public ListIterator listIterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132 public ListIterator listIterator(int index);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 public Object remove(int index);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 public bool remove(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
135 public bool remove(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
136 public bool removeAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
137 public bool retainAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 public Object set(int index, Object element);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
139 public int size();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
140 public List subList(int fromIndex, int toIndex);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
141 public Object[] toArray();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 public Object[] toArray(Object[] a);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
143 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
144
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 interface Set : Collection {
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
146 public bool add(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
147 public bool add(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 public bool addAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
149 public void clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
150 public bool contains(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
151 public bool contains(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 public bool containsAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 public int opEquals(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 public hash_t toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
155 public bool isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
156 public Iterator iterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
157 public bool remove(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
158 public bool remove(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
159 public bool removeAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
160 public bool retainAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
161 public int size();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
162 public Object[] toArray();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
163 public Object[] toArray(Object[] a);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
164 public String toString();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
165
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
166 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
167 public int opApply (int delegate(ref Object value) dg);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
168 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
169
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
170 interface SortedSet : Set {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
171 Comparator comparator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
172 Object first();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
173 SortedSet headSet(Object toElement);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
174 Object last();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
175 SortedSet subSet(Object fromElement, Object toElement);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
176 SortedSet tailSet(Object fromElement);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
177 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
178
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
179 interface SortedMap : Map {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
180 Comparator comparator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
181 Object firstKey();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
182 SortedMap headMap(Object toKey);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
183 Object lastKey();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
184 SortedMap subMap(Object fromKey, Object toKey);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
185 SortedMap tailMap(Object fromKey);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
186 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
187
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
188 interface ListIterator : Iterator {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
189 public void add(Object o);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
190 public bool add(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
191 public bool hasNext();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
192 public bool hasPrevious();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
193 public Object next();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
194 public int nextIndex();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
195 public Object previous();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
196 public int previousIndex();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
197 public void remove();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
198 public void set(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
199 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
200
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
201 ///////////////////////////////////////////////////////////////////////////////////////////////////
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
202 ///////////////////////////////////////////////////////////////////////////////////////////////////
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
203 class MapEntry : Map.Entry {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
204 Map map;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
205 Object key;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
206 private this( Map map, Object key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
207 this.map = map;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
208 this.key = key;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
209 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
210 public override int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
211 if( auto other = cast(MapEntry)o){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
212
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
213 if(( getKey() is null ? other.getKey() is null : getKey() == other.getKey() ) &&
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
214 ( getValue() is null ? other.getValue() is null : getValue() == other.getValue() )){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
215 return true;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
216 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
217 return false;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
218 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
219 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
220 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
221 public Object getKey(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
222 return key;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
223 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
224 public Object getValue(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
225 return map.get(key);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
226 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
227 public override hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
228 return ( getKey() is null ? 0 : getKey().toHash() ) ^
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
229 ( getValue() is null ? 0 : getValue().toHash() );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
230 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
231 public Object setValue(Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
232 return map.put( key, value );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
233 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
234
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
235 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
237 class HashMap : Map {
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
238 // The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239 alias tango.util.container.HashMap.HashMap!(Object,Object) MapType;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 private MapType map;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 public this(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243 map = new MapType();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245 public this(int initialCapacity){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
246 this();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
247 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
248 public this(int initialCapacity, float loadFactor){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
249 map = new MapType(loadFactor);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
250 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
251 public this(Map m){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
252 this();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
253 putAll(m);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255 public void clear(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 map.clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 public bool containsKey(Object key){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 Object v;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 return map.get(key, v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
262 public bool containsKey(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
263 return containsKey(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
264 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 public bool containsValue(Object value){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
266 return map.contains(value);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
267 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
268 public Set entrySet(){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
269 HashSet res = new HashSet();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
270 foreach( k, v; map ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
271 res.add( new MapEntry(this,k));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
272 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
273 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
274 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
275 public override int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
276 if( auto other = cast(HashMap) o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 if( other.size() !is size() ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
278 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
279 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
280 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
281 Object vo = other.get(k);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
282 if( v != vo ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
283 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
284 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
285 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
286 return true;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
287 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
289 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
290 public Object get(Object key){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
291 if( auto v = key in map ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
292 return *v;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
293 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
294 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
295 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
296 public Object get(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
297 return get(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
298 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
299 public override hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 return super.toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
302 public bool isEmpty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 return map.isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
305 public Set keySet(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
306 HashSet res = new HashSet();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
307 foreach( k, v; map ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
308 res.add(k);
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
309 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
310 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312 public Object put(Object key, Object value){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
313 Object res = null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
314 if( auto vold = key in map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
315 res = *vold;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
317 map[ key ] = value;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
318 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
319 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
320 public Object put(String key, Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
321 return put( stringcast(key), value );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
322 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
323 public Object put(Object key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
324 return put( key, stringcast(value) );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
325 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
326 public Object put(String key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
327 return put( stringcast(key), stringcast(value) );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
328 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
329 public void putAll(Map t){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
330 foreach( k, v; t ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
331 map[k] = v;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
332 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
333 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
334 public Object remove(Object key){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
335 if( auto v = key in map ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
336 Object res = *v;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
337 map.remove(key);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
338 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
339 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
340 map.remove(key);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
341 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
342 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
343 public Object remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
344 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
345 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
346 public int size(){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
347 return map.size();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
348 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
349 public Collection values(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
350 ArrayList res = new ArrayList( size() );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
351 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 res.add( v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
353 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
355 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
356
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357 public int opApply (int delegate(ref Object value) dg){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
360 public int opApply (int delegate(ref Object key, ref Object value) dg){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
361 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
362 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
363
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
364 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
365
159
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
366 class IdentityHashMap : Map {
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
367 alias tango.util.container.HashMap.HashMap!(Object,Object) MapType;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
368 private MapType map;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
369
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
370 public this(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
371 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
372 map = new MapType();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
373 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
374 public this(int initialCapacity){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
375 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
376 this();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
377 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
378 public this(int initialCapacity, float loadFactor){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
379 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
380 map = new MapType(loadFactor);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
381 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
382 public this(Map m){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
383 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
384 this();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
385 putAll(m);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
386 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
387 public void clear(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
388 map.clear();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
389 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
390 public bool containsKey(Object key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
391 Object v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
392 return map.get(key, v );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
393 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
394 public bool containsKey(String key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
395 return containsKey(stringcast(key));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
396 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
397 public bool containsValue(Object value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
398 return map.contains(value);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
399 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
400 public Set entrySet(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
401 HashSet res = new HashSet();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
402 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
403 res.add( new MapEntry(this,k));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
404 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
405 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
406 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
407 public override int opEquals(Object o){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
408 if( auto other = cast(HashMap) o ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
409 if( other.size() !is size() ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
410 return false;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
411 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
412 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
413 Object vo = other.get(k);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
414 if( v != vo ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
415 return false;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
416 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
417 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
418 return true;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
419 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
420 return false;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
421 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
422 public Object get(Object key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
423 if( auto v = key in map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
424 return *v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
425 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
426 return null;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
427 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
428 public Object get(String key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
429 return get(stringcast(key));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
430 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
431 public override hash_t toHash(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
432 return super.toHash();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
433 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
434 public bool isEmpty(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
435 return map.isEmpty();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
436 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
437 public Set keySet(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
438 HashSet res = new HashSet();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
439 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
440 res.add(k);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
441 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
442 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
443 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
444 public Object put(Object key, Object value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
445 Object res = null;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
446 if( auto vold = key in map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
447 res = *vold;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
448 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
449 map[ key ] = value;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
450 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
451 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
452 public Object put(String key, Object value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
453 return put( stringcast(key), value );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
454 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
455 public Object put(Object key, String value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
456 return put( key, stringcast(value) );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
457 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
458 public Object put(String key, String value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
459 return put( stringcast(key), stringcast(value) );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
460 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
461 public void putAll(Map t){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
462 foreach( k, v; t ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
463 map[k] = v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
464 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
465 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
466 public Object remove(Object key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
467 if( auto v = key in map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
468 Object res = *v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
469 map.remove(key);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
470 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
471 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
472 map.remove(key);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
473 return null;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
474 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
475 public Object remove(String key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
476 return remove(stringcast(key));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
477 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
478 public int size(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
479 return map.size();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
480 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
481 public Collection values(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
482 ArrayList res = new ArrayList( size() );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
483 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
484 res.add( v );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
485 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
486 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
487 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
488
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
489 public int opApply (int delegate(ref Object value) dg){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
490 return map.opApply( dg );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
491 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
492 public int opApply (int delegate(ref Object key, ref Object value) dg){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
493 return map.opApply( dg );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
494 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
495 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
496
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
497 class Dictionary {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
498 public this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
499 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
500 abstract Enumeration elements();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
501 abstract Object get(Object key);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
502 Object get(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
503 return get(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
504 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
505 abstract bool isEmpty();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
506 abstract Enumeration keys();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
507 abstract Object put(Object key, Object value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
508 public Object put(String key, Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
509 return put(stringcast(key), value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
510 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
511 public Object put(Object key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
512 return put(key, stringcast(value));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
513 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
514 public Object put(String key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
515 return put(stringcast(key), stringcast(value));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
516 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
517 abstract Object remove(Object key);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
518 public Object remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
519 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
520 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
521 abstract int size();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
522 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
523
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
524
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
525 // no nulls
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
526 // synchronized
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
527 class Hashtable : Dictionary, Map {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
528
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
529 public Object get(String key){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
530 return super.get(key);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
531 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
532 public Object put(String key, Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
533 return super.put(key, value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
534 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
535 public Object put(Object key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
536 return super.put(key, value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
537 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
538 public Object put(String key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
539 return super.put(key, value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
540 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
541 public Object remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
542 return super.remove(key);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
543 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
544
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
545 Object[Object] map;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
546
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
547 // The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
548 public this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
549 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
550 public this(int initialCapacity){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
551 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
552 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
553 public this(int initialCapacity, float loadFactor){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
554 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
555 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
556 public this(Map t){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
557 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
558 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
559
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
560 class ObjectEnumeration : Enumeration {
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
561 Object[] values;
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
562 int index = 0;
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
563 this( Object[] values ){
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
564 this.values = values;
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
565 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
566 public bool hasMoreElements(){
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
567 return index < values.length;
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
568 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
569 public Object nextElement(){
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
570 Object res = values[index];
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
571 index++;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
572 return res;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
573 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
574 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
575
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
576 Enumeration elements(){
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
577 return new ObjectEnumeration( map.values );
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
578 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
579 Enumeration keys() {
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
580 return new ObjectEnumeration( map.keys );
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
581 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
582 public synchronized void clear(){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
583 map = null;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
584 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
585 public synchronized bool containsKey(Object key){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
586 if( auto v = key in map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
587 return true;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
588 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
589 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
590 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
591 public synchronized bool containsKey(String key){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
592 return containsKey(stringcast(key));
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
593 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
594 public synchronized bool containsValue(Object value){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
595 foreach( k, v; map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
596 if( v == value ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
597 return true;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
598 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
599 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
600 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
601 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
602 public Set entrySet(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
603 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
604 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
605 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
606 public int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
607 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
608 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
609 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
610 public synchronized Object get(Object key){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
611 if( auto v = key in map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
612 return *v;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
613 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
614 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
615 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
616 public hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
617 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
618 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
619 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
620 public synchronized bool isEmpty(){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
621 return map.length is 0;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
622 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
623 public Set keySet(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
624 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
625 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
626 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
627 public synchronized Object put(Object key, Object value){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
628 Object res = null;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
629 if( auto v = key in map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
630 res = *v;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
631 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
632 map[ key ] = value;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
633 return res;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
634 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
635 // public Object put(String key, Object value)
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
636 // public Object put(Object key, String value)
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
637 // public Object put(String key, String value)
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
638 public synchronized void putAll(Map t){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
639 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
640 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
641 public synchronized Object remove(Object key){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
642 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
643 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
644 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
645 // public Object remove(String key)
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
646 public synchronized int size(){
128
8df1d4193877 Fix: runtime error in ui.forms. Arrays had an intermediate copy, so values were not stored correctly.
Frank Benoit <benoit@tionex.de>
parents: 127
diff changeset
647 return map.length;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
648 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
649 public Collection values(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
650 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
651 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
652 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
653
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
654 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
655 public int opApply (int delegate(ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
656 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
657 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
658 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
659 public int opApply (int delegate(ref Object key, ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
660 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
661 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
662 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
663
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
664 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
665
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
666 abstract class AbstractMap : Map {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
667 public this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
668 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
669 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
670 void clear(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
671 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
672 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
673 protected Object clone(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
674 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
675 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
676 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
677 bool containsKey(Object key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
678 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
679 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
680 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
681 bool containsValue(Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
682 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
683 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
684 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
685 abstract Set entrySet();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
686
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
687 public override int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
688 if( Map other = cast(Map)o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
689 return entrySet().opEquals( cast(Object) other.entrySet() );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
690 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
691 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
692 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
693
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
694 Object get(Object key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
695 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
696 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
697 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
698 public override hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
699 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
700 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
701 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
702 bool isEmpty(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
703 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
704 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
705 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
706 Set keySet(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
707 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
708 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
709 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
710 Object put(Object key, Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
711 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
712 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
713 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
714 void putAll(Map t){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
715 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
716 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
717 Object remove(Object key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
718 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
719 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
720 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
721 int size(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
722 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
723 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
724 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
725 String toString(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
726 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
727 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
728 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
729 Collection values(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
730 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
731 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
732 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
733 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
734
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
735 class TreeMap : Map, SortedMap {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
736 alias tango.util.container.SortedMap.SortedMap!(Object,Object) MapType;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
737 private MapType map;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
738
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
739 public this(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
740 map = new MapType();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
741 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
742 public this(Comparator c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
743 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
744 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
745 public this(Map m){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
746 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
747 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
748 public this(SortedMap m){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
749 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
750 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
751 public void clear(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
752 map.clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
753 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
754 Comparator comparator(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
755 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
756 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
757 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
758 public bool containsKey(Object key){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
759 Object v;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
760 return map.get(key, v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
761 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
762 public bool containsKey(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
763 return containsKey(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
764 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
765 public bool containsValue(Object value){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
766 return map.contains(value);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
767 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
768 public Set entrySet(){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
769 TreeSet res = new TreeSet();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
770 foreach( k, v; map ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
771 res.add( new MapEntry(this,k) );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
772 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
773 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
774 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
775 public override int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
776 if( auto other = cast(HashMap) o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
777 if( other.size() !is size() ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
778 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
779 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
780 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
781 Object vo = other.get(k);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
782 if( v != vo ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
783 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
784 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
785 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
786 return true;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
787 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
788 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
789 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
790 Object firstKey(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
791 foreach( k; map ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
792 return k;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
793 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
794 throw new tango.core.Exception.NoSuchElementException( "TreeMap.firstKey" );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
795 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
796 public Object get(Object key){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
797 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
798 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
799 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
800 public Object get(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
801 return get(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
802 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
803 public override hash_t toHash(){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
804 // http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractMap.html#hashCode()
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
805 hash_t res = 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
806 foreach( e; entrySet() ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
807 res += e.toHash();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
808 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
809 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
810 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
811 SortedMap headMap(Object toKey){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
812 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
813 return null;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
814 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
815 public bool isEmpty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
816 return map.isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
817 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
818 public Set keySet(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
819 TreeSet res = new TreeSet();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
820 foreach( k; map ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
821 res.add( k );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
822 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
823 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
824 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
825 Object lastKey(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
826 Object res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
827 foreach( k; map ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
828 res = k;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
829 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
830 if( map.size() ) return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
831 throw new tango.core.Exception.NoSuchElementException( "TreeMap.lastKey" );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
832 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
833 public Object put(Object key, Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
834 if( map.contains(key) ){ // TODO if tango has opIn_r, then use the "in" operator
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
835 Object res = map[key];
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
836 map[key] = value;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
837 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
838 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
839 map[key] = value;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
840 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
841 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
842 public Object put(String key, Object value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
843 return put(stringcast(key), value);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
844 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
845 public Object put(Object key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
846 return put(key, stringcast(value));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
847 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
848 public Object put(String key, String value){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
849 return put(stringcast(key), stringcast(value));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
850 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
851 public void putAll(Map t){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
852 foreach( k, v; t ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
853 put( k, v );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
854 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
855 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
856 public Object remove(Object key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
857 Object res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
858 map.take(key,res);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
859 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
860 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
861 public Object remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
862 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
863 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
864 public int size(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
865 return map.size();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
866 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
867 SortedMap subMap(Object fromKey, Object toKey){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
868 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
869 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
870 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
871 SortedMap tailMap(Object fromKey){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
872 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
873 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
874 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
875 public Collection values(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
876 ArrayList res = new ArrayList( size() );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
877 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
878 res.add( v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
879 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
880 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
881 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
882
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
883 public int opApply (int delegate(ref Object value) dg){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
884 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
885 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
886 public int opApply (int delegate(ref Object key, ref Object value) dg){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
887 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
888 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
889 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
890
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
891 class HashSet : Set {
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
892 alias tango.util.container.HashSet.HashSet!(Object) SetType;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
893 private SetType set;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
894
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
895 public this(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
896 set = new SetType();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
897 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
898 public this(Collection c){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
899 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
900 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
901 public this(int initialCapacity){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
902 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
903 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
904 public this(int initialCapacity, float loadFactor){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
905 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
906 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
907 public bool add(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
908 return set.add(o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
909 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
910 public bool add(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
911 return add(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
912 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
913 public bool addAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
914 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
915 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
916 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
917 public void clear(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
918 set.clear();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
919 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
920 public bool contains(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
921 return set.contains(o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
922 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
923 public bool contains(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
924 return contains(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
925 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
926 public bool containsAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
927 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
928 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
929 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
930 public override int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
931 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
932 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
933 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
934 public override hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
935 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
936 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
937 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
938 public bool isEmpty(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
939 return set.isEmpty();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
940 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
941 class LocalIterator : Iterator {
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
942 SetType.Iterator iter;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
943 Object nextElem;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
944 this( SetType.Iterator iter){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
945 this.iter = iter;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
946 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
947 public bool hasNext(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
948 return iter.next(nextElem);
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
949 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
950 public Object next(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
951 return nextElem;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
952 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
953 public void remove(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
954 iter.remove();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
955 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
956 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
957 public Iterator iterator(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
958 return new LocalIterator(set.iterator());
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
959 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
960 public bool remove(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
961 return set.remove(o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
962 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
963 public bool remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
964 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
965 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
966 public bool removeAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
967 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
968 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
969 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
970 public bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
971 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
972 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
973 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
974 public int size(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
975 return set.size();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
976 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
977 public Object[] toArray(){
180
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
978 Object[] res;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
979 res.length = size();
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
980 int idx = 0;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
981 foreach( o; set ){
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
982 res[idx] = o;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
983 idx++;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
984 }
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
985 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
986 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
987 public Object[] toArray(Object[] a){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
988 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
989 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
990 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
991 public override String toString(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
992 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
993 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
994 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
995
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
996 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
997 public int opApply (int delegate(ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
998 return set.opApply(dg);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
999 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1000
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1001 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1002
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1003 abstract class AbstractCollection : Collection {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1004 this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1005 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1006 bool add(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1007 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1008 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1009 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1010 bool addAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1011 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1012 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1013 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1014 void clear(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1015 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1016 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1017 bool contains(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1018 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1019 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1020 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1021 bool containsAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1022 if( c is null ) throw new NullPointerException();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1023 foreach( o; c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1024 if( !contains(o) ) return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1025 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1026 return true;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1027 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1028 override int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1029 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1030 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1031 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1032 bool isEmpty(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1033 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1034 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1035 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1036 abstract Iterator iterator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1037 override hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1038 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1039 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1040 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1041 bool remove(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1042 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1043 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1044 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1045 bool remove(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1046 return remove(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1047 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1048 bool removeAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1049 if( c is null ) throw new NullPointerException();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1050 bool res = false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1051 foreach( o; c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1052 res |= remove(o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1053 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1054 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1055 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1056 bool retainAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1057 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1058 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1059 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1060 abstract int size();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1061 Object[] toArray(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1062 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1063 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1064 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1065 Object[] toArray(Object[] a){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1066 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1067 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1068 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1069 String toString(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1070 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1071 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1072 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1073 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1074
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1075 abstract class AbstractSet : AbstractCollection, Set {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1076 this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1077 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1078 int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1079 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1080 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1081 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1082 hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1083 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1084 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1085 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1086 bool removeAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1087 return super.removeAll(c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1088 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1089 public abstract bool add(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1090 public abstract bool add(String o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1091 public abstract bool addAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1092 public abstract void clear();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1093 public abstract bool contains(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1094 public abstract bool contains(String o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1095 public abstract bool containsAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1096
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1097
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1098 public abstract bool isEmpty();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1099 public abstract Iterator iterator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1100 public abstract bool remove(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1101 public abstract bool remove(String o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1102 public abstract bool removeAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1103 public abstract bool retainAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1104 public abstract int size();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1105 public abstract Object[] toArray();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1106 public abstract Object[] toArray(Object[] a);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1107 public abstract String toString(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1108 return super.toString();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1109 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1110
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1111 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1112 public abstract int opApply (int delegate(ref Object value) dg);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1113 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1114
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1115 abstract class AbstractList : AbstractCollection, List {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1116 this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1117 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1118
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1119 public abstract void add(int index, Object element);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1120 public abstract bool add(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1121 public abstract bool addAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1122 public abstract bool addAll(int index, Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1123 public abstract void clear();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1124 public abstract bool contains(Object o);
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1125 public bool contains(String str){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1126 return contains(stringcast(str));
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1127 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1128 public abstract bool containsAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1129 public abstract int opEquals(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1130 public abstract Object get(int index);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1131
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1132 public hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1133 // http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html#hashCode()
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1134 hash_t hashCode = 1;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1135 Iterator i = iterator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1136 while (i.hasNext()) {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1137 Object obj = i.next();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1138 hashCode = 31 * hashCode + (obj is null ? 0 : obj.toHash());
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1139 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1140 return hashCode;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1141 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1142
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1143 public abstract int indexOf(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1144 public abstract bool isEmpty();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1145 public abstract Iterator iterator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1146 public abstract int lastIndexOf(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1147 public abstract ListIterator listIterator();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1148 public abstract ListIterator listIterator(int index);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1149 public abstract Object remove(int index);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1150 protected abstract void removeRange(int fromIndex, int toIndex);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1151 public abstract bool remove(Object o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1152 public abstract bool remove(String o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1153 public abstract bool removeAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1154 public abstract bool retainAll(Collection c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1155 public abstract Object set(int index, Object element);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1156 public abstract List subList(int fromIndex, int toIndex);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1157 public abstract Object[] toArray();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1158 public abstract Object[] toArray(Object[] a);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1159
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1160 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1161
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1162 class TreeSet : AbstractSet, SortedSet {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1163
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1164 alias tango.util.container.SortedMap.SortedMap!(Object,int) SetType;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1165 private SetType set;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1166
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1167 public this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1168 set = new SetType();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1169 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1170 public this(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1171 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1172 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1173 public this(Comparator c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1174 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1175 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1176 public this(SortedSet){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1177 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1178 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1179
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1180 public bool add(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1181 return set.add(o, 0);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1182 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1183 public bool add(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1184 return add(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1185 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1186 public bool addAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1187 foreach( o; c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1188 add(o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1189 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1190 return true;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1191 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1192 public void clear(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1193 set.clear();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1194 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1195 public bool contains(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1196 return set.containsKey(o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1197 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1198 public bool contains(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1199 return contains(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1200 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1201 public bool containsAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1202 foreach( o; c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1203 if( !contains(o) ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1204 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1205 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1206 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1207 return true;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1208 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1209 public Comparator comparator(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1210 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1211 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1212 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1213 public override int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1214 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1215 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1216 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1217 public Object first(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1218 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1219 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1220 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1221 public override hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1222 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1223 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1224 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1225 public SortedSet headSet(Object toElement){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1226 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1227 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1228 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1229 public bool isEmpty(){
177
21c77bcb7887 add impl
Frank Benoit <benoit@tionex.de>
parents: 174
diff changeset
1230 return set.isEmpty();
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1231 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1232 public Iterator iterator(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1233 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1234 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1235 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1236 public Object last(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1237 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1238 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1239 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1240 public bool remove(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1241 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1242 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1243 public bool remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1244 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1245 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1246 public bool removeAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1247 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1248 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1249 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1250 public bool retainAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1251 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1252 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1253 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1254 public int size(){
177
21c77bcb7887 add impl
Frank Benoit <benoit@tionex.de>
parents: 174
diff changeset
1255 return set.size();
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1256 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1257 public SortedSet subSet(Object fromElement, Object toElement){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1258 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1259 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1260 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1261 public SortedSet tailSet(Object fromElement){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1262 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1263 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1264 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1265 public Object[] toArray(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1266 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1267 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1268 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1269 public Object[] toArray(Object[] a){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1270 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1271 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1272 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1273 public override String toString(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1274 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1275 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1276 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1277
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1278
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1279 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1280 public int opApply (int delegate(ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1281 int localDg( ref Object key, ref int value ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1282 return dg( key );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1283 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1284 return set.opApply(&localDg);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1285 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1286 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1287
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1288 class Vector : AbstractList, List {
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1289 Object[] vect;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1290 int used;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1291 int capacityIncrement = 32;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1292 public this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1293 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1294 public this(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1295 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1296 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1297 public this(int initialCapacity){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1298 vect.length = initialCapacity;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1299 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1300 public this(int initialCapacity, int capacityIncrement){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1301 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1302 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1303 public void add(int index, Object element){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1304 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1305 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1306 public bool add(Object o){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1307 if( used + 1 >= vect.length ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1308 vect.length = vect.length + capacityIncrement;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1309 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1310 vect[used] = o;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1311 used++;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1312 return true;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1313 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1314 public bool add(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1315 return add(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1316 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1317 public bool addAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1318 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1319 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1320 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1321 public bool addAll(int index, Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1322 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1323 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1324 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1325 public void addElement(Object obj){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1326 add(obj);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1327 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1328 public int capacity(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1329 return vect.length;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1330 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1331 public void clear(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1332 used = 0;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1333 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1334 public Object clone(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1335 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1336 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1337 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1338 public bool contains(Object elem){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1339 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1340 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1341 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1342 public bool contains(String str){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1343 return contains(stringcast(str));
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1344 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1345 public bool containsAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1346 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1347 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1348 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1349 public void copyInto(Object[] anArray){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1350 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1351 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1352 public Object elementAt(int index){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1353 return get(index);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1354 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1355 public Enumeration elements(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1356 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1357 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1358 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1359 public void ensureCapacity(int minCapacity){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1360 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1361 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1362 public int opEquals(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1363 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1364 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1365 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1366 public Object firstElement(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1367 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1368 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1369 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1370 public Object get(int index){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1371 if( index >= used || index < 0 ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1372 throw new tango.core.Exception.ArrayBoundsException( __FILE__, __LINE__ );
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1373 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1374 return vect[index];
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1375 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1376 public hash_t toHash(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1377 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1378 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1379 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1380 public int indexOf(Object elem){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1381 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1382 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1383 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1384 public int indexOf(Object elem, int index){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1385 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1386 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1387 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1388 public void insertElementAt(Object obj, int index){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1389 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1390 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1391 public bool isEmpty(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1392 return used is 0;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1393 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1394 public Iterator iterator(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1395 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1396 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1397 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1398 public Object lastElement(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1399 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1400 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1401 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1402 public int lastIndexOf(Object elem){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1403 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1404 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1405 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1406 public int lastIndexOf(Object elem, int index){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1407 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1408 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1409 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1410 public ListIterator listIterator(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1411 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1412 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1413 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1414 public ListIterator listIterator(int index){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1415 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1416 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1417 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1418 public Object remove(int index){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1419 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1420 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1421 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1422 public bool remove(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1423 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1424 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1425 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1426 public bool remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1427 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1428 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1429 public bool removeAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1430 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1431 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1432 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1433 public void removeAllElements(){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1434 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1435 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1436 public bool removeElement(Object obj){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1437 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1438 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1439 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1440 public void removeElementAt(int index){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1441 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1442 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1443 protected void removeRange(int fromIndex, int toIndex){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1444 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1445 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1446 public bool retainAll(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1447 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1448 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1449 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1450 public Object set(int index, Object element){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1451 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1452 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1453 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1454 public void setElementAt(Object obj, int index){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1455 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1456 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1457 public void setSize(int newSize){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1458 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1459 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1460 public int size(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1461 return used;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1462 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1463 public List subList(int fromIndex, int toIndex){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1464 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1465 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1466 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1467 public Object[] toArray(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1468 return vect[ 0 .. used ].dup;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1469 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1470 public Object[] toArray(Object[] a){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1471 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1472 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1473 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1474 public String toString(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1475 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1476 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1477 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1478 public void trimToSize(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1479 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1480 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1481
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1482 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1483 public int opApply (int delegate(ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1484 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1485 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1486 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1487
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1488 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1489
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1490 class Stack : Vector {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1491 this(){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1492 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1493 void add(int index, Object element){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1494 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1495 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1496 bool add(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1497 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1498 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1499 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1500 public bool add(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1501 return add(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1502 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1503 bool addAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1504 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1505 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1506 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1507 bool addAll(int index, Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1508 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1509 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1510 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1511 void addElement(Object obj){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1512 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1513 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1514 int capacity(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1515 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1516 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1517 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1518 void clear(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1519 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1520 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1521 Object clone(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1522 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1523 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1524 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1525 bool contains(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1526 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1527 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1528 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1529 bool containsAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1530 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1531 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1532 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1533 void copyInto(Object[] anArray){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1534 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1535 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1536 Object elementAt(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1537 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1538 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1539 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1540 // Enumeration elements(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1541 // implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1542 // return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1543 // }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1544 void ensureCapacity(int minCapacity){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1545 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1546 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1547 int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1548 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1549 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1550 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1551 Object firstElement(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1552 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1553 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1554 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1555 Object get(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1556 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1557 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1558 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1559 hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1560 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1561 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1562 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1563 int indexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1564 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1565 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1566 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1567 int indexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1568 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1569 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1570 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1571 void insertElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1572 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1573 }
187
293a2f22f944 Add Collection impl
Frank Benoit <benoit@tionex.de>
parents: 184
diff changeset
1574 // bool isEmpty(){
293a2f22f944 Add Collection impl
Frank Benoit <benoit@tionex.de>
parents: 184
diff changeset
1575 // implMissing( __FILE__, __LINE__ );
293a2f22f944 Add Collection impl
Frank Benoit <benoit@tionex.de>
parents: 184
diff changeset
1576 // return false;
293a2f22f944 Add Collection impl
Frank Benoit <benoit@tionex.de>
parents: 184
diff changeset
1577 // }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1578 Iterator iterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1579 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1580 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1581 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1582 Object lastElement(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1583 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1584 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1585 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1586 int lastIndexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1587 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1588 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1589 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1590 int lastIndexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1591 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1592 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1593 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1594 ListIterator listIterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1595 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1596 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1597 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1598 ListIterator listIterator(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1599 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1600 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1601 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1602 Object remove(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1603 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1604 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1605 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1606 bool remove(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1607 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1608 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1609 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1610 public bool remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1611 return remove(stringcast(key));
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1612 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1613 bool removeAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1614 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1615 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1616 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1617 void removeAllElements(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1618 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1619 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1620 bool removeElement(Object obj){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1621 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1622 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1623 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1624 void removeElementAt(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1625 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1626 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1627 protected void removeRange(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1628 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1629 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1630 bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1631 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1632 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1633 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1634 Object set(int index, Object element){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1635 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1636 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1637 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1638 void setElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1639 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1640 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1641 void setSize(int newSize){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1642 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1643 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1644 int size(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1645 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1646 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1647 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1648 List subList(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1649 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1650 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1651 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1652 Object[] toArray(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1653 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1654 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1655 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1656 Object[] toArray(Object[] a){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1657 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1658 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1659 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1660
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1661 // from Stack
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1662 String toString(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1663 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1664 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1665 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1666 void trimToSize(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1667 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1668 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1669 bool empty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1670 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1671 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1672 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1673 Object peek(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1674 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1675 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1676 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1677 Object pop(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1678 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1679 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1680 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1681 Object push(Object item){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1682 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1683 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1684 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1685 int search(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1686 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1687 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1688 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1689
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1690 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1691 public int opApply (int delegate(ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1692 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1693 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1694 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1695
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1696 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1697
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1698 class LinkedList : List {
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1699 alias tango.util.container.CircularList.CircularList!(Object) ListType;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1700 private ListType list;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1701
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1702 this(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1703 list = new ListType();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1704 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1705 this( Collection c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1706 this();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1707 addAll(c);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1708 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1709 void add(int index, Object element){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1710 list.addAt(index,element);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1711 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1712 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1713 bool add(Object o){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1714 list.add(o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1715 return true;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1716 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1717 public bool add(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1718 return add(stringcast(o));
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1719 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1720 bool addAll(Collection c){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1721 if( c is null ) throw new NullPointerException();
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1722 bool res = false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1723 foreach( o; c ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1724 res |= add( o );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1725 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1726 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1727 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1728 bool addAll(int index, Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1729 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1730 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1731 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1732 void addFirst(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1733 list.prepend( o );
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1734 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1735 void addLast(Object o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1736 list.append( o );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1737 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1738 // void addElement(Object obj){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1739 // implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1740 // }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1741 int capacity(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1742 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1743 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1744 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1745 void clear(){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1746 list.clear();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1747 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1748 Object clone(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1749 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1750 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1751 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1752 bool contains(Object elem){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1753 return list.contains(elem);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1754 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1755 bool contains(String elem){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1756 return contains(stringcast(elem));
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1757 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1758 bool containsAll(Collection c){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1759 foreach(o; c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1760 if( !list.contains(o)) return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1761 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1762 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1763 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1764 void copyInto(Object[] anArray){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1765 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1766 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1767 Object elementAt(int index){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1768 return list.get(index);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1769 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1770 // Enumeration elements(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1771 // implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1772 // return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1773 // }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1774 void ensureCapacity(int minCapacity){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1775 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1776 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1777 int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1778 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1779 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1780 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1781 Object firstElement(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1782 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1783 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1784 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1785 Object get(int index){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1786 return list.get(index);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1787 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1788 Object getFirst(){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1789 return list.get(0);
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1790 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1791 Object getLast(){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1792 return list.get(list.size()-1);
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1793 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1794 hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1795 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1796 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1797 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1798 int indexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1799 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1800 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1801 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1802 int indexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1803 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1804 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1805 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1806 void insertElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1807 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1808 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1809 bool isEmpty(){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1810 return list.isEmpty();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1811 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1812 Iterator iterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1813 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1814 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1815 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1816 Object lastElement(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1817 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1818 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1819 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1820 int lastIndexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1821 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1822 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1823 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1824 int lastIndexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1825 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1826 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1827 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1828 ListIterator listIterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1829 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1830 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1831 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1832 ListIterator listIterator(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1833 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1834 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1835 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1836 Object remove(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1837 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1838 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1839 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1840 bool remove(Object o){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1841 return list.remove(o,false) !is 0;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1842 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1843 public bool remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1844 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1845 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1846 bool removeAll(Collection c){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1847 bool res = false;
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1848 foreach( o; c){
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1849 res |= list.remove(o,false) !is 0;
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1850 }
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1851 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1852 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1853 void removeAllElements(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1854 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1855 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1856 Object removeFirst(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1857 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1858 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1859 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1860 Object removeLast(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1861 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1862 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1863 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1864 bool removeElement(Object obj){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1865 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1866 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1867 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1868 void removeElementAt(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1869 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1870 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1871 protected void removeRange(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1872 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1873 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1874 bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1875 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1876 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1877 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1878 Object set(int index, Object element){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1879 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1880 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1881 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1882 void setElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1883 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1884 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1885 void setSize(int newSize){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1886 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1887 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1888 int size(){
114
efda8ce1120b Add LinkedList.size()
Frank Benoit <benoit@tionex.de>
parents: 106
diff changeset
1889 return list.size();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1890 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1891 List subList(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1892 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1893 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1894 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1895 Object[] toArray(){
121
c0304616ea23 Fix: tango assertion error, see tango ticket 1237
Frank Benoit <benoit@tionex.de>
parents: 119
diff changeset
1896 if( list.size() is 0 ) return null; // workaround tango ticket 1237
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1897 return list.toArray();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1898 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1899 Object[] toArray(Object[] a){
121
c0304616ea23 Fix: tango assertion error, see tango ticket 1237
Frank Benoit <benoit@tionex.de>
parents: 119
diff changeset
1900 if( list.size() is 0 ) return a[0 .. 0]; // workaround tango ticket 1237
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1901 return list.toArray( a );
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1902 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1903 String toString(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1904 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1905 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1906 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1907 void trimToSize(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1908 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1909 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1910
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1911 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1912 public int opApply (int delegate(ref Object value) dg){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1913 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1914 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1915 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1916
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1917 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1918
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1919 class ArrayList : AbstractList, List {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1920 private Object[] data;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1921
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1922 this(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1923 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1924 this(int size){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1925 data.length = size;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1926 data.length = 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1927 }
174
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1928 this(Collection col){
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1929 this(cast(int)(col.size*1.1));
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1930 addAll(col);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1931 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1932 void add(int index, Object element){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1933 data.length = data.length +1;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1934 System.arraycopy( data, index, data, index+1, data.length - index -1 );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1935 data[index] = element;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1936 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1937 bool add(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1938 data ~= o;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1939 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1940 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1941 public bool add(String o){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1942 return add(stringcast(o));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1943 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1944 bool addAll(Collection c){
174
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1945 if( c.size() is 0 ) return false;
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1946 uint idx = data.length;
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1947 data.length = data.length + c.size();
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1948 foreach( o; c ){
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1949 data[ idx++ ] = o;
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1950 }
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
1951 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1952 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1953 bool addAll(int index, Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1954 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1955 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1956 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1957 void clear(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1958 data.length = 0;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1959 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1960 ArrayList clone(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1961 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1962 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1963 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1964 bool contains(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1965 foreach( v; data ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1966 if( o is v ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1967 return true;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1968 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1969 if(( o is null ) || ( v is null )){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1970 continue;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1971 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1972 if( o == v ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1973 return true;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1974 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1975 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1976 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1977 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1978 bool contains(String o){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1979 return contains(stringcast(o));
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
1980 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1981 bool containsAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1982 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1983 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1984 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1985 int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1986 if( auto other = cast(ArrayList)o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1987 if( data.length !is other.data.length ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1988 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1989 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1990 for( int i = 0; i < data.length; i++ ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1991 if( data[i] is other.data[i] ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1992 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1993 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1994 if(( data[i] is null ) || ( other.data[i] is null )){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1995 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1996 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1997 if( data[i] == other.data[i] ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1998 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1999 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2000 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2001 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2002 return true;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2003 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2004 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2005 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2006 Object get(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2007 return data[index];
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2008 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2009 public override hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2010 return super.toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2011 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2012 int indexOf(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2013 foreach( i, v; data ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2014 if( data[i] is o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2015 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2016 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2017 if(( data[i] is null ) || ( o is null )){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2018 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2019 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2020 if( data[i] == o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2021 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2022 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2023 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2024 return -1;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2025 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2026 bool isEmpty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2027 return data.length is 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2028 }
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2029 class LocalIterator : Iterator{
184
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2030 int idx = -1;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2031 public this(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2032 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2033 public bool hasNext(){
184
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2034 return idx+1 < data.length;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2035 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2036 public Object next(){
184
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2037 idx++;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2038 Object res = data[idx];
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2039 return res;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2040 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2041 public void remove(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2042 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2043 this.outer.remove(idx);
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2044 idx--;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2045 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2046 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2047
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2048 Iterator iterator(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2049 return new LocalIterator();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2050 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2051 int lastIndexOf(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2052 foreach_reverse( i, v; data ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2053 if( data[i] is o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2054 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2055 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2056 if(( data[i] is null ) || ( o is null )){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2057 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2058 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2059 if( data[i] == o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2060 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2061 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2062 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2063 return -1;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2064 }
184
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2065
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2066 class LocalListIterator : ListIterator {
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2067 int idx_next = 0;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2068 public bool hasNext(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2069 return idx_next < data.length;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2070 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2071 public Object next(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2072 Object res = data[idx_next];
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2073 idx_next++;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2074 return res;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2075 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2076 public void remove(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2077 implMissing( __FILE__, __LINE__ );
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2078 this.outer.remove(idx_next);
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2079 idx_next--;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2080 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2081 public void add(Object o){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2082 implMissing( __FILE__, __LINE__ );
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2083 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2084 public bool add(String o){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2085 implMissing( __FILE__, __LINE__ );
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2086 return false;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2087 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2088 public bool hasPrevious(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2089 return idx_next > 0;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2090 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2091 public int nextIndex(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2092 return idx_next;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2093 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2094 public Object previous(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2095 idx_next--;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2096 Object res = data[idx_next];
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2097 return res;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2098 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2099 public int previousIndex(){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2100 return idx_next-1;
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2101 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2102 public void set(Object o){
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2103 implMissing( __FILE__, __LINE__ );
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2104 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2105 }
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2106
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2107 ListIterator listIterator(){
184
26589d623405 Added ListIterator for ArrayList
Frank Benoit <benoit@tionex.de>
parents: 180
diff changeset
2108 return new LocalListIterator();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2109 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2110 ListIterator listIterator(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2111 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2112 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2113 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2114 Object remove(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2115 Object res = data[index];
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2116 System.arraycopy( data, index+1, data, index, data.length - index - 1 );
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2117 data.length = data.length -1;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2118 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2119 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2120 bool remove(Object o){
119
35f1d208f3c3 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 116
diff changeset
2121 return tango.core.Array.remove(data, o) !is 0;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2122 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2123 public bool remove(String key){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2124 return remove(stringcast(key));
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2125 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2126 bool removeAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2127 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2128 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2129 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2130 bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2131 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2132 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2133 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2134 protected void removeRange(int fromIndex, int toIndex){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2135 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2136 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2137 Object set(int index, Object element){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2138 Object res = data[index];
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2139 data[index] = element;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2140 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2141 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2142 int size(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2143 return data.length;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2144 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2145 List subList(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2146 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2147 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2148 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2149 Object[] toArray(){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2150 return data.dup;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2151 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2152 Object[] toArray(Object[] a){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2153 if( data.length <= a.length ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2154 a[ 0 .. data.length ] = data;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2155 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2156 else{
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2157 return data.dup;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2158 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2159 if( data.length < a.length ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2160 a[data.length] = null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2161 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2162 return a;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2163 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2164
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2165 // only for D
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2166 public int opApply (int delegate(ref Object value) dg){
174
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
2167 foreach( o; data ){
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
2168 auto res = dg( o );
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
2169 if( res ) return res;
c6d7b1ea700b First sample running
Frank Benoit <benoit@tionex.de>
parents: 172
diff changeset
2170 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2171 return 0;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2172 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2173 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2174
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2175 class Arrays {
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2176 public static bool equals(T)(T[] a, T[] b){
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2177 if( a.length !is b.length ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2178 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2179 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2180 for( int i = 0; i < a.length; i++ ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2181 if( a[i] is null && b[i] is null ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2182 continue;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2183 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2184 if( a[i] !is null && b[i] !is null && a[i] == b[i] ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2185 continue;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2186 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2187 return false;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2188 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2189 return true;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2190 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2191 /+ public static bool equals(Object[] a, Object[] b){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2192 if( a.length !is b.length ){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2193 return false;
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2194 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2195 for( int i = 0; i < a.length; i++ ){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2196 if( a[i] is null && b[i] is null ){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2197 continue;
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2198 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2199 if( a[i] !is null && b[i] !is null && a[i] == b[i] ){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2200 continue;
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2201 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2202 return false;
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2203 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2204 return true;
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2205 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2206 +/
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2207 static void sort( T )( T[] a, Comparator c ){
172
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2208 static if( is( T : char[] )){
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2209 bool isLess( String o1, String o2 ){
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2210 return c.compare( stringcast(o1), stringcast(o2) ) < 0;
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2211 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2212 }
172
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2213 else{
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2214 bool isLess( T o1, T o2 ){
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2215 return c.compare( cast(Object)o1, cast(Object)o2 ) < 0;
d994a8b2cdf7 again compile fixes
Frank Benoit <benoit@tionex.de>
parents: 171
diff changeset
2216 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2217 }
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2218 tango.core.Array.sort( a, &isLess );
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2219 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2220 static List asList(Object[] a) {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2221 if( a.length is 0 ) return Collections.EMPTY_LIST;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2222 ArrayList res = new ArrayList( a.length );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2223 foreach( o; a ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2224 res.add(o);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2225 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2226 return res;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2227 }
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2228 public static void fill( String str, char c ){
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2229 str[] = c;
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2230 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2231 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2232
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2233 class Collections {
179
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2234 private static void unsupported(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2235 throw new UnsupportedOperationException();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2236 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2237
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2238 private static List EMPTY_LIST_;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2239 public static List EMPTY_LIST(){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2240 if( EMPTY_LIST_ is null ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2241 synchronized(Collections.classinfo ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2242 if( EMPTY_LIST_ is null ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2243 EMPTY_LIST_ = new ArrayList(0);
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2244 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2245 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2246 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2247 return EMPTY_LIST_;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2248 }
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2249 private static Map EMPTY_MAP_;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2250 public static Map EMPTY_MAP(){
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2251 if( EMPTY_MAP_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2252 synchronized(Collections.classinfo ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2253 if( EMPTY_MAP_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2254 EMPTY_MAP_ = new TreeMap();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2255 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2256 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2257 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2258 return EMPTY_MAP_;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2259 }
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2260 private static Set EMPTY_SET_;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2261 public static Set EMPTY_SET(){
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2262 if( EMPTY_SET_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2263 synchronized(Collections.classinfo ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2264 if( EMPTY_SET_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2265 EMPTY_SET_ = new TreeSet();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2266 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2267 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2268 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2269 return EMPTY_SET_;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2270 }
179
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2271 static class UnmodifiableIterator : Iterator {
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2272 Iterator it;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2273 this(Iterator it){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2274 this.it = it;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2275 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2276 public bool hasNext(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2277 return it.hasNext();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2278 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2279 public Object next(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2280 return it.next();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2281 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2282 public void remove(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2283 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2284 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2285 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2286 static class UnmodifiableListIterator : ListIterator {
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2287 ListIterator it;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2288 this(ListIterator it){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2289 this.it = it;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2290 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2291 public void add(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2292 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2293 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2294 public bool add(String o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2295 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2296 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2297 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2298 public bool hasNext(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2299 return it.hasNext();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2300 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2301 public bool hasPrevious(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2302 return it.hasPrevious();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2303 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2304 public Object next(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2305 return it.next();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2306 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2307 public int nextIndex(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2308 return it.nextIndex();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2309 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2310 public Object previous(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2311 return it.previous();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2312 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2313 public int previousIndex(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2314 return it.previousIndex();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2315 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2316 public void remove(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2317 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2318 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2319 public void set(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2320 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2321 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2322 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2323 static class UnmodifieableList : List {
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2324 List list;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2325 this(List list){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2326 this.list = list;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2327 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2328 public void add(int index, Object element){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2329 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2330 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2331 public bool add(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2332 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2333 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2334 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2335 public bool add(String o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2336 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2337 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2338 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2339 public bool addAll(Collection c){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2340 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2341 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2342 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2343 public bool addAll(int index, Collection c){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2344 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2345 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2346 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2347 public void clear(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2348 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2349 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2350 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2351 public bool contains(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2352 return list.contains(o);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2353 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2354 public bool contains(String o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2355 return list.contains(o);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2356 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2357 public bool containsAll(Collection c){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2358 return list.containsAll(c);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2359 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2360 public int opEquals(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2361 return list.opEquals(o);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2362 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2363 public Object get(int index){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2364 return list.get(index);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2365 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2366 public hash_t toHash(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2367 return list.toHash();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2368 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2369 public int indexOf(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2370 return list.indexOf(o);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2371 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2372 public bool isEmpty(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2373 return list.isEmpty();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2374 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2375 public Iterator iterator(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2376 return new UnmodifiableIterator( list.iterator() );
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2377 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2378 public int lastIndexOf(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2379 return list.lastIndexOf(o);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2380 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2381 public ListIterator listIterator(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2382 return new UnmodifiableListIterator( list.listIterator() );
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2383 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2384 public ListIterator listIterator(int index){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2385 return new UnmodifiableListIterator( list.listIterator(index) );
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2386 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2387 public Object remove(int index){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2388 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2389 return null; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2390 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2391 public bool remove(Object o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2392 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2393 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2394 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2395 public bool remove(String o){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2396 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2397 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2398 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2399 public bool removeAll(Collection c){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2400 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2401 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2402 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2403 public bool retainAll(Collection c){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2404 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2405 return false; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2406 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2407 public Object set(int index, Object element){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2408 unsupported();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2409 return null; // make compiler happy
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2410 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2411 public int size(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2412 return list.size();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2413 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2414 public List subList(int fromIndex, int toIndex){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2415 return new UnmodifieableList( list.subList(fromIndex,toIndex));
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2416 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2417 public Object[] toArray(){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2418 return list.toArray();
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2419 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2420 public Object[] toArray(Object[] a){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2421 return list.toArray(a);
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2422 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2423 public int opApply (int delegate(ref Object value) dg){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2424 implMissing(__FILE__, __LINE__ );
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2425 return 0;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2426 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2427 public int opApply (int delegate(ref Object key, ref Object value) dg){
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2428 implMissing(__FILE__, __LINE__ );
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2429 return 0;
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2430 }
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2431 }
161
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2432 static int binarySearch(List list, Object key){
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2433 implMissing( __FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2434 return 0;
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2435 }
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2436 static int binarySearch(List list, Object key, Comparator c){
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2437 implMissing( __FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2438 return 0;
Frank Benoit <benoit@tionex.de>
parents: 159
diff changeset
2439 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2440 public static List unmodifiableList( List list ){
179
9008cb2f47c5 Fix tango.core.Array.remove use
Frank Benoit <benoit@tionex.de>
parents: 177
diff changeset
2441 return new UnmodifieableList(list);
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2442 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2443 public static Map unmodifiableMap( Map list ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2444 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2445 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2446 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2447 public static Set unmodifiableSet( Set list ){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2448 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2449 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2450 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2451 public static Set singleton( Object o ){
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2452 TreeSet res = new TreeSet();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2453 res.add(o);
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2454 return res;
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2455 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2456 public static void sort(List list){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2457 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2458 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2459 public static void sort(List list, Comparator c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2460 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2461 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2462
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2463 static Collection synchronizedCollection(Collection c){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2464 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2465 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2466 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2467 static List synchronizedList(List list){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2468 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2469 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2470 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2471 static Map synchronizedMap(Map m){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2472 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2473 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2474 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2475 static Set synchronizedSet(Set s){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2476 implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2477 return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2478 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2479 // static SortedMap synchronizedSortedMap(SortedMap m){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2480 // implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2481 // return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2482 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2483 // static SortedSet synchronizedSortedSet(SortedSet s){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2484 // implMissing( __FILE__, __LINE__ );
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2485 // return null;
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2486 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2487 static void reverse(List list) {
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2488 Object[] data = list.toArray();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2489 for( int idx = 0; idx < data.length; idx++ ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2490 list.set( data.length -1 -idx, data[idx] );
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2491 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2492 }
180
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2493 static class LocalEnumeration : Enumeration {
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2494 Object[] data;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2495 this( Object[] data ){
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2496 this.data = data;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2497 }
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2498 public bool hasMoreElements(){
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2499 return data.length > 0;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2500 }
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2501 public Object nextElement(){
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2502 Object res = data[0];
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2503 data = data[ 1 .. $ ];
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2504 return res;
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2505 }
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2506 }
104
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2507 static Enumeration enumeration(Collection c){
180
41471f9968be Collection impl
Frank Benoit <benoit@tionex.de>
parents: 179
diff changeset
2508 return new LocalEnumeration( c.toArray() );
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2509 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2510 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2511
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2512 class LinkedHashMap : HashMap {
171
ee33f30b14e2 fix always triggered exit
Frank Benoit <benoit@tionex.de>
parents: 162
diff changeset
2513 this(){
162
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2514 implMissing( __FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 161
diff changeset
2515 }
177
21c77bcb7887 add impl
Frank Benoit <benoit@tionex.de>
parents: 174
diff changeset
2516 }