More ...Equal() -> ...() and ...() to ...Ref().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3171 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FrameManager.java,v 1.53 2004/10/23 17:21:54 mdb Exp $
|
||||
// $Id: FrameManager.java,v 1.54 2004/10/23 17:36:32 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -288,7 +288,7 @@ public abstract class FrameManager
|
||||
*/
|
||||
public void registerFrameParticipant (FrameParticipant participant)
|
||||
{
|
||||
Object[] nparts = ListUtil.testAndAdd(_participants, participant);
|
||||
Object[] nparts = ListUtil.testAndAddRef(_participants, participant);
|
||||
if (nparts == null) {
|
||||
Log.warning("Refusing to add duplicate frame participant! " +
|
||||
participant);
|
||||
@@ -310,7 +310,7 @@ public abstract class FrameManager
|
||||
*/
|
||||
public void removeFrameParticipant (FrameParticipant participant)
|
||||
{
|
||||
ListUtil.clear(_participants, participant);
|
||||
ListUtil.clearRef(_participants, participant);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SimpleMisoSceneModel.java,v 1.7 2004/08/27 02:20:06 mdb Exp $
|
||||
// $Id: SimpleMisoSceneModel.java,v 1.8 2004/10/23 17:36:32 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -168,7 +168,7 @@ public class SimpleMisoSceneModel extends MisoSceneModel
|
||||
public boolean removeObject (ObjectInfo info)
|
||||
{
|
||||
// look for it in the interesting info array
|
||||
int oidx = ListUtil.indexOfEqual(objectInfo, info);
|
||||
int oidx = ListUtil.indexOf(objectInfo, info);
|
||||
if (oidx != -1) {
|
||||
objectInfo = (ObjectInfo[])ArrayUtil.splice(objectInfo, oidx, 1);
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SparseMisoSceneModel.java,v 1.16 2004/08/27 02:20:06 mdb Exp $
|
||||
// $Id: SparseMisoSceneModel.java,v 1.17 2004/10/23 17:36:32 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -118,7 +118,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
|
||||
public boolean addObject (ObjectInfo info) {
|
||||
// sanity check: see if there is already an object of this
|
||||
// type at these coordinates
|
||||
if (ListUtil.indexOfEqual(objectInfo, info) != -1 ||
|
||||
if (ListUtil.indexOf(objectInfo, info) != -1 ||
|
||||
indexOfUn(info) != -1) {
|
||||
Log.warning("Refusing to add duplicate interesting " +
|
||||
"object " + info + ".");
|
||||
@@ -137,7 +137,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
|
||||
|
||||
public boolean removeObject (ObjectInfo info) {
|
||||
// look for it in the interesting info array
|
||||
int oidx = ListUtil.indexOfEqual(objectInfo, info);
|
||||
int oidx = ListUtil.indexOf(objectInfo, info);
|
||||
if (oidx != -1) {
|
||||
objectInfo = (ObjectInfo[])
|
||||
ArrayUtil.splice(objectInfo, oidx, 1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DObject.java,v 1.78 2004/08/27 02:20:20 mdb Exp $
|
||||
// $Id: DObject.java,v 1.79 2004/10/23 17:36:32 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -164,7 +164,7 @@ public class DObject extends TrackedObject
|
||||
public void addSubscriber (Subscriber sub)
|
||||
{
|
||||
// only add the subscriber if they're not already there
|
||||
Object[] subs = ListUtil.testAndAdd(_subs, sub);
|
||||
Object[] subs = ListUtil.testAndAddRef(_subs, sub);
|
||||
if (subs != null) {
|
||||
// Log.info("Adding subscriber " + which() + ": " + sub + ".");
|
||||
_subs = subs;
|
||||
@@ -188,7 +188,7 @@ public class DObject extends TrackedObject
|
||||
*/
|
||||
public void removeSubscriber (Subscriber sub)
|
||||
{
|
||||
if (ListUtil.clear(_subs, sub) != null) {
|
||||
if (ListUtil.clearRef(_subs, sub) != null) {
|
||||
// if we removed something, check to see if we just removed
|
||||
// the last subscriber from our list; we also want to be sure
|
||||
// that we're still active otherwise there's no need to notify
|
||||
@@ -233,7 +233,7 @@ public class DObject extends TrackedObject
|
||||
public void addListener (ChangeListener listener)
|
||||
{
|
||||
// only add the listener if they're not already there
|
||||
Object[] els = ListUtil.testAndAdd(_listeners, listener);
|
||||
Object[] els = ListUtil.testAndAddRef(_listeners, listener);
|
||||
if (els != null) {
|
||||
_listeners = els;
|
||||
} else {
|
||||
@@ -251,7 +251,7 @@ public class DObject extends TrackedObject
|
||||
*/
|
||||
public void removeListener (ChangeListener listener)
|
||||
{
|
||||
ListUtil.clear(_listeners, listener);
|
||||
ListUtil.clearRef(_listeners, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +341,7 @@ public class DObject extends TrackedObject
|
||||
{
|
||||
// check for the existence of the lock in the list and add it if
|
||||
// it's not already there
|
||||
Object[] list = ListUtil.testAndAddEqual(_locks, name);
|
||||
Object[] list = ListUtil.testAndAdd(_locks, name);
|
||||
if (list == null) {
|
||||
// a null list means the object was already in the list
|
||||
return false;
|
||||
@@ -378,7 +378,7 @@ public class DObject extends TrackedObject
|
||||
protected void clearLock (String name)
|
||||
{
|
||||
// clear the lock from the list
|
||||
if (ListUtil.clearEqual(_locks, name) == null) {
|
||||
if (ListUtil.clear(_locks, name) == null) {
|
||||
// complain if we didn't find the lock
|
||||
Log.info("Unable to clear non-existent lock [lock=" + name +
|
||||
", dobj=" + this + "].");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SpotSceneModel.java,v 1.12 2004/08/27 02:20:46 mdb Exp $
|
||||
// $Id: SpotSceneModel.java,v 1.13 2004/10/23 17:36:32 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -59,7 +59,7 @@ public class SpotSceneModel extends TrackedStreamableObject
|
||||
*/
|
||||
public void removePortal (Portal portal)
|
||||
{
|
||||
int pidx = ListUtil.indexOfEqual(portals, portal);
|
||||
int pidx = ListUtil.indexOf(portals, portal);
|
||||
if (pidx != -1) {
|
||||
portals = (Portal[])ArrayUtil.splice(portals, pidx, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user