crystalspace.jbind.impl.engine.objwatch
Class csObjectWatcher

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.engine.objwatch.csObjectWatcher
All Implemented Interfaces:
iBase, iObjectWatcher, iPointer

public class csObjectWatcher
extends csBase
implements iObjectWatcher

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csObjectWatcher(iPointer nPointer)
           
 
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
 java.lang.String getName()
          Return the name of the interface
 int getVersion()
          Return the version of the interface
 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.
protected  boolean isNativePointerValidSafe(long pointer)
           
 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 class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csObjectWatcher

public csObjectWatcher(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase
See Also:
iBase.getVersion()

getName

public java.lang.String getName()
Description copied from interface: iBase
Return the name of the interface

Specified by:
getName in interface iBase
Specified by:
getName in class csBase
See Also:
iBase.getName()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long pointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
csNativeObject.isNativePointerValidSafe(long)

addListener

public void addListener(iObjectWatcherListener cb)
Description copied from interface: iObjectWatcher
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

Specified by:
addListener in interface iObjectWatcher
Parameters:
cb -
See Also:
iObjectWatcher.addListener(crystalspace.jbind.interfaces.iengine.objwatch.iObjectWatcherListener)

getLastLight

public iLight getLastLight()
Description copied from interface: iObjectWatcher
Get the last light.Only valid if the last operation(GetLastOperation()) is one of CS_WATCH_LIGHT_. Implemented in csObjectWatcher.

Specified by:
getLastLight in interface iObjectWatcher
Returns:
See Also:
iObjectWatcher.getLastLight()

getLastMovable

public iMovable getLastMovable()
Description copied from interface: iObjectWatcher
Get the last movable.Only valid if the last operation(GetLastOperation()) is one of CS_WATCH_MOVABLE_. Implemented in csObjectWatcher

Specified by:
getLastMovable in interface iObjectWatcher
Returns:
See Also:
iObjectWatcher.getLastMovable()

getLastOperation

public int getLastOperation()
Description copied from interface: iObjectWatcher
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

Specified by:
getLastOperation in interface iObjectWatcher
Returns:
See Also:
iObjectWatcher.getLastOperation()

getLight

public iLight getLight(int idx)
Description copied from interface: iObjectWatcher
Get the specified watched light.Implemented in csObjectWatcher

Specified by:
getLight in interface iObjectWatcher
Parameters:
idx -
Returns:
See Also:
iObjectWatcher.getLight(int)

getMovable

public iMovable getMovable(int idx)
Description copied from interface: iObjectWatcher
Get the specified watched movable.Implemented in csObjectWatcher

Specified by:
getMovable in interface iObjectWatcher
Parameters:
idx -
Returns:
See Also:
iObjectWatcher.getMovable(int)

getWatchedLightCount

public int getWatchedLightCount()
Description copied from interface: iObjectWatcher
Get the number of watched lights.Implemented in csObjectWatcher

Specified by:
getWatchedLightCount in interface iObjectWatcher
Returns:
See Also:
iObjectWatcher.getWatchedLightCount()

getWatchedMovableCount

public int getWatchedMovableCount()
Description copied from interface: iObjectWatcher
Get the number of watched movables.Implemented in csObjectWatcher

Specified by:
getWatchedMovableCount in interface iObjectWatcher
Returns:
See Also:
iObjectWatcher.getWatchedMovableCount()

getWatchNumber

public int getWatchNumber()
Description copied from interface: iObjectWatcher
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

Specified by:
getWatchNumber in interface iObjectWatcher
Returns:
See Also:
iObjectWatcher.getWatchNumber()

removeLight

public void removeLight(iLight light)
Description copied from interface: iObjectWatcher
Remove a light to watch.Implemented in csObjectWatcher

Specified by:
removeLight in interface iObjectWatcher
Parameters:
light -
See Also:
iObjectWatcher.removeLight(crystalspace.jbind.interfaces.iengine.light.iLight)

removeListener

public void removeListener(iObjectWatcherListener cb)
Description copied from interface: iObjectWatcher
Remove a listener.Implemented in csObjectWatcher

Specified by:
removeListener in interface iObjectWatcher
Parameters:
cb -
See Also:
iObjectWatcher.removeListener(crystalspace.jbind.interfaces.iengine.objwatch.iObjectWatcherListener)

removeMovable

public void removeMovable(iMovable movable)
Description copied from interface: iObjectWatcher
Remove a movable to watch.Implemented in csObjectWatcher

Specified by:
removeMovable in interface iObjectWatcher
Parameters:
movable -
See Also:
iObjectWatcher.removeMovable(crystalspace.jbind.interfaces.iengine.movable.iMovable)

reset

public void reset()
Description copied from interface: iObjectWatcher
Reset.Remove all watched objects from this watcher. Implemented in csObjectWatcher

Specified by:
reset in interface iObjectWatcher
See Also:
iObjectWatcher.reset()

watchLight

public void watchLight(iLight light)
Description copied from interface: iObjectWatcher
Add a light to watch.Implemented in csObjectWatcher

Specified by:
watchLight in interface iObjectWatcher
Parameters:
light -
See Also:
iObjectWatcher.watchLight(crystalspace.jbind.interfaces.iengine.light.iLight)

watchMovable

public void watchMovable(iMovable movable)
Description copied from interface: iObjectWatcher
Add a movable to watch.Implemented in csObjectWatcher

Specified by:
watchMovable in interface iObjectWatcher
Parameters:
movable -
See Also:
iObjectWatcher.watchMovable(crystalspace.jbind.interfaces.iengine.movable.iMovable)