rescuecore
Class FilterMemoryListener

java.lang.Object
  |
  +--rescuecore.FilterMemoryListener
All Implemented Interfaces:
MemoryListener

public class FilterMemoryListener
extends java.lang.Object
implements MemoryListener

This class will filter which events get passed to a MemoryListener


Field Summary
static int MODE_CLASS
           
static int MODE_INTERNAL_TYPE
           
static int MODE_TYPE
           
 
Method Summary
static MemoryListener createClassFilter(java.lang.Class clazz, MemoryListener l)
          Create a new FilterMemoryListener that will only pass on notifications that concern RescueObjects of a particular class
static MemoryListener createInternalTypeFilter(int type, MemoryListener l)
          Create a new FilterMemoryListener that will only pass on notifications that concern RescueObjects of a particular internal type
static MemoryListener createTypeFilter(int type, MemoryListener l)
          Create a new FilterMemoryListener that will only pass on notifications that concern RescueObjects of a particular type
 void objectAdded(RescueObject o, int time)
          Notification that an object has been added to the memory
 void objectChanged(RescueObject o, int property, int time)
          Notification that an object in the memory has been changed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_CLASS

public static final int MODE_CLASS
See Also:
Constant Field Values

MODE_TYPE

public static final int MODE_TYPE
See Also:
Constant Field Values

MODE_INTERNAL_TYPE

public static final int MODE_INTERNAL_TYPE
See Also:
Constant Field Values
Method Detail

createClassFilter

public static MemoryListener createClassFilter(java.lang.Class clazz,
                                               MemoryListener l)
Create a new FilterMemoryListener that will only pass on notifications that concern RescueObjects of a particular class

Parameters:
clazz - The Class we are interested in
l - The MemoryListener to pass qualifying updates down to
Returns:
A MemoryListener that will filter out all notifications that do not concern RescueObjects of the given class

createTypeFilter

public static MemoryListener createTypeFilter(int type,
                                              MemoryListener l)
Create a new FilterMemoryListener that will only pass on notifications that concern RescueObjects of a particular type

Parameters:
type - The type we are interested in
l - The MemoryListener to pass qualifying updates down to
Returns:
A MemoryListener that will filter out all notifications that do not concern RescueObjects of the given type
See Also:
RescueConstants.TYPE_CIVILIAN, RescueConstants.TYPE_FIRE_BRIGADE, RescueConstants.TYPE_AMBULANCE_TEAM, RescueConstants.TYPE_POLICE_FORCE, RescueConstants.TYPE_ROAD, RescueConstants.TYPE_NODE, RescueConstants.TYPE_RIVER, RescueConstants.TYPE_RIVER_NODE, RescueConstants.TYPE_BUILDING, RescueConstants.TYPE_REFUGE, RescueConstants.TYPE_FIRE_STATION, RescueConstants.TYPE_AMBULANCE_CENTER, RescueConstants.TYPE_POLICE_OFFICE, RescueConstants.TYPE_WORLD, RescueConstants.TYPE_CAR

createInternalTypeFilter

public static MemoryListener createInternalTypeFilter(int type,
                                                      MemoryListener l)
Create a new FilterMemoryListener that will only pass on notifications that concern RescueObjects of a particular internal type

Parameters:
type - The internal type we are interested in
l - The MemoryListener to pass qualifying updates down to
Returns:
A MemoryListener that will filter out all notifications that do not concern RescueObjects of the given internal type
See Also:
RescueConstants.INTERNAL_TYPE_CIVILIAN, RescueConstants.INTERNAL_TYPE_FIRE_BRIGADE, RescueConstants.INTERNAL_TYPE_AMBULANCE_TEAM, RescueConstants.INTERNAL_TYPE_POLICE_FORCE, RescueConstants.INTERNAL_TYPE_CAR, RescueConstants.INTERNAL_TYPE_BUILDING, RescueConstants.INTERNAL_TYPE_REFUGE, RescueConstants.INTERNAL_TYPE_FIRE_STATION, RescueConstants.INTERNAL_TYPE_POLICE_OFFICE, RescueConstants.INTERNAL_TYPE_AMBULANCE_CENTER, RescueConstants.INTERNAL_TYPE_ROAD, RescueConstants.INTERNAL_TYPE_NODE, RescueConstants.INTERNAL_TYPE_RIVER, RescueConstants.INTERNAL_TYPE_RIVER_NODE, RescueConstants.INTERNAL_TYPE_WORLD, RescueConstants.INTERNAL_TYPE_ANY_BUILDING, RescueConstants.INTERNAL_TYPE_ANY_HUMANOID

objectAdded

public void objectAdded(RescueObject o,
                        int time)
Description copied from interface: MemoryListener
Notification that an object has been added to the memory

Specified by:
objectAdded in interface MemoryListener
Parameters:
o - The object added
time - The timestamp of the change

objectChanged

public void objectChanged(RescueObject o,
                          int property,
                          int time)
Description copied from interface: MemoryListener
Notification that an object in the memory has been changed

Specified by:
objectChanged in interface MemoryListener
Parameters:
o - The object changed
property - The property that changed
time - The timestamp of the change