annotate dwtx/dwtxhelper/Collection.d @ 195:a4d38d47ddc4

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