ArrayUtil --> Arrays.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@1172 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Bruno Garcia
2011-06-17 22:18:01 +00:00
parent 1aa6dc7ad4
commit 1c1032874a
16 changed files with 60 additions and 60 deletions
@@ -22,7 +22,7 @@
package com.threerings.cast {
import com.threerings.media.image.Colorization;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Equalable;
import com.threerings.util.Hashable;
import com.threerings.util.StringUtil;
@@ -113,7 +113,7 @@ public class CharacterDescriptor
// both the component ids and the colorizations must be equal
var odesc :CharacterDescriptor = CharacterDescriptor(other);
if (!ArrayUtil.equals(_components, odesc._components)) {
if (!Arrays.equals(_components, odesc._components)) {
return false;
}
@@ -134,12 +134,12 @@ public class CharacterDescriptor
return false;
}
for (var ii :int= 0; ii < zlength; ii++) {
if (!ArrayUtil.equals(_zations[ii], zations[ii])) {
if (!Arrays.equals(_zations[ii], zations[ii])) {
return false;
}
}
return ArrayUtil.equals(_xlations, odesc._xlations);
return Arrays.equals(_xlations, odesc._xlations);
}
public function toString () :String
@@ -21,7 +21,7 @@
package com.threerings.cast {
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Hashable;
import com.threerings.util.Equalable;
import com.threerings.util.StringUtil;
@@ -132,7 +132,7 @@ public class ComponentClass
if (_overrides == null) {
_overrides = [];
}
ArrayUtil.sortedInsert(_overrides, override);
Arrays.sortedInsert(_overrides, override);
}
/**
@@ -28,7 +28,7 @@ import flash.display.DisplayObject;
import flash.geom.Point;
import flash.geom.Rectangle;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Hashable;
import com.threerings.util.Integer;
import com.threerings.util.Map;
@@ -133,12 +133,12 @@ public class CompositedActionFrames
*/
protected function createFrames (orient :int, callback :Function) :void
{
ArrayUtil.stableSort(_sources, function(cf1 :ComponentFrames, cf2 :ComponentFrames) :int {
Arrays.stableSort(_sources, function(cf1 :ComponentFrames, cf2 :ComponentFrames) :int {
return (cf1.ccomp.getRenderPriority(_action.name, orient) -
cf2.ccomp.getRenderPriority(_action.name, orient));
});
var idx :int = ArrayUtil.indexOf(_action.orients, orient);
var idx :int = Arrays.indexOf(_action.orients, orient);
var frameCt :int = _action.tileset.getTileCounts()[idx];
var width :int = _action.tileset.getWidths()[idx];
@@ -25,7 +25,7 @@ import flash.events.Event;
import com.threerings.cast.ComponentDataPack;
import com.threerings.media.tile.TileDataPack;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.DataPack;
import com.threerings.util.Log;
import com.threerings.util.Map;
@@ -118,7 +118,7 @@ public class DataPackComponentRepository
comps = [];
_classComps.put(cclass, comps);
}
if (!ArrayUtil.contains(comps, component)) {
if (!Arrays.contains(comps, component)) {
comps.push(component);
} else {
log.info("Requested to register the same component twice?", "comp", component);
@@ -38,7 +38,7 @@ import mx.controls.TextInput;
import mx.events.FlexEvent;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.DelayUtil;
import com.threerings.util.StringUtil;
@@ -200,7 +200,7 @@ public class ChatControl extends HBox
} else {
_curLine = _txt.text;
ArrayUtil.removeAll(_controls, this);
Arrays.removeAll(_controls, this);
}
}
+2 -2
View File
@@ -24,7 +24,7 @@ package com.threerings.media {
import flash.events.TimerEvent;
import flash.utils.Timer;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
/**
* Registers objects that wish to be sent a tick() call once per frame.
@@ -64,7 +64,7 @@ public class Ticker
public function removeTickable (tickable :Tickable) :void
{
ArrayUtil.removeFirst(_tickables, tickable);
Arrays.removeFirst(_tickables, tickable);
}
/** Everyone who wants to hear about our ticks. */
@@ -21,7 +21,7 @@
package com.threerings.media.tile {
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.StringUtil;
public class BaseTileSet extends SwissArmyTileSet
@@ -78,7 +78,7 @@ public class BaseTileSet extends SwissArmyTileSet
{
super.populateClone(clone);
var bClone :BaseTileSet = BaseTileSet(clone);
bClone._passable = _passable == null ? null : ArrayUtil.copyOf(_passable);
bClone._passable = _passable == null ? null : Arrays.copyOf(_passable);
}
override public function createClone () :TileSet
@@ -24,7 +24,7 @@ package com.threerings.media.tile {
import flash.geom.Point;
import com.threerings.media.tile.Tile;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.DirectionUtil;
import com.threerings.util.Integer;
import com.threerings.util.StringUtil;
@@ -161,7 +161,7 @@ public class ObjectTile extends Tile
public function hasConstraint (constraint :String) :Boolean
{
return (_constraints == null) ? false :
ArrayUtil.contains(_constraints, constraint);
Arrays.contains(_constraints, constraint);
}
/**
@@ -21,7 +21,7 @@
package com.threerings.media.tile {
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.StringUtil;
/**
@@ -182,7 +182,7 @@ public class ObjectTileSet extends SwissArmyTileSet
public function hasConstraint (tileIdx :int, constraint :String) :Boolean
{
return (_constraints == null) ? false :
ArrayUtil.contains(_constraints[tileIdx], constraint);
Arrays.contains(_constraints[tileIdx], constraint);
}
// documentation inherited from interface RecolorableTileSet
@@ -278,16 +278,16 @@ public class ObjectTileSet extends SwissArmyTileSet
{
super.populateClone(clone);
var oClone :ObjectTileSet = ObjectTileSet(clone);
oClone._owidths = _owidths == null ? null : ArrayUtil.copyOf(_owidths);
oClone._oheights = _oheights == null ? null : ArrayUtil.copyOf(_oheights);
oClone._xorigins = _xorigins == null ? null : ArrayUtil.copyOf(_xorigins);
oClone._yorigins = _yorigins == null ? null : ArrayUtil.copyOf(_yorigins);
oClone._priorities = _priorities == null ? null : ArrayUtil.copyOf(_priorities);
oClone._ozations = _ozations == null ? null : ArrayUtil.copyOf(_ozations);
oClone._xspots = _xspots == null ? null : ArrayUtil.copyOf(_xspots);
oClone._yspots = _yspots == null ? null : ArrayUtil.copyOf(_yspots);
oClone._sorients = _sorients == null ? null : ArrayUtil.copyOf(_sorients);
oClone._constraints = _constraints == null ? null : ArrayUtil.copyOf(_constraints);
oClone._owidths = _owidths == null ? null : Arrays.copyOf(_owidths);
oClone._oheights = _oheights == null ? null : Arrays.copyOf(_oheights);
oClone._xorigins = _xorigins == null ? null : Arrays.copyOf(_xorigins);
oClone._yorigins = _yorigins == null ? null : Arrays.copyOf(_yorigins);
oClone._priorities = _priorities == null ? null : Arrays.copyOf(_priorities);
oClone._ozations = _ozations == null ? null : Arrays.copyOf(_ozations);
oClone._xspots = _xspots == null ? null : Arrays.copyOf(_xspots);
oClone._yspots = _yspots == null ? null : Arrays.copyOf(_yspots);
oClone._sorients = _sorients == null ? null : Arrays.copyOf(_sorients);
oClone._constraints = _constraints == null ? null : Arrays.copyOf(_constraints);
}
override public function createClone () :TileSet
@@ -24,7 +24,7 @@ package com.threerings.media.tile {
import flash.geom.Point;
import flash.geom.Rectangle;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.StringUtil;
/**
@@ -229,10 +229,10 @@ public class SwissArmyTileSet extends TileSet
{
super.populateClone(clone);
var saClone :SwissArmyTileSet = SwissArmyTileSet(clone);
saClone._tileCounts = _tileCounts == null ? null : ArrayUtil.copyOf(_tileCounts);
saClone._tileCounts = _tileCounts == null ? null : Arrays.copyOf(_tileCounts);
saClone._numTiles = _numTiles;
saClone._widths = _widths == null ? null : ArrayUtil.copyOf(_widths);
saClone._heights = _heights == null ? null : ArrayUtil.copyOf(_heights);
saClone._widths = _widths == null ? null : Arrays.copyOf(_widths);
saClone._heights = _heights == null ? null : Arrays.copyOf(_heights);
saClone._offsetPos = _offsetPos;
saClone._gapSize = _gapSize;
}
@@ -22,7 +22,7 @@
package com.threerings.media.tile {
import com.threerings.media.image.Colorization;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Hashable;
/** Used when caching tiles. */
@@ -45,7 +45,7 @@ public class Tile_Key
var okey :Tile_Key = Tile_Key(other);
return (tileSet == okey.tileSet &&
tileIndex == okey.tileIndex &&
ArrayUtil.equals(zations, okey.zations));
Arrays.equals(zations, okey.zations));
} else {
return false;
}
@@ -29,7 +29,7 @@ import com.threerings.io.SimpleStreamableObject;
import com.threerings.io.TypedArray;
import com.threerings.media.tile.TileUtil;
import com.threerings.miso.util.ObjectSet;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.ClassUtil;
import com.threerings.util.Cloneable;
import com.threerings.util.Log;
@@ -75,7 +75,7 @@ public class SparseMisoSceneModel_Section extends SimpleStreamableObject
this.x = x;
this.y = y;
this.width = width;
baseTileIds = TypedArray.create(int, ArrayUtil.create(width*height));
baseTileIds = TypedArray.create(int, Arrays.create(width*height));
}
public function getBaseTileId (col :int, row :int) :int
@@ -99,7 +99,7 @@ public class SparseMisoSceneModel_Section extends SimpleStreamableObject
// sanity check: see if there is already an object of this
// type at these coordinates
var dupidx :int;
if ((dupidx = ArrayUtil.indexOf(objectInfo, info)) != -1) {
if ((dupidx = Arrays.indexOf(objectInfo, info)) != -1) {
log.warning("Refusing to add duplicate object [ninfo=" + info +
", oinfo=" + objectInfo[dupidx] + "].");
return false;
@@ -123,18 +123,18 @@ public class SparseMisoSceneModel_Section extends SimpleStreamableObject
public function removeObject (info :ObjectInfo) :Boolean
{
// look for it in the interesting info array
var oidx :int = ArrayUtil.indexOf(objectInfo, info);
var oidx :int = Arrays.indexOf(objectInfo, info);
if (oidx != -1) {
objectInfo = TypedArray(ArrayUtil.splice(objectInfo, oidx, 1));
objectInfo = TypedArray(Arrays.splice(objectInfo, oidx, 1));
return true;
}
// look for it in the uninteresting arrays
oidx = indexOfUn(info);
if (oidx != -1) {
objectTileIds = TypedArray(ArrayUtil.splice(objectTileIds, oidx, 1));
objectXs = TypedArray(ArrayUtil.splice(objectXs, oidx, 1));
objectYs = TypedArray(ArrayUtil.splice(objectYs, oidx, 1));
objectTileIds = TypedArray(Arrays.splice(objectTileIds, oidx, 1));
objectXs = TypedArray(Arrays.splice(objectXs, oidx, 1));
objectYs = TypedArray(Arrays.splice(objectYs, oidx, 1));
return true;
}
@@ -213,10 +213,10 @@ public class SparseMisoSceneModel_Section extends SimpleStreamableObject
section.x = x;
section.y = y;
section.width = width;
section.baseTileIds = TypedArray(ArrayUtil.copyOf(baseTileIds));
section.objectTileIds = TypedArray(ArrayUtil.copyOf(objectTileIds));
section.objectXs = TypedArray(ArrayUtil.copyOf(objectXs));
section.objectYs = TypedArray(ArrayUtil.copyOf(objectYs));
section.baseTileIds = TypedArray(Arrays.copyOf(baseTileIds));
section.objectTileIds = TypedArray(Arrays.copyOf(objectTileIds));
section.objectXs = TypedArray(Arrays.copyOf(objectXs));
section.objectYs = TypedArray(Arrays.copyOf(objectYs));
section.objectInfo = TypedArray.create(ObjectInfo);
for (var ii :int = 0; ii < objectInfo.length; ii++) {
section.objectInfo[ii] = objectInfo[ii].clone();
@@ -34,7 +34,7 @@ import com.threerings.media.tile.Tile;
import com.threerings.media.tile.TileSet;
import com.threerings.media.tile.TileManager;
import com.threerings.media.tile.TileUtil;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Integer;
import com.threerings.util.Log;
import com.threerings.util.Maps;
@@ -173,7 +173,7 @@ public class AutoFringer
fringes :Map, hashValue :int, passable :Boolean, masks :Map) :FringeTile
{
// sort the array so that higher priority fringers get drawn first
ArrayUtil.sort(fringers);
Arrays.sort(fringers);
// Generate an identifier for the fringe tile being created as an array of the keys of its
// component tiles in the order they'll be drawn in the fringe tile.
@@ -21,7 +21,7 @@
package com.threerings.miso.tile {
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Hashable;
import com.threerings.media.tile.BaseTile;
@@ -41,7 +41,7 @@ public class FringeTile extends BaseTile
return false;
}
var fObj :FringeTile = FringeTile(obj);
return _passable == fObj._passable && ArrayUtil.equals(_fringeIds, fObj._fringeIds);
return _passable == fObj._passable && Arrays.equals(_fringeIds, fObj._fringeIds);
}
public function hashCode () :int
@@ -22,7 +22,7 @@
package com.threerings.miso.util {
import com.threerings.miso.data.ObjectInfo;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
import com.threerings.util.Log;
/**
@@ -86,7 +86,7 @@ public class ObjectSet
*/
public function removeAt (index :int) :void
{
ArrayUtil.removeFirst(_objs, index);
Arrays.removeFirst(_objs, index);
}
/**
@@ -118,7 +118,7 @@ public class ObjectSet
*/
public function toArray () :Array
{
return ArrayUtil.copyOf(_objs);
return Arrays.copyOf(_objs);
}
public function toString () :String
@@ -151,7 +151,7 @@ public class ObjectSet
*/
protected function indexOf (info :ObjectInfo) :int
{
return ArrayUtil.binarySearch(_objs, 0, _objs.length, info, searchCompare);
return Arrays.binarySearch(_objs, 0, _objs.length, info, searchCompare);
}
/** Our sorted array of objects. */
@@ -23,7 +23,7 @@ package com.threerings.util {
import flash.geom.Point;
import com.threerings.util.ArrayUtil;
import com.threerings.util.Arrays;
public class DirectionUtil extends DirectionCodes
{
@@ -155,11 +155,11 @@ public class DirectionUtil extends DirectionCodes
var first :int = direction;
var second :int = direction;
for (var ii :int = 0; ii <= FINE_DIRECTION_COUNT / 2; ii++) {
if (ArrayUtil.contains(possible, first)) {
if (Arrays.contains(possible, first)) {
return first;
}
if (ii != 0 && ArrayUtil.contains(possible, second)) {
if (ii != 0 && Arrays.contains(possible, second)) {
return second;
}