OLD | NEW |
| (Empty) |
1 | |
2 class _Uint8ArrayImpl extends _ArrayBufferViewImpl implements Uint8Array, List<i
nt> { | |
3 _Uint8ArrayImpl._wrap(ptr) : super._wrap(ptr); | |
4 | |
5 int get length() => _wrap(_ptr.length); | |
6 | |
7 int operator[](int index) => _wrap(_ptr[index]); | |
8 | |
9 | |
10 void operator[]=(int index, int value) { | |
11 throw new UnsupportedOperationException("Cannot assign element of immutable
List."); | |
12 } | |
13 | |
14 void add(int value) { | |
15 throw new UnsupportedOperationException("Cannot add to immutable List."); | |
16 } | |
17 | |
18 void addLast(int value) { | |
19 throw new UnsupportedOperationException("Cannot add to immutable List."); | |
20 } | |
21 | |
22 void addAll(Collection<int> collection) { | |
23 throw new UnsupportedOperationException("Cannot add to immutable List."); | |
24 } | |
25 | |
26 void sort(int compare(int a, int b)) { | |
27 throw new UnsupportedOperationException("Cannot sort immutable List."); | |
28 } | |
29 | |
30 void copyFrom(List<Object> src, int srcStart, int dstStart, int count) { | |
31 throw new UnsupportedOperationException("This object is immutable."); | |
32 } | |
33 | |
34 int indexOf(int element, [int start = 0]) { | |
35 return _Lists.indexOf(this, element, start, this.length); | |
36 } | |
37 | |
38 int lastIndexOf(int element, [int start = null]) { | |
39 if (start === null) start = length - 1; | |
40 return _Lists.lastIndexOf(this, element, start); | |
41 } | |
42 | |
43 int clear() { | |
44 throw new UnsupportedOperationException("Cannot clear immutable List."); | |
45 } | |
46 | |
47 int removeLast() { | |
48 throw new UnsupportedOperationException("Cannot removeLast on immutable List
."); | |
49 } | |
50 | |
51 int last() { | |
52 return this[length - 1]; | |
53 } | |
54 | |
55 void forEach(void f(int element)) { | |
56 _Collections.forEach(this, f); | |
57 } | |
58 | |
59 Collection map(f(int element)) { | |
60 return _Collections.map(this, [], f); | |
61 } | |
62 | |
63 Collection<int> filter(bool f(int element)) { | |
64 return _Collections.filter(this, new List<int>(), f); | |
65 } | |
66 | |
67 bool every(bool f(int element)) { | |
68 return _Collections.every(this, f); | |
69 } | |
70 | |
71 bool some(bool f(int element)) { | |
72 return _Collections.some(this, f); | |
73 } | |
74 | |
75 void setRange(int start, int length, List<int> from, [int startFrom]) { | |
76 throw new UnsupportedOperationException("Cannot setRange on immutable List."
); | |
77 } | |
78 | |
79 void removeRange(int start, int length) { | |
80 throw new UnsupportedOperationException("Cannot removeRange on immutable Lis
t."); | |
81 } | |
82 | |
83 void insertRange(int start, int length, [int initialValue]) { | |
84 throw new UnsupportedOperationException("Cannot insertRange on immutable Lis
t."); | |
85 } | |
86 | |
87 List<int> getRange(int start, int length) { | |
88 throw new NotImplementedException(); | |
89 } | |
90 | |
91 bool isEmpty() { | |
92 return length == 0; | |
93 } | |
94 | |
95 Iterator<int> iterator() { | |
96 return new _FixedSizeListIterator<int>(this); | |
97 } | |
98 | |
99 void setElements(Object array, [int offset = null]) { | |
100 if (offset === null) { | |
101 _ptr.setElements(_unwrap(array)); | |
102 return; | |
103 } else { | |
104 _ptr.setElements(_unwrap(array), _unwrap(offset)); | |
105 return; | |
106 } | |
107 } | |
108 | |
109 Uint8Array subarray(int start, [int end = null]) { | |
110 if (end === null) { | |
111 return _wrap(_ptr.subarray(_unwrap(start))); | |
112 } else { | |
113 return _wrap(_ptr.subarray(_unwrap(start), _unwrap(end))); | |
114 } | |
115 } | |
116 } | |
OLD | NEW |