|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--GameObject
|
+--RealObject
A Real Object is currently anything other than a passage.
| Inner Class Summary | |
(package private) class |
RealObject.ContentsMessager
A class that's used for sending identical messages to lots of objects, usually all those in a Room. |
(package private) class |
RealObject.DescriptionLineProcessor
This class is used in a callback context to process lines in a long description file. |
| Inner classes inherited from class GameObject |
GameObject.LeaveInfo |
| Field Summary | |
(package private) MyVector |
contents
List of other objects contained within this one. |
protected java.lang.String |
longDescription
A long description of the object, more or less. |
protected RealObject |
parentObject
The object we're contained within. |
protected java.lang.String |
shortDescription
A short description of the object, suitable for use in a list. |
(package private) MyVector |
spreadto
This is a list of rooms to which this object and its clones have spread in order to avoid duplication. |
| Fields inherited from class GameObject |
masterGame, name |
| Constructor Summary | |
(package private) |
RealObject()
|
| Method Summary | |
boolean |
checkLeave(GameObject.LeaveInfo leaveinfo)
Checks if we're okay about somebody leaving the room we're in. |
protected java.lang.Object |
clone()
Clone myself and register as necessary. |
void |
doAction()
Figure out what we want to do when we get our 15 microseconds of fame. |
java.lang.String |
getLongDescription()
What's our long description? Often overridden by subclasses. |
(package private) RealObject |
getParent()
Find out what we're in. |
java.lang.String |
getShortDescription()
Unregister this object from everything. |
double |
getSpreadability()
Find out how likely this object is to spread to another Room. |
void |
goodbye(GameObject.LeaveInfo leaveinfo)
Called when somebody leaves the room we're in. |
void |
hello(RealObject enterer)
Called when somebody enters the room we're in. |
void |
initialize(java.lang.String initializer,
GameObject parentObjectArg)
Initialize this object. |
protected boolean |
isPredicate(java.lang.String predicate)
Check if a condition applies to this object. |
protected void |
preClone()
This is called before cloning an object, in case the object wants to divide up its resources. |
(package private) void |
register(GameObject child)
Called when we become a parent. |
(package private) Room |
roomOf()
Tell what room we're in |
java.lang.String |
runSpy()
Give information to somebody who's spying on us. |
(package private) void |
setParent(RealObject newParent)
Set a new parent object. |
(package private) void |
spread()
Try to spread to another room through a passage. |
(package private) void |
tellAll(RealObject.ContentsMessager Messager,
boolean iterate)
This method is used to get this object and all the objects contained in this one to run some code. |
(package private) void |
unregister(GameObject child)
Called when we are no longer parent to an object. |
protected boolean |
wanderVia(Room.RoomPassage wanderPassage,
java.lang.String msg)
Move from here to somewhere else, if we can, and make sure that the whole world knows about it. |
| Methods inherited from class GameObject |
announce, compareTo, getMasterGame, kill, listen, newInstance, setMasterGame, toString |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
final MyVector contents
protected java.lang.String longDescription
protected RealObject parentObject
protected java.lang.String shortDescription
final MyVector spreadto
| Constructor Detail |
RealObject()
| Method Detail |
public boolean checkLeave(GameObject.LeaveInfo leaveinfo)
leaveinfo - Information about who's trying to leave
and where they want to goprotected java.lang.Object clone()
clone in class java.lang.Objectpublic void doAction()
doAction in class GameObjectpublic java.lang.String getLongDescription()
RealObject getParent()
public java.lang.String getShortDescription()
public double getSpreadability()
public void goodbye(GameObject.LeaveInfo leaveinfo)
leaveinfo - Information about who's trying to leave
and where they want to gopublic void hello(RealObject enterer)
enterer - who's there? (We don't know where they
came from. Or why.)
public void initialize(java.lang.String initializer,
GameObject parentObjectArg)
throws GameException
initialize in class GameObjectinitializer - A string delimited by tildes, indicating the name,
short description, and long description of the object.
Subclasses may have additional fields. Should probably throw a Game
Exception if pieces are missing.ClassCastException - if the parentObjectArg is not a RealObject.
protected boolean isPredicate(java.lang.String predicate)
throws GameException
Predicate hierarchy (based on the information
passed in) which does the actual checking.predicate - A string of the type
[!] type : details, where type
invokes a class named Checktype.GameException - if the type is not valid.
Any other weird conditions should be trapped by the evaluator
and turned into a false return value.Predicateprotected void preClone()
void register(GameObject child)
child - the object of which we are now the proud parent.Room roomOf()
public java.lang.String runSpy()
runSpy in interface Spyablevoid setParent(RealObject newParent)
newParent - the new parent object; could be null if we're
escaping from the world.void spread()
void tellAll(RealObject.ContentsMessager Messager,
boolean iterate)
Messager - instance of a class which contains a
method containing the code you want run.iterate - true to pass this on to objects contained
in the contents of this one.void unregister(GameObject child)
child - the object of which we once were parent.
protected boolean wanderVia(Room.RoomPassage wanderPassage,
java.lang.String msg)
wanderPassage - the RoomPassage out which we want to go.msg - a string to announce our departure. It may contain
an at sign, which would be replaced with the name of the
room to which we're going.
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||