public class TOwnershipMap extends java.lang.Object implements StateSaveable, TAMEConstants
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<TObject,com.tameif.tame.struct.CaseInsensitiveStringSet> |
objectCurrentNames
Map of object to its current names.
|
protected java.util.Map<TObject,com.tameif.tame.struct.CaseInsensitiveStringSet> |
objectCurrentTags
Map of object to its current tags.
|
protected com.tameif.tame.struct.HashDequeMap<ObjectContainer,TObject> |
objectsOwnedByElements
Ownership map - objects owned by elements.
|
protected java.util.Map<TObject,ObjectContainer> |
objectsToElement
Reverse lookup object - not saved.
|
protected java.util.Map<TPlayer,java.util.Deque<TRoom>> |
playerToRoomStack
Room stack.
|
CUE_ERROR, CUE_FATAL, CUE_PAUSE, CUE_QUIT, CUE_TEXT, CUE_TEXTF, CUE_TRACE, CUE_WAIT, DEFAULT_FUNCTION_DEPTH, DEFAULT_RUNAWAY_THRESHOLD, HEADER_AUTHOR, HEADER_COUNTRY, HEADER_EMAIL, HEADER_LANGUAGE, HEADER_TAME_FUNCDEPTH_MAX, HEADER_TAME_RUNAWAY_MAX, HEADER_TITLE, HEADER_TWITTER, HEADER_VERSION, HEADER_WEBSITE, IDENTITY_ARCHETYPE_CONTAINER, IDENTITY_CURRENT_PLAYER, IDENTITY_CURRENT_ROOM, IDENTITY_CURRENT_WORLD, RETURN_VARIABLE
Constructor and Description |
---|
TOwnershipMap()
Creates a new ownership.
|
Modifier and Type | Method and Description |
---|---|
void |
addObjectName(TObject object,
java.lang.String name)
Adds a name to an object.
|
void |
addObjectTag(TObject object,
java.lang.String tag)
Adds a tag to this object.
|
void |
addObjectToElement(TObject object,
ObjectContainer element)
Adds an object to an element that can hold objects.
|
void |
addPlayerToRoom(TPlayer player,
TRoom room)
Adds a player to a room and discards the stack.
|
boolean |
checkElementHasObject(ObjectContainer element,
TObject object)
Checks if an element possesses an object.
|
boolean |
checkObjectHasName(TObject object,
java.lang.String name)
Checks if an object contains a particular name.
|
boolean |
checkObjectHasNoOwner(TObject object)
Checks if an object has no owner.
|
boolean |
checkObjectHasTag(TObject object,
java.lang.String tag)
Checks if an object contains a particular tag.
|
boolean |
checkPlayerHasRoomInStack(TPlayer player,
TRoom room)
Returns if a player is in a room (or room is in stack).
|
TPlayer |
getCurrentPlayer()
Gets the current player by the current player id.
|
TRoom |
getCurrentRoom()
Gets the current room by the current room id.
|
TRoom |
getCurrentRoom(TPlayer player)
Returns the current room for a player.
|
java.lang.Iterable<TObject> |
getObjectsOwnedByElement(ObjectContainer element)
Gets the list of objects owned by an element.
|
int |
getObjectsOwnedByElementCount(ObjectContainer element)
Gets the count of objects owned by an element.
|
TRoom |
popRoomFromPlayer(TPlayer player)
Pops a room off of a player's room stack.
|
void |
pushRoomOntoPlayer(TPlayer player,
TRoom room)
Pushes a room onto a player's room stack.
|
void |
readStateBytes(TAMEModule module,
java.util.Map<java.lang.Long,Value> referenceMap,
java.io.InputStream in)
Imports this object's state from bytes.
|
void |
removeObject(TObject object)
Removes an object from all owners.
|
void |
removeObjectName(TObject object,
java.lang.String name)
Removes a name from an object.
|
void |
removeObjectTag(TObject object,
java.lang.String tag)
Removes a tag from an object.
|
void |
removePlayer(TPlayer player)
Removes a player from all rooms.
|
void |
reset()
Clears entire ownership table.
|
void |
setCurrentPlayer(TPlayer player)
Sets the current player.
|
void |
writeStateBytes(TAMEModule module,
java.util.concurrent.atomic.AtomicLong referenceCounter,
java.util.Map<java.lang.Object,java.lang.Long> referenceSet,
java.io.OutputStream out)
Exports this object's state to bytes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromStateBytes, toStateBytes
protected java.util.Map<TObject,com.tameif.tame.struct.CaseInsensitiveStringSet> objectCurrentNames
protected java.util.Map<TObject,com.tameif.tame.struct.CaseInsensitiveStringSet> objectCurrentTags
protected com.tameif.tame.struct.HashDequeMap<ObjectContainer,TObject> objectsOwnedByElements
protected java.util.Map<TObject,ObjectContainer> objectsToElement
public void reset()
public void removeObject(TObject object)
object
- the object to remove.public void removePlayer(TPlayer player)
player
- the player to remove.public void addObjectToElement(TObject object, ObjectContainer element)
object
- the object to add.element
- the target element.public void addPlayerToRoom(TPlayer player, TRoom room)
player
- the player to add.room
- the target room.public void pushRoomOntoPlayer(TPlayer player, TRoom room)
player
- the player to change.room
- the room to push.public TRoom popRoomFromPlayer(TPlayer player)
player
- the player to change.public boolean checkElementHasObject(ObjectContainer element, TObject object)
element
- the element to use.object
- the object in question.public boolean checkObjectHasNoOwner(TObject object)
object
- the object in question.public boolean checkPlayerHasRoomInStack(TPlayer player, TRoom room)
player
- the player to use.room
- the room to use.public void setCurrentPlayer(TPlayer player)
player
- the player to set as current player.public TPlayer getCurrentPlayer()
public TRoom getCurrentRoom(TPlayer player)
player
- the player to use.public TRoom getCurrentRoom()
public java.lang.Iterable<TObject> getObjectsOwnedByElement(ObjectContainer element)
element
- the element in question.public int getObjectsOwnedByElementCount(ObjectContainer element)
element
- the element in question.public void addObjectName(TObject object, java.lang.String name)
object
- the object to use.name
- the name to add.public void removeObjectName(TObject object, java.lang.String name)
object
- the object to use.name
- the name to remove.public boolean checkObjectHasName(TObject object, java.lang.String name)
name
- the name to check.object
- the object to use.public void addObjectTag(TObject object, java.lang.String tag)
object
- the object to use.tag
- the tag to add.public void removeObjectTag(TObject object, java.lang.String tag)
object
- the object to use.tag
- the tag to remove.public boolean checkObjectHasTag(TObject object, java.lang.String tag)
object
- the object to use.tag
- the tag to check.public void writeStateBytes(TAMEModule module, java.util.concurrent.atomic.AtomicLong referenceCounter, java.util.Map<java.lang.Object,java.lang.Long> referenceSet, java.io.OutputStream out) throws java.io.IOException
StateSaveable
writeStateBytes
in interface StateSaveable
module
- the source module for reference.referenceCounter
- the reference counter to use for when unique values are seen.referenceSet
- the reference set to use for "seen" value references - maps object reference to counter value.out
- the output stream to write to.java.io.IOException
- if a write problem occurs.public void readStateBytes(TAMEModule module, java.util.Map<java.lang.Long,Value> referenceMap, java.io.InputStream in) throws java.io.IOException
StateSaveable
readStateBytes
in interface StateSaveable
module
- the source module for reference.referenceMap
- the reference map to use for "seen" value references.in
- the input stream to read from.java.io.IOException
- if a read problem occurs.