crystalspace.jbind.interfaces.iengine.objwatch
Interface iObjectWatcher

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csObjectWatcher

public interface iObjectWatcher
extends iBase

This is a generic object watcher. Currently it can watch on light and movable changes. You can query if something has changed by examining the 'number' or else you can register a listener and get notified when one of the objects changes. This object will not keep real references to the objects it is watching but it will clean up the watcher for some object if that object is removed.

Author:
Java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/devapi/structiObjectWatcher.php

Method Summary
 void addListener(iObjectWatcherListener cb)
          Add a listener to this object watcher.
 iLight getLastLight()
          Get the last light.Only valid if the last operation(GetLastOperation()) is one of CS_WATCH_LIGHT_.
 iMovable getLastMovable()
          Get the last movable.Only valid if the last operation(GetLastOperation()) is one of CS_WATCH_MOVABLE_.
 int getLastOperation()
          Get the last operation that occured.This will be one of : * CS_WATCH_NONE : nothing happened yet. * CS_WATCH_LIGHT_DESTROY : light is destroyed. * CS_WATCH_LIGHT_MOVE : light has moved. * CS_WATCH_LIGHT_COLOR : light has changed color. * CS_WATCH_LIGHT_SECTOR : light has changed sector. * CS_WATCH_LIGHT_RADIUS : light has changed radius. * CS_WATCH_MOVABLE_DESTROY : movable is destroyed. * CS_WATCH_MOVABLE_CHANGED : movable is changed Implemented in csObjectWatcher
 iLight getLight(int idx)
          Get the specified watched light.Implemented in csObjectWatcher
 iMovable getMovable(int idx)
          Get the specified watched movable.Implemented in csObjectWatcher
 int getWatchedLightCount()
          Get the number of watched lights.Implemented in csObjectWatcher
 int getWatchedMovableCount()
          Get the number of watched movables.Implemented in csObjectWatcher
 int getWatchNumber()
          Get the current number for his watcher.
 void removeLight(iLight light)
          Remove a light to watch.Implemented in csObjectWatcher
 void removeListener(iObjectWatcherListener cb)
          Remove a listener.Implemented in csObjectWatcher
 void removeMovable(iMovable movable)
          Remove a movable to watch.Implemented in csObjectWatcher
 void reset()
          Reset.Remove all watched objects from this watcher.
 void watchLight(iLight light)
          Add a light to watch.Implemented in csObjectWatcher
 void watchMovable(iMovable movable)
          Add a movable to watch.Implemented in csObjectWatcher
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

addListener

public void addListener(iObjectWatcherListener cb)
Add a listener to this object watcher. This will call IncRef() on the listener So make sure you call DecRef() to release your own reference.Implemented in csObjectWatcher

Parameters:
cb -

getLastLight

public iLight getLastLight()
Get the last light.Only valid if the last operation(GetLastOperation()) is one of CS_WATCH_LIGHT_. Implemented in csObjectWatcher.

Returns:

getLastMovable

public iMovable getLastMovable()
Get the last movable.Only valid if the last operation(GetLastOperation()) is one of CS_WATCH_MOVABLE_. Implemented in csObjectWatcher

Returns:

getLastOperation

public int getLastOperation()
Get the last operation that occured.This will be one of : * CS_WATCH_NONE : nothing happened yet. * CS_WATCH_LIGHT_DESTROY : light is destroyed. * CS_WATCH_LIGHT_MOVE : light has moved. * CS_WATCH_LIGHT_COLOR : light has changed color. * CS_WATCH_LIGHT_SECTOR : light has changed sector. * CS_WATCH_LIGHT_RADIUS : light has changed radius. * CS_WATCH_MOVABLE_DESTROY : movable is destroyed. * CS_WATCH_MOVABLE_CHANGED : movable is changed Implemented in csObjectWatcher

Returns:

getLight

public iLight getLight(int idx)
Get the specified watched light.Implemented in csObjectWatcher

Parameters:
idx -
Returns:

getMovable

public iMovable getMovable(int idx)
Get the specified watched movable.Implemented in csObjectWatcher

Parameters:
idx -
Returns:

getWatchedLightCount

public int getWatchedLightCount()
Get the number of watched lights.Implemented in csObjectWatcher

Returns:

getWatchedMovableCount

public int getWatchedMovableCount()
Get the number of watched movables.Implemented in csObjectWatcher

Returns:

getWatchNumber

public int getWatchNumber()
Get the current number for his watcher. This number will increase as soon as some of the watched objects change. When this happens you can query the last change(only the last change !) by calling GetLastOperation() and/or GetLastLight() or GetLastMovable(). Note that if the operation indicates that something is destroyed then you should no longer use the pointer returned by GetLastLight() or GetLastMovable() as the object will already be gone by then. You can only use the returned pointer to clean up from internal data structures.Implemented in csObjectWatcher

Returns:

removeLight

public void removeLight(iLight light)
Remove a light to watch.Implemented in csObjectWatcher

Parameters:
light -

removeListener

public void removeListener(iObjectWatcherListener cb)
Remove a listener.Implemented in csObjectWatcher

Parameters:
cb -

removeMovable

public void removeMovable(iMovable movable)
Remove a movable to watch.Implemented in csObjectWatcher

Parameters:
movable -

reset

public void reset()
Reset.Remove all watched objects from this watcher. Implemented in csObjectWatcher


watchLight

public void watchLight(iLight light)
Add a light to watch.Implemented in csObjectWatcher

Parameters:
light -

watchMovable

public void watchMovable(iMovable movable)
Add a movable to watch.Implemented in csObjectWatcher

Parameters:
movable -