Add range methods to List. Throw not implemented for now.

Review URL: https://chromereviews.googleplex.com/3573012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@198 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ngeoffray@google.com 2011-10-07 07:56:42 +00:00
parent 6fe04a2202
commit cb3a9f6641
12 changed files with 220 additions and 0 deletions

View file

@ -37,6 +37,22 @@ class CanvasPixelArrayWrappingImplementation extends DOMWrapperBase implements C
throw new UnsupportedOperationException("This object is immutable.");
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(int element, int startIndex) {
return _Lists.indexOf(this, element, startIndex, this.length);
}

View file

@ -41,6 +41,22 @@ class MediaListWrappingImplementation extends DOMWrapperBase implements MediaLis
throw new UnsupportedOperationException("This object is immutable.");
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(String element, int startIndex) {
return _Lists.indexOf(this, element, startIndex, this.length);
}

View file

@ -37,6 +37,22 @@ class StyleSheetListWrappingImplementation extends DOMWrapperBase implements Sty
throw new UnsupportedOperationException("This object is immutable.");
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(StyleSheet element, int startIndex) {
return _Lists.indexOf(this, element, startIndex, this.length);
}

View file

@ -37,6 +37,22 @@ class TouchListWrappingImplementation extends DOMWrapperBase implements TouchLis
throw new UnsupportedOperationException("This object is immutable.");
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(Touch element, int startIndex) {
return _Lists.indexOf(this, element, startIndex, this.length);
}

View file

@ -107,6 +107,22 @@ class _ChildrenElementList implements ElementList {
throw 'Not impl yet. todo(jacobr)';
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(Element element, int startIndex) {
throw 'Not impl yet. todo(jacobr)';
}
@ -198,6 +214,22 @@ class FrozenElementList implements ElementList {
throw 'Not impl yet. todo(jacobr)';
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(Element element, int startIndex) {
throw 'Not impl yet. todo(jacobr)';
}

View file

@ -105,6 +105,22 @@ class _ChildrenNodeList implements NodeList {
throw 'Not impl yet. todo(jacobr)';
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(Node element, int startIndex) {
throw 'Not impl yet. todo(jacobr)';
}

View file

@ -241,6 +241,22 @@ class ObservableList<T>
Arrays.copy(src, srcStart, this, dstStart, count);
}
void setRange(int start, int length, List from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [initialValue = null]) {
throw const NotImplementedException();
}
List getRange(int start, int length) {
throw const NotImplementedException();
}
// Iterable<T>:
Iterator<T> iterator() => _internal.iterator();

View file

@ -14,6 +14,10 @@ class MyList<T> implements List<T> {
void copyFrom(List<Object> src, int srcStart, int dstStart, int count) {}
int indexOf(T element, int startIndex) { return null; }
int lastIndexOf(T element, int startIndex) { return null; }
void setRange(int start, int length, List from, [int startFrom = 0]) {}
void removeRange(int start, int length) {}
void insertRange(int start, int length, [initialValue = null]) {}
List getRange(int start, int length) { return null; }
void clear() {}
T removeLast() { return null; }
T last() { return null; }

View file

@ -149,6 +149,22 @@ class ObjectArray<T> implements Array<T> native "Array" {
Arrays.copy(src, srcStart, this, dstStart, count);
}
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [T initialValue = null]) {
throw const NotImplementedException();
}
List<T> getRange(int start, int length) {
throw const NotImplementedException();
}
int indexOf(T element, int startIndex) {
return Arrays.indexOf(this, element, startIndex, this.length);
}

View file

@ -127,4 +127,28 @@ interface List<E> extends Collection<E> factory ListFactory {
* exception if the list is empty.
*/
E last();
/**
* Copies [length] elements of the [from] array, starting
* from [startFrom], into [:this:], starting at [start].
*/
void setRange(int start, int length, List<E> from, [int startFrom]);
/**
* Removes the range in the list starting from [start] to
* [: start + length :].
*/
void removeRange(int start, int length);
/**
* Inserts a new range in the list, starting from [start] to
* [: start + length :]. The entries are filled with [initialValue].
*/
void insertRange(int start, int length, [E initialValue]);
/**
* Returns a sub list of this list, starting from [start] to
* [: start + length :].
*/
List<E> getRange(int start, int length);
}

View file

@ -92,6 +92,22 @@ class ObjectArray<T> implements Array<T> {
int count)
native "ObjectArray_copyFromObjectArray";
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [T initialValue = null]) {
throw const NotImplementedException();
}
List<T> getRange(int start, int length) {
throw const NotImplementedException();
}
/**
* Collection interface.
*/
@ -190,6 +206,22 @@ class ImmutableArray<T> implements Array<T> {
"Cannot modify an immutable array");
}
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [T initialValue = null]) {
throw const NotImplementedException();
}
List<T> getRange(int start, int length) {
throw const NotImplementedException();
}
/**
* Collection interface.
*/

View file

@ -9,6 +9,22 @@ class GrowableObjectArray<T> implements Array<T> {
Arrays.copy(src, srcStart, this, dstStart, count);
}
void setRange(int start, int length, List<T> from, [int startFrom = 0]) {
throw const NotImplementedException();
}
void removeRange(int start, int length) {
throw const NotImplementedException();
}
void insertRange(int start, int length, [T initialValue = null]) {
throw const NotImplementedException();
}
List<T> getRange(int start, int length) {
throw const NotImplementedException();
}
// The length of this growable array. It is always less than the
// length of the backing array.
int _length;