annotate dwtx/dwtxhelper/Collection.d @ 159:7926b636c282

...
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 01:57:58 +0200
parents 8df1d4193877
children f8d52b926852
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);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
122 public bool containsAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 public int opEquals(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 public Object get(int index);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 public hash_t toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 public int indexOf(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 public bool isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128 public Iterator iterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 public int lastIndexOf(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 public ListIterator listIterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 public ListIterator listIterator(int index);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132 public Object remove(int index);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 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
134 public bool remove(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
135 public bool removeAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
136 public bool retainAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
137 public Object set(int index, Object element);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 public int size();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
139 public List subList(int fromIndex, int toIndex);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
140 public Object[] toArray();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
141 public Object[] toArray(Object[] a);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 }
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 interface Set : Collection {
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 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
146 public bool add(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
147 public bool addAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 public void clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
149 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
150 public bool contains(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
151 public bool containsAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 public int opEquals(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 public hash_t toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 public bool isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
155 public Iterator iterator();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
156 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
157 public bool remove(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158 public bool removeAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
159 public bool retainAll(Collection c);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
160 public int size();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
161 public Object[] toArray();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
162 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
163 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
164
04b47443bb01 Reworked the collection 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 // 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
166 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
167 }
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
168
04b47443bb01 Reworked the collection 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 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
170 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
171 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
172 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
173 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
174 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
175 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
176 }
04b47443bb01 Reworked the collection 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 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
179 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
180 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
181 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
182 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
183 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
184 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
185 }
04b47443bb01 Reworked the collection 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 interface ListIterator : Iterator {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
188 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
189 public bool add(String o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
190 public bool hasNext();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
191 public bool hasPrevious();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
192 public Object next();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
193 public int nextIndex();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
194 public Object previous();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
195 public int previousIndex();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
196 public void remove();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
197 public void set(Object o);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
198 }
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
199
04b47443bb01 Reworked the collection 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 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
203 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
204 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
205 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
206 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
207 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
208 }
04b47443bb01 Reworked the collection 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 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
210 if( auto other = cast(MapEntry)o){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
211
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
212 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
213 ( 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
214 return true;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
215 }
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
216 return false;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
217 }
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
218 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
219 }
04b47443bb01 Reworked the collection 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 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
221 return key;
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
222 }
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
223 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
224 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
225 }
04b47443bb01 Reworked the collection 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 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
227 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
228 ( 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
229 }
04b47443bb01 Reworked the collection 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 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
231 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
232 }
04b47443bb01 Reworked the collection 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
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
234 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
235
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 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
237 // 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
238 alias tango.util.container.HashMap.HashMap!(Object,Object) MapType;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239 private MapType map;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241 public this(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 map = new MapType();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 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
245 this();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
246 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
247 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
248 map = new MapType(loadFactor);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
249 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
250 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
251 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
252 putAll(m);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
253 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 public void clear(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255 map.clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 public bool containsKey(Object key){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 Object v;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 return map.get(key, v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 }
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
261 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
262 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
263 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
264 public bool containsValue(Object value){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 return map.contains(value);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
266 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
267 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
268 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
269 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
270 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
271 }
04b47443bb01 Reworked the collection 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 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
273 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
274 public override int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
275 if( auto other = cast(HashMap) o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
276 if( other.size() !is size() ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
278 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
279 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
280 Object vo = other.get(k);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
281 if( v != vo ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
282 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
283 }
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 return true;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
286 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
287 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
289 public Object get(Object key){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
290 if( auto v = key in map ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
291 return *v;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
292 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
293 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
294 }
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
295 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
296 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
297 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
298 public override hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
299 return super.toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301 public bool isEmpty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
302 return map.isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304 public Set keySet(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
305 HashSet res = new HashSet();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
306 foreach( k, v; map ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
307 res.add(k);
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
308 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
309 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
310 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 public Object put(Object key, Object value){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312 Object res = null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
313 if( auto vold = key in map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
314 res = *vold;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
315 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 map[ key ] = value;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
317 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
318 }
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
319 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
320 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
321 }
04b47443bb01 Reworked the collection 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 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
323 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
324 }
04b47443bb01 Reworked the collection 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 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
326 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
327 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
328 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
329 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
330 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
331 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
332 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
333 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
334 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
335 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
336 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
337 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
338 }
04b47443bb01 Reworked the collection 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 map.remove(key);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
340 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
341 }
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
342 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
343 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
344 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
345 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
346 return map.size();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
347 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
348 public Collection values(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
349 ArrayList res = new ArrayList( size() );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
350 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
351 res.add( v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
353 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 }
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 public int opApply (int delegate(ref Object value) dg){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359 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
360 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
361 }
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
159
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
365 class IdentityHashMap : Map {
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
366 alias tango.util.container.HashMap.HashMap!(Object,Object) MapType;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
367 private MapType map;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
368
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
369 public this(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
370 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
371 map = new MapType();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
372 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
373 public this(int initialCapacity){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
374 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
375 this();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
376 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
377 public this(int initialCapacity, float loadFactor){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
378 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
379 map = new MapType(loadFactor);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
380 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
381 public this(Map m){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
382 implMissing(__FILE__, __LINE__ );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
383 this();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
384 putAll(m);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
385 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
386 public void clear(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
387 map.clear();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
388 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
389 public bool containsKey(Object key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
390 Object v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
391 return map.get(key, v );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
392 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
393 public bool containsKey(String key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
394 return containsKey(stringcast(key));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
395 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
396 public bool containsValue(Object value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
397 return map.contains(value);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
398 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
399 public Set entrySet(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
400 HashSet res = new HashSet();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
401 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
402 res.add( new MapEntry(this,k));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
403 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
404 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
405 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
406 public override int opEquals(Object o){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
407 if( auto other = cast(HashMap) o ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
408 if( other.size() !is size() ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
409 return false;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
410 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
411 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
412 Object vo = other.get(k);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
413 if( v != vo ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
414 return false;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
415 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
416 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
417 return true;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
418 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
419 return false;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
420 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
421 public Object get(Object key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
422 if( auto v = key in map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
423 return *v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
424 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
425 return null;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
426 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
427 public Object get(String key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
428 return get(stringcast(key));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
429 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
430 public override hash_t toHash(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
431 return super.toHash();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
432 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
433 public bool isEmpty(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
434 return map.isEmpty();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
435 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
436 public Set keySet(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
437 HashSet res = new HashSet();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
438 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
439 res.add(k);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
440 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
441 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
442 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
443 public Object put(Object key, Object value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
444 Object res = null;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
445 if( auto vold = key in map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
446 res = *vold;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
447 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
448 map[ key ] = value;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
449 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
450 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
451 public Object put(String key, Object value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
452 return put( stringcast(key), value );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
453 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
454 public Object put(Object key, String value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
455 return put( key, stringcast(value) );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
456 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
457 public Object put(String key, String value){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
458 return put( stringcast(key), stringcast(value) );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
459 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
460 public void putAll(Map t){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
461 foreach( k, v; t ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
462 map[k] = v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
463 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
464 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
465 public Object remove(Object key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
466 if( auto v = key in map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
467 Object res = *v;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
468 map.remove(key);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
469 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
470 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
471 map.remove(key);
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
472 return null;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
473 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
474 public Object remove(String key){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
475 return remove(stringcast(key));
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
476 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
477 public int size(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
478 return map.size();
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
479 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
480 public Collection values(){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
481 ArrayList res = new ArrayList( size() );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
482 foreach( k, v; map ){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
483 res.add( v );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
484 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
485 return res;
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
486 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
487
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
488 public int opApply (int delegate(ref Object value) dg){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
489 return map.opApply( dg );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
490 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
491 public int opApply (int delegate(ref Object key, ref Object value) dg){
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
492 return map.opApply( dg );
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
493 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
494 }
Frank Benoit <benoit@tionex.de>
parents: 128
diff changeset
495
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
496 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
497 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
498 }
04b47443bb01 Reworked the collection 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 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
500 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
501 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
502 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
503 }
04b47443bb01 Reworked the collection 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 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
505 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
506 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
507 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
508 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
509 }
04b47443bb01 Reworked the collection 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 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
511 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
512 }
04b47443bb01 Reworked the collection 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 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
514 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
515 }
04b47443bb01 Reworked the collection 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 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
517 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
518 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
519 }
04b47443bb01 Reworked the collection 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 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
521 }
04b47443bb01 Reworked the collection 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
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
523
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
524 // no nulls
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
525 // 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
526 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
527
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
528 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
529 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
530 }
04b47443bb01 Reworked the collection 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 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
532 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
533 }
04b47443bb01 Reworked the collection 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 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
535 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
536 }
04b47443bb01 Reworked the collection 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 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
538 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
539 }
04b47443bb01 Reworked the collection 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 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
541 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
542 }
04b47443bb01 Reworked the collection 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
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
544 Object[Object] map;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
545
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
546 // 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
547 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
548 }
04b47443bb01 Reworked the collection 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 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
550 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
551 }
04b47443bb01 Reworked the collection 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 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
553 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
554 }
04b47443bb01 Reworked the collection 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 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
556 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
557 }
04b47443bb01 Reworked the collection 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
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
559 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
560 Object[] values;
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
561 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
562 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
563 this.values = values;
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
564 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
565 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
566 return index < values.length;
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
567 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
568 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
569 Object res = values[index];
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
570 index++;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
571 return res;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
572 }
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
573 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
574
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
575 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
576 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
577 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
578 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
579 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
580 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
581 public synchronized void clear(){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
582 map = null;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
583 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
584 public synchronized bool containsKey(Object key){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
585 if( auto v = key in map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
586 return true;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
587 }
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
588 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
589 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
590 public synchronized bool containsKey(String key){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
591 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
592 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
593 public synchronized bool containsValue(Object value){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
594 foreach( k, v; map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
595 if( v == value ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
596 return true;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
597 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
598 }
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
599 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
600 }
04b47443bb01 Reworked the collection 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 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
602 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
603 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
604 }
04b47443bb01 Reworked the collection 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 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
606 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
607 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
608 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
609 public synchronized Object get(Object key){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
610 if( auto v = key in map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
611 return *v;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
612 }
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
613 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
614 }
04b47443bb01 Reworked the collection 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 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
616 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
617 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
618 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
619 public synchronized bool isEmpty(){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
620 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
621 }
04b47443bb01 Reworked the collection 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 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
623 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
624 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
625 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
626 public synchronized Object put(Object key, Object value){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
627 Object res = null;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
628 if( auto v = key in map ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
629 res = *v;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
630 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
631 map[ key ] = value;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
632 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
633 }
04b47443bb01 Reworked the collection 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 // 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
635 // 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
636 // public Object put(String key, String value)
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
637 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
638 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
639 }
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
640 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
641 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
642 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
643 }
04b47443bb01 Reworked the collection 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 // public Object remove(String key)
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
645 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
646 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
647 }
04b47443bb01 Reworked the collection 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 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
649 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
650 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
651 }
04b47443bb01 Reworked the collection 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 // 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
654 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
655 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
656 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
657 }
04b47443bb01 Reworked the collection 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 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
659 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
660 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
661 }
04b47443bb01 Reworked the collection 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 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
666 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
667 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
668 }
04b47443bb01 Reworked the collection 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 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
670 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
671 }
04b47443bb01 Reworked the collection 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 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
673 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
674 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
675 }
04b47443bb01 Reworked the collection 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 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
677 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
678 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
679 }
04b47443bb01 Reworked the collection 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 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
681 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
682 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
683 }
04b47443bb01 Reworked the collection 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 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
685
04b47443bb01 Reworked the collection 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 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
687 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
688 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
689 }
04b47443bb01 Reworked the collection 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 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
691 }
04b47443bb01 Reworked the collection 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 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
694 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
695 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
696 }
04b47443bb01 Reworked the collection 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 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
698 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
699 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
700 }
04b47443bb01 Reworked the collection 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 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
702 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
703 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
704 }
04b47443bb01 Reworked the collection 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 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
706 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
707 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
708 }
04b47443bb01 Reworked the collection 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 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
710 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
711 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
712 }
04b47443bb01 Reworked the collection 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 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
714 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
715 }
04b47443bb01 Reworked the collection 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 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
717 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
718 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
719 }
04b47443bb01 Reworked the collection 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 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
721 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
722 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
723 }
04b47443bb01 Reworked the collection 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 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
725 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
726 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
727 }
04b47443bb01 Reworked the collection 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 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
729 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
730 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
731 }
04b47443bb01 Reworked the collection 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 class TreeMap : Map, SortedMap {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
735 alias tango.util.container.SortedMap.SortedMap!(Object,Object) MapType;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
736 private MapType map;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
737
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
738 public this(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
739 map = new MapType();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
740 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
741 public this(Comparator c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
742 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
743 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
744 public this(Map m){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
745 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
746 }
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
747 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
748 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
749 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
750 public void clear(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
751 map.clear();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
752 }
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
753 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
754 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
755 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
756 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
757 public bool containsKey(Object key){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
758 Object v;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
759 return map.get(key, v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
760 }
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
761 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
762 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
763 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
764 public bool containsValue(Object value){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
765 return map.contains(value);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
766 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
767 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
768 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
769 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
770 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
771 }
04b47443bb01 Reworked the collection 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 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
773 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
774 public override int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
775 if( auto other = cast(HashMap) o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
776 if( other.size() !is size() ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
777 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
778 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
779 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
780 Object vo = other.get(k);
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
781 if( v != vo ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
782 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
783 }
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 return true;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
786 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
787 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
788 }
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
789 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
790 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
791 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
792 }
04b47443bb01 Reworked the collection 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 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
794 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
795 public Object get(Object key){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
796 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
797 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
798 }
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
799 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
800 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
801 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
802 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
803 // 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
804 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
805 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
806 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
807 }
04b47443bb01 Reworked the collection 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 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
809 }
04b47443bb01 Reworked the collection 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 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
811 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
812 return null;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
813 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
814 public bool isEmpty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
815 return map.isEmpty();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
816 }
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
817 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
818 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
819 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
820 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
821 }
04b47443bb01 Reworked the collection 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 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
823 }
04b47443bb01 Reworked the collection 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 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
825 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
826 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
827 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
828 }
04b47443bb01 Reworked the collection 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 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
830 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
831 }
04b47443bb01 Reworked the collection 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 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
833 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
834 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
835 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
836 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
837 }
04b47443bb01 Reworked the collection 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 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
839 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
840 }
04b47443bb01 Reworked the collection 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 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
842 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
843 }
04b47443bb01 Reworked the collection 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 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
845 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
846 }
04b47443bb01 Reworked the collection 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 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
848 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
849 }
04b47443bb01 Reworked the collection 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 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
851 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
852 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
853 }
04b47443bb01 Reworked the collection 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 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
856 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
857 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
858 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
859 }
04b47443bb01 Reworked the collection 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 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
861 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
862 }
04b47443bb01 Reworked the collection 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 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
864 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
865 }
04b47443bb01 Reworked the collection 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 SortedMap subMap(Object fromKey, Object toKey){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
867 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
868 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
869 }
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
870 SortedMap tailMap(Object fromKey){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
871 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
872 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
873 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
874 public Collection values(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
875 ArrayList res = new ArrayList( size() );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
876 foreach( k, v; map ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
877 res.add( v );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
878 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
879 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
880 }
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 public int opApply (int delegate(ref Object value) dg){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
883 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
884 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
885 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
886 return map.opApply( dg );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
887 }
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 class HashSet : Set {
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
891 alias tango.util.container.HashSet.HashSet!(Object) SetType;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
892 private SetType set;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
893
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
894 public this(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
895 set = new SetType();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
896 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
897 public this(Collection c){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
898 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
899 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
900 public this(int initialCapacity){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
901 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
902 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
903 public this(int initialCapacity, float loadFactor){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
904 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
905 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
906 public bool add(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
907 return set.add(o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
908 }
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
909 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
910 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
911 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
912 public bool addAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
913 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
914 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
915 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
916 public void clear(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
917 set.clear();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
918 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
919 public bool contains(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
920 return set.contains(o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
921 }
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
922 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
923 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
924 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
925 public bool containsAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
926 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
927 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
928 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
929 public override int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
930 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
931 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
932 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
933 public override hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
934 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
935 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
936 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
937 public bool isEmpty(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
938 return set.isEmpty();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
939 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
940 class LocalIterator : Iterator {
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
941 SetType.Iterator iter;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
942 Object nextElem;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
943 this( SetType.Iterator iter){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
944 this.iter = iter;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
945 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
946 public bool hasNext(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
947 return iter.next(nextElem);
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
948 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
949 public Object next(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
950 return nextElem;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
951 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
952 public void remove(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
953 iter.remove();
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
954 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
955 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
956 public Iterator iterator(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
957 return new LocalIterator(set.iterator());
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
958 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
959 public bool remove(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
960 return set.remove(o);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
961 }
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
962 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
963 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
964 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
965 public bool removeAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
966 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
967 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
968 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
969 public bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
970 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
971 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
972 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
973 public int size(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
974 return set.size();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
975 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
976 public Object[] toArray(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
977 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
978 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
979 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
980 public Object[] toArray(Object[] a){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
981 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
982 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
983 }
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
984 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
985 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
986 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
987 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
988
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
989 // 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
990 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
991 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
992 }
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
995
04b47443bb01 Reworked the collection 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 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
997 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
998 }
04b47443bb01 Reworked the collection 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 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
1000 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
1001 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
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 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
1004 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
1005 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
1006 }
04b47443bb01 Reworked the collection 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 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
1008 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
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 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
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 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
1015 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
1016 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
1017 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
1018 }
04b47443bb01 Reworked the collection 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 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
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 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
1022 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
1023 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
1024 }
04b47443bb01 Reworked the collection 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 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
1026 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
1027 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
1028 }
04b47443bb01 Reworked the collection 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 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
1030 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
1031 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
1032 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
1033 }
04b47443bb01 Reworked the collection 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 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
1035 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
1036 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
1037 }
04b47443bb01 Reworked the collection 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 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
1039 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
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 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
1042 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
1043 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
1044 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
1045 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
1046 }
04b47443bb01 Reworked the collection 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 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
1048 }
04b47443bb01 Reworked the collection 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 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
1050 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
1051 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
1052 }
04b47443bb01 Reworked the collection 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 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
1054 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
1055 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
1056 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
1057 }
04b47443bb01 Reworked the collection 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 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
1059 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
1060 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
1061 }
04b47443bb01 Reworked the collection 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 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
1063 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
1064 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
1065 }
04b47443bb01 Reworked the collection 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 }
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 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
1069 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
1070 }
04b47443bb01 Reworked the collection 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 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
1072 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
1073 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
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 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
1076 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
1077 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
1078 }
04b47443bb01 Reworked the collection 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 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
1080 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
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 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
1083 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
1084 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
1085 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
1086 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
1087 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
1088 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
1089
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 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
1092 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
1093 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
1094 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
1095 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
1096 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
1097 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
1098 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
1099 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
1100 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
1101 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
1102 }
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 // 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
1105 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
1106 }
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 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
1109 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
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
04b47443bb01 Reworked the collection 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 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
1113 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
1114 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
1115 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
1116 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
1117 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
1118 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
1119 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
1120 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
1121
04b47443bb01 Reworked the collection 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 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
1123 // 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
1124 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
1125 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
1126 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
1127 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
1128 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
1129 }
04b47443bb01 Reworked the collection 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 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
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
04b47443bb01 Reworked the collection 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 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
1134 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
1135 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
1136 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
1137 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
1138 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
1139 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
1140 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
1141 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
1142 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
1143 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
1144 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
1145 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
1146 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
1147 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
1148 public abstract Object[] toArray(Object[] a);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1149
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1150 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1151
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
1152 class TreeSet : AbstractSet, SortedSet {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1153
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
1154 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
1155 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
1156
04b47443bb01 Reworked the collection 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 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
1158 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
1159 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1160 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
1161 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
1162 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1163 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
1164 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
1165 }
04b47443bb01 Reworked the collection 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 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
1167 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
1168 }
04b47443bb01 Reworked the collection 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 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
1171 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
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 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
1174 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
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 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
1177 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
1178 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
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 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
1181 }
04b47443bb01 Reworked the collection 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 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
1183 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
1184 }
04b47443bb01 Reworked the collection 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 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
1186 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
1187 }
04b47443bb01 Reworked the collection 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 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
1189 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
1190 }
04b47443bb01 Reworked the collection 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 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
1192 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
1193 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
1194 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
1195 }
04b47443bb01 Reworked the collection 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 }
04b47443bb01 Reworked the collection 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 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
1198 }
04b47443bb01 Reworked the collection 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 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
1200 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
1201 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
1202 }
04b47443bb01 Reworked the collection 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 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
1204 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
1205 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
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 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
1208 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
1209 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
1210 }
04b47443bb01 Reworked the collection 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 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
1212 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
1213 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
1214 }
04b47443bb01 Reworked the collection 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 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
1216 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
1217 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
1218 }
04b47443bb01 Reworked the collection 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 public 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
1220 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
1221 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
1222 }
04b47443bb01 Reworked the collection 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 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
1224 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
1225 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
1226 }
04b47443bb01 Reworked the collection 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 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
1228 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
1229 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
1230 }
04b47443bb01 Reworked the collection 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 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
1232 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
1233 }
04b47443bb01 Reworked the collection 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 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
1235 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
1236 }
04b47443bb01 Reworked the collection 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 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
1238 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
1239 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
1240 }
04b47443bb01 Reworked the collection 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 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
1242 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
1243 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
1244 }
04b47443bb01 Reworked the collection 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 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
1246 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
1247 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
1248 }
04b47443bb01 Reworked the collection 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 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
1250 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
1251 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
1252 }
04b47443bb01 Reworked the collection 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 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
1254 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
1255 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
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 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
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 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
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 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
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
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 // 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
1272 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
1273 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
1274 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
1275 }
04b47443bb01 Reworked the collection 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 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
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
04b47443bb01 Reworked the collection 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 class Vector : AbstractList, List {
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1281 Object[] vect;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1282 int used;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1283 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
1284 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
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 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
1287 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
1288 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1289 public this(int initialCapacity){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1290 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
1291 }
04b47443bb01 Reworked the collection 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(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
1293 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
1294 }
04b47443bb01 Reworked the collection 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 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
1296 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
1297 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1298 public bool add(Object o){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1299 if( used + 1 >= vect.length ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1300 vect.length = vect.length + capacityIncrement;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1301 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1302 vect[used] = o;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1303 used++;
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1304 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
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(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
1307 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
1308 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1309 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
1310 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
1311 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
1312 }
04b47443bb01 Reworked the collection 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 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
1314 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
1315 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
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 void addElement(Object obj){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1318 add(obj);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1319 }
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
1320 public int capacity(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1321 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
1322 }
04b47443bb01 Reworked the collection 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 public void clear(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1324 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
1325 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1326 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
1327 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
1328 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
1329 }
04b47443bb01 Reworked the collection 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 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
1331 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
1332 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
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 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
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 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
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 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
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 }
04b47443bb01 Reworked the collection 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 public Object elementAt(int index){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1342 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
1343 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1344 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
1345 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
1346 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
1347 }
04b47443bb01 Reworked the collection 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 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
1349 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
1350 }
04b47443bb01 Reworked the collection 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 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
1352 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
1353 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
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 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
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 Object get(int index){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1360 if( index >= used || index < 0 ){
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1361 throw new tango.core.Exception.ArrayBoundsException( __FILE__, __LINE__ );
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1362 }
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1363 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
1364 }
04b47443bb01 Reworked the collection 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 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
1366 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
1367 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
1368 }
04b47443bb01 Reworked the collection 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 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
1370 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
1371 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
1372 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1373 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
1374 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
1375 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
1376 }
04b47443bb01 Reworked the collection 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 public void insertElementAt(Object obj, int index){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1378 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1379 }
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
1380 public bool isEmpty(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1381 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
1382 }
04b47443bb01 Reworked the collection 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 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
1384 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
1385 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
1386 }
04b47443bb01 Reworked the collection 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 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
1388 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
1389 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
1390 }
04b47443bb01 Reworked the collection 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 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
1392 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
1393 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
1394 }
04b47443bb01 Reworked the collection 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 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
1396 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
1397 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
1398 }
04b47443bb01 Reworked the collection 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 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
1400 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
1401 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
1402 }
04b47443bb01 Reworked the collection 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 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
1404 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
1405 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
1406 }
04b47443bb01 Reworked the collection 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 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
1408 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
1409 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
1410 }
04b47443bb01 Reworked the collection 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 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
1412 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
1413 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
1414 }
04b47443bb01 Reworked the collection 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 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
1416 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
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 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
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 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
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 void removeAllElements(){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1423 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1424 }
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
1425 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
1426 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
1427 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
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 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
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 }
04b47443bb01 Reworked the collection 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 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
1433 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
1434 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1435 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
1436 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
1437 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
1438 }
04b47443bb01 Reworked the collection 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 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
1440 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
1441 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
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 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
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 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
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 }
04b47443bb01 Reworked the collection 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 public int size(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1450 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
1451 }
04b47443bb01 Reworked the collection 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 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
1453 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
1454 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
1455 }
04b47443bb01 Reworked the collection 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 public Object[] toArray(){
127
1997315125c0 more collection impls
Frank Benoit <benoit@tionex.de>
parents: 121
diff changeset
1457 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
1458 }
04b47443bb01 Reworked the collection 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 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
1460 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
1461 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
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 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
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 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
1468 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
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
04b47443bb01 Reworked the collection 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 // 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
1472 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
1473 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
1474 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
1475 }
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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
04b47443bb01 Reworked the collection 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 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
1480 this(){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1481 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1482 void add(int index, Object element){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1483 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1484 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1485 bool add(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1486 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1487 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1488 }
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
1489 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
1490 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
1491 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1492 bool addAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1493 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1494 return false;
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 addAll(int index, Collection c){
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 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1500 void addElement(Object obj){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1501 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1502 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1503 int capacity(){
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 0;
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 void clear(){
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 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1510 Object clone(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1511 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1512 return null;
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 bool contains(Object elem){
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 false;
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 bool containsAll(Collection c){
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 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1521 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1522 void copyInto(Object[] anArray){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1523 implMissing( __FILE__, __LINE__ );
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 Object elementAt(int index){
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 null;
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 // Enumeration elements(){
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 null;
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 ensureCapacity(int minCapacity){
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 int opEquals(Object o){
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 false;
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 Object firstElement(){
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 Object get(int index){
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 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1547 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1548 hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1549 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1550 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1551 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1552 int indexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1553 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1554 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1555 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1556 int indexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1557 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1558 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1559 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1560 void insertElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1561 implMissing( __FILE__, __LINE__ );
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 bool isEmpty(){
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 false;
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 Iterator iterator(){
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 null;
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 Object lastElement(){
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 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1574 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1575 int lastIndexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1576 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1577 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1578 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1579 int lastIndexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1580 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1581 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1582 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1583 ListIterator listIterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1584 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1585 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1586 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1587 ListIterator listIterator(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1588 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1589 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1590 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1591 Object remove(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1592 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1593 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1594 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1595 bool remove(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1596 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1597 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1598 }
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
1599 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
1600 return remove(stringcast(key));
100
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 bool removeAll(Collection c){
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 false;
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 void removeAllElements(){
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 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1609 bool removeElement(Object obj){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1610 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1611 return false;
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 void removeElementAt(int index){
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 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1616 protected void removeRange(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1617 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1618 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1619 bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1620 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1621 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1622 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1623 Object set(int index, Object element){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1624 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1625 return null;
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 void setElementAt(Object obj, int index){
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 void setSize(int newSize){
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 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1633 int size(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1634 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1635 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1636 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1637 List subList(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1638 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1639 return null;
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 Object[] toArray(){
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 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1644 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1645 Object[] toArray(Object[] a){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1646 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1647 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1648 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1649
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1650 // from Stack
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1651 String toString(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1652 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1653 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1654 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1655 void trimToSize(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1656 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1657 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1658 bool empty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1659 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1660 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1661 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1662 Object peek(){
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 Object pop(){
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 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1669 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1670 Object push(Object item){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1671 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1672 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1673 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1674 int search(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1675 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1676 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1677 }
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
1678
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1679 // 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
1680 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
1681 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
1682 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
1683 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1684
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1685 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1686
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1687 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
1688 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
1689 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
1690
04b47443bb01 Reworked the collection 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 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
1692 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
1693 }
04b47443bb01 Reworked the collection 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 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
1695 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
1696 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
1697 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1698 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
1699 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
1700 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1701 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1702 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
1703 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
1704 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
1705 }
04b47443bb01 Reworked the collection 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 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
1707 return add(stringcast(o));
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1708 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1709 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
1710 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
1711 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
1712 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
1713 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
1714 }
04b47443bb01 Reworked the collection 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 res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1716 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1717 bool addAll(int index, Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1718 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1719 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1720 }
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 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
1722 list.prepend( o );
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1723 }
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
1724 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
1725 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
1726 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1727 // 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
1728 // 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
1729 // }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1730 int capacity(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1731 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1732 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1733 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1734 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
1735 list.clear();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1736 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1737 Object clone(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1738 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1739 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1740 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1741 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
1742 return list.contains(elem);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1743 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1744 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
1745 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
1746 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
1747 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1748 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1749 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1750 void copyInto(Object[] anArray){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1751 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1752 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1753 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
1754 return list.get(index);
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1755 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1756 // Enumeration elements(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1757 // implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1758 // return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1759 // }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1760 void ensureCapacity(int minCapacity){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1761 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1762 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1763 int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1764 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1765 return false;
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 firstElement(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1768 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1769 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1770 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1771 Object get(int index){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1772 return list.get(index);
100
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 hash_t toHash(){
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 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1777 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1778 int indexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1779 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1780 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1781 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1782 int indexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1783 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1784 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1785 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1786 void insertElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1787 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1788 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1789 bool isEmpty(){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1790 return list.isEmpty();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1791 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1792 Iterator iterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1793 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1794 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1795 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1796 Object lastElement(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1797 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1798 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1799 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1800 int lastIndexOf(Object elem){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1801 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1802 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1803 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1804 int lastIndexOf(Object elem, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1805 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1806 return 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1807 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1808 ListIterator listIterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1809 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1810 return null;
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 ListIterator listIterator(int index){
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 remove(int index){
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 bool remove(Object o){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1821 return list.remove(o,false) !is 0;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1822 }
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
1823 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
1824 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
1825 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1826 bool removeAll(Collection c){
116
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1827 bool res = false;
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1828 foreach( o; c){
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1829 res |= list.remove(o,false) !is 0;
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1830 }
1c497c6c0ad8 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 114
diff changeset
1831 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1832 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1833 void removeAllElements(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1834 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1835 }
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
1836 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
1837 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
1838 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
1839 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1840 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
1841 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
1842 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
1843 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1844 bool removeElement(Object obj){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1845 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1846 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1847 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1848 void removeElementAt(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1849 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1850 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1851 protected void removeRange(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1852 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1853 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1854 bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1855 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1856 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1857 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1858 Object set(int index, Object element){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1859 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1860 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1861 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1862 void setElementAt(Object obj, int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1863 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1864 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1865 void setSize(int newSize){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1866 implMissing( __FILE__, __LINE__ );
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 int size(){
114
efda8ce1120b Add LinkedList.size()
Frank Benoit <benoit@tionex.de>
parents: 106
diff changeset
1869 return list.size();
100
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 List subList(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 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1874 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1875 Object[] toArray(){
121
c0304616ea23 Fix: tango assertion error, see tango ticket 1237
Frank Benoit <benoit@tionex.de>
parents: 119
diff changeset
1876 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
1877 return list.toArray();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1878 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1879 Object[] toArray(Object[] a){
121
c0304616ea23 Fix: tango assertion error, see tango ticket 1237
Frank Benoit <benoit@tionex.de>
parents: 119
diff changeset
1880 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
1881 return list.toArray( a );
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1882 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1883 String toString(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1884 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1885 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1886 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1887 void trimToSize(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1888 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1889 }
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
1890
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1891 // 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
1892 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
1893 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
1894 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
1895 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
1896
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1897 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1898
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
1899 class ArrayList : AbstractList, List {
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1900 private Object[] data;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1901
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1902 this(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1903 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1904 this(int size){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1905 data.length = size;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1906 data.length = 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1907 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1908 this(Collection){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1909 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1910 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1911 void add(int index, Object element){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1912 data.length = data.length +1;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1913 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
1914 data[index] = element;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1915 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1916 bool add(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1917 data ~= o;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1918 return true;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1919 }
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
1920 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
1921 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
1922 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1923 bool addAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1924 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1925 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1926 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1927 bool addAll(int index, Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1928 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1929 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1930 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1931 void clear(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1932 data.length = 0;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1933 }
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
1934 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
1935 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
1936 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
1937 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1938 bool contains(Object o){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1939 foreach( v; data ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1940 if( o is v ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1941 return true;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1942 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1943 if(( o is null ) || ( v is null )){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1944 continue;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1945 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1946 if( o == v ){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1947 return true;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1948 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
1949 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1950 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1951 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1952 bool containsAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1953 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1954 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1955 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1956 int opEquals(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1957 if( auto other = cast(ArrayList)o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1958 if( data.length !is other.data.length ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1959 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1960 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1961 for( int i = 0; i < data.length; i++ ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1962 if( data[i] is other.data[i] ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1963 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1964 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1965 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
1966 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1967 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1968 if( data[i] == other.data[i] ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1969 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1970 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1971 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1972 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1973 return true;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1974 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1975 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1976 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1977 Object get(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1978 return data[index];
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1979 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1980 public override hash_t toHash(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1981 return super.toHash();
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1982 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1983 int indexOf(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1984 foreach( i, v; data ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1985 if( data[i] is o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1986 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1987 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1988 if(( data[i] is null ) || ( o is null )){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1989 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1990 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1991 if( data[i] == o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1992 return i;
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 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1995 return -1;
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 bool isEmpty(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1998 return data.length is 0;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1999 }
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2000 class LocalIterator : Iterator{
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2001 int idx = 0;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2002 public this(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2003 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2004 public bool hasNext(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2005 return idx < data.length;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2006 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2007 public Object next(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2008 Object res = data[idx];
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2009 idx++;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2010 return res;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2011 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2012 public void remove(){
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2013 implMissing( __FILE__, __LINE__ );
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2014 this.outer.remove(idx);
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2015 idx--;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2016 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2017 }
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2018
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2019 Iterator iterator(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2020 return new LocalIterator();
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2021 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2022 int lastIndexOf(Object o){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2023 foreach_reverse( i, v; data ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2024 if( data[i] is o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2025 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2026 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2027 if(( data[i] is null ) || ( o is null )){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2028 continue;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2029 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2030 if( data[i] == o ){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2031 return i;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2032 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2033 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2034 return -1;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2035 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2036 ListIterator listIterator(){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2037 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2038 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2039 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2040 ListIterator listIterator(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2041 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2042 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2043 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2044 Object remove(int index){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2045 Object res = data[index];
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2046 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
2047 data.length = data.length -1;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2048 return res;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2049 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2050 bool remove(Object o){
119
35f1d208f3c3 Collection impl
Frank Benoit <benoit@tionex.de>
parents: 116
diff changeset
2051 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
2052 }
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
2053 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
2054 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
2055 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2056 bool removeAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2057 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2058 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2059 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2060 bool retainAll(Collection c){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2061 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2062 return false;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2063 }
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
2064 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
2065 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
2066 }
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2067 Object set(int index, Object element){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2068 Object res = data[index];
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2069 data[index] = element;
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2070 return res;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2071 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2072 int size(){
101
1082a0fc2bb8 First Draw2D example running
Frank Benoit <benoit@tionex.de>
parents: 100
diff changeset
2073 return data.length;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2074 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2075 List subList(int fromIndex, int toIndex){
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2076 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2077 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2078 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2079 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
2080 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
2081 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2082 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
2083 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
2084 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
2085 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2086 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
2087 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
2088 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2089 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
2090 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
2091 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2092 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
2093 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2094
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2095 // 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
2096 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
2097 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
2098 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
2099 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2100 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2101
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2102 class Arrays {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2103 public static bool equals(Object[] a, Object[] b){
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2104 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
2105 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
2106 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2107 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
2108 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
2109 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
2110 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2111 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
2112 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
2113 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2114 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
2115 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2116 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
2117 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2118 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
2119 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
2120 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
2121 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
2122 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
2123 }
04b47443bb01 Reworked the collection 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 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
2125 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2126 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2127
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2128 class Collections {
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2129
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2130 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
2131 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
2132 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
2133 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
2134 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
2135 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
2136 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2137 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2138 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2139 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
2140 }
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2141 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
2142 public static Map EMPTY_MAP(){
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2143 if( EMPTY_MAP_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2144 synchronized(Collections.classinfo ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2145 if( EMPTY_MAP_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2146 EMPTY_MAP_ = new TreeMap();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2147 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2148 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2149 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2150 return EMPTY_MAP_;
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2151 }
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2152 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
2153 public static Set EMPTY_SET(){
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2154 if( EMPTY_SET_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2155 synchronized(Collections.classinfo ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2156 if( EMPTY_SET_ is null ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2157 EMPTY_SET_ = new TreeSet();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2158 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2159 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2160 }
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2161 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
2162 }
04b47443bb01 Reworked the collection 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 public static List unmodifiableList( 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
2165 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
2166 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
2167 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2168 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
2169 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
2170 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
2171 }
04b47443bb01 Reworked the collection 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 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
2173 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
2174 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
2175 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2176 public static Set singleton( Object o ){
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2177 TreeSet res = new TreeSet();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2178 res.add(o);
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2179 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
2180 }
04b47443bb01 Reworked the collection 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 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
2182 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
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 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
2185 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
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
04b47443bb01 Reworked the collection 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 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
2189 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
2190 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
2191 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2192 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
2193 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
2194 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
2195 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2196 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
2197 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
2198 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
2199 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2200 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
2201 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
2202 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
2203 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2204 // 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
2205 // 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
2206 // 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
2207 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2208 // 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
2209 // 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
2210 // 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
2211 // }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2212 static void reverse(List list) {
106
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2213 Object[] data = list.toArray();
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2214 for( int idx = 0; idx < data.length; idx++ ){
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2215 list.set( data.length -1 -idx, data[idx] );
8ab6fb387666 more Collection impl
Frank Benoit <benoit@tionex.de>
parents: 104
diff changeset
2216 }
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
2217 }
04b47443bb01 Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents: 101
diff changeset
2218 static Enumeration enumeration(Collection c){
100
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2219 implMissing( __FILE__, __LINE__ );
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2220 return null;
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2221 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2222 }
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2223
86617aa6b5dd More helper classes, needed by draw2d
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2224