com.planet_ink.coffee_mud.core.intermud.i3.server
Interface ServerObject

All Known Subinterfaces:
ServerUser
All Known Implementing Classes:
IMudUser, Interactive

public interface ServerObject

The ServerObject interface prescribes methods which must be defined in any object in the mudlib. Specifically, it wants objects to flag when they are destructed so that the server will stop keeping track of them, and also so that other objects in the mudlib can stop keeping track of them. It is important to remember with Java that destructing an object does not get rid of all references to it. You need to get rid of all references to it in order to delete it from memory. A good mudlib thus will always check if an object is destructed before using it in code and it will remove references to destructed objects. For example: MudObject some_object; public void doSomething() { if( some_object.getDestructed() ) { some_object = null; return; } some_object.getSomethingDoneTo(); } For people used to LPC, the above code would be roughly the same as doing: object some_object; void do_something() { if( !some_object ) { return; } some_object->get_something_done_to(); } Created: 27 September 1996 Last modified: 27 September 1996


Method Summary
 void destruct()
          This method should make it such that getDestructed() returns true and the object is no longer valid for the system.
 boolean getDestructed()
          Signifies that thsi object has been marked for destruction and that all references to this object should be nulled out as soon as they notice.
 java.lang.String getObjectId()
          This method is used to find the unique object id for this object.
 void processEvent()
          Triggered every server cycle by the server to see if this object has an event to process.
 void setObjectId(java.lang.String id)
          This method should be used to set the object's unique object id which the object should be keeping track of.
 

Method Detail

destruct

void destruct()
This method should make it such that getDestructed() returns true and the object is no longer valid for the system.

See Also:
getDestructed()

processEvent

void processEvent()
Triggered every server cycle by the server to see if this object has an event to process. If this object has an event to process, this method should then trigger the processing of that event.


getDestructed

boolean getDestructed()
Signifies that thsi object has been marked for destruction and that all references to this object should be nulled out as soon as they notice.

Returns:
true if the object is marked for destruction, false otherwise

getObjectId

java.lang.String getObjectId()
This method is used to find the unique object id for this object. The object id is assigned by the server through the setObjectId() method. An implementation should thus keep track of this object id, not allow anything else to modify it, and return it through this getObjectId() method.

Returns:
the object id as assigned by the server
See Also:
setObjectId(java.lang.String)

setObjectId

void setObjectId(java.lang.String id)
This method should be used to set the object's unique object id which the object should be keeping track of. Make sure that this can only get set once. The proper code for this method probably should be something like: public final void setObjectId(String id) { if( object_id != null ) { return; } object_id = id; }

Parameters:
id - the unique value to which the id is being set
See Also:
getObjectId()