- Some deflexing of the low-level narya stuff. More to come, as we're
going to want the minimum client to be flex-free. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4507 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.threerings.util {
|
||||
|
||||
import flash.errors.IllegalOperationError;
|
||||
|
||||
/**
|
||||
* Provides a generic iterator for an Array.
|
||||
* No co-modification checking is done.
|
||||
@@ -25,13 +27,29 @@ public class ArrayIterator
|
||||
// documentation inherited from interface Iterator
|
||||
public function next () :Object
|
||||
{
|
||||
_lastIndex = _index;
|
||||
return _arr[_index++];
|
||||
}
|
||||
|
||||
// documentation inherited from interface Iterator
|
||||
public function remove () :void
|
||||
{
|
||||
if (_lastIndex == -1) {
|
||||
throw new IllegalOperationError();
|
||||
|
||||
} else {
|
||||
_arr.splice(_lastIndex, 1);
|
||||
_lastIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/** The array we're iterating over. */
|
||||
protected var _arr :Array;
|
||||
|
||||
/** The current index. */
|
||||
protected var _index :int;
|
||||
|
||||
/** The last-removed index. */
|
||||
protected var _lastIndex :int = -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user