From 19ac92f624efab85b3f409d974a7c8ff91cd5f42 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 9 Oct 2008 23:20:29 +0000 Subject: [PATCH] We've got a utility method for filling an array with an initial value. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5430 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/Throttle.as | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/as/com/threerings/util/Throttle.as b/src/as/com/threerings/util/Throttle.as index 0ba58e8a9..918b54016 100644 --- a/src/as/com/threerings/util/Throttle.as +++ b/src/as/com/threerings/util/Throttle.as @@ -62,7 +62,7 @@ public class Throttle */ public function Throttle (operations :int, period :int) { - _ops = makeArray(operations); + _ops = ArrayUtil.create(operations, 0); _period = period; } @@ -76,7 +76,7 @@ public class Throttle */ public function reinit (operations :int, period :int) :void { - var ops :Array = makeArray(operations); + var ops :Array = ArrayUtil.create(operations, 0); // copy up to 'operations' of our most recent operations into our new array for (var ii :int = 0; ii < operations; ii++) { ops[operations-ii-1] = _ops[(_oldestOp + _ops.length - ii - 1) % _ops.length]; @@ -160,15 +160,6 @@ public class Throttle return _ops.length + " ops per " + _period + "ms (oldest " + oldest + ")"; } - protected function makeArray (operations :int) :Array - { - var ops :Array = new Array(operations); - for (var ii :int = 0; ii < operations; ii++) { - ops[ii] = 0; - } - return ops; - } - protected var _ops :Array; protected var _oldestOp :int; protected var _period :int;