Docsity

AGObject Class: Attributes and Methods, Study notes of Computer Science

Toggle sidebar
bg1
Class: AGObject
This class creates instances of both takeable and non-takeable objects: objects
that can be taken by an AGPlayer object (i.e. kitten, knives, hammer, etc).
Class instances store what room or player contains it. Instances also send
messages to the world object when prompted by the aforementioned objects.
ATTRIBUTES
Class variables: CharCollection
Instance variables: accepted aObjContainer inside myVerb objStats myVerb specialCollection
specialChar container hasContainer takeable surface surfaceContainerList
tempCollection tempDict hasSurface whatHoldsMe aWorld indirectCollection
volume
PUBLIC METHODS
accept: "Passes this method to surface's method."
addBehavior: “adds this behavior to this char"
contain: “Adds object to container.”
container "Method returns the room currently containing the AGObject."
doVerb: “Tells instance to do the argument.”
drop: “Removes object form instance’s container”
getBehavior: "returns the behavior whose rule corresponds to the one passed
in"
makeContainer "Creates a container for class instances..."
makeNotTakeable "Makes object non-takeable."
MakeSurface "Creates a surface to place other objects on.”
makeTakeable "Makes object takeable."
on: "Places this object on an object that has a surface."
pickUp: "Picks up object and places it into intance's container. Same as
contain: method..."
pf3
pf4

Partial preview of the text

Download AGObject Class: Attributes and Methods and more Study notes Computer Science in PDF only on Docsity!

Class: AGObject

This class creates instances of both takeable and non-takeable objects: objects

that can be taken by an AGPlayer object (i.e. kitten, knives, hammer, etc).

Class instances store what room or player contains it. Instances also send

messages to the world object when prompted by the aforementioned objects.

ATTRIBUTES

Class variables: CharCollection Instance variables: accepted aObjContainer inside myVerb objStats myVerb specialCollection specialChar container hasContainer takeable surface surfaceContainerList tempCollection tempDict hasSurface whatHoldsMe aWorld indirectCollection volume

PUBLIC METHODS

accept: "Passes this method to surface's method." addBehavior: “adds this behavior to this char" contain: “Adds object to container.” container "Method returns the room currently containing the AGObject." doVerb: “Tells instance to do the argument.” drop: “Removes object form instance’s container” getBehavior: "returns the behavior whose rule corresponds to the one passed in" makeContainer "Creates a container for class instances..." makeNotTakeable "Makes object non-takeable." MakeSurface "Creates a surface to place other objects on.” makeTakeable "Makes object takeable." on: "Places this object on an object that has a surface." pickUp: "Picks up object and places it into intance's container. Same as contain: method..."

AGObject (cont’d) sent: "Returns whether or not an object has been sent to this class instance." verbHandler: "Passes valid verbs from the vocabulary to verbMatcher." verbMatch: do: “Method sets what the AGObject is to do when a verb from the simple vocabulary is passed to it.” when: do: "Performs do block based on when block" PRIVATE METHODS acceptObject "Sets accept to true." checkContainment "Checks to see if this object has a containment and if so prints it out.” event "Notified when an event has occurred" getAll "Returns all that this object contains or is on its surface" getBehaviorEvents "gets all the behavior events of this character" getContainer "Returns the container and it's contents..." getDescription "Returns the short description" getFirstLevel "Gets the first level only if its a surface" getIndirectCollection "Returns the indirectCollection of this instance." getLimit "returns the limit of this container" getSomeName: "Goes through the objects surface collection as well as the objects containers collection searching for the object that corresponds to the name, someName and returns that object or false otherwise" getSurface "Returns surface object of instance. In another method, I checked to see if instance hasSurface..." getSurfaceLimit "returns the surfaceLimit of this object" AGObject (cont’d)

setVolume:vol "sets the volume of this object itself" setWorld: "Sets the world that this object belongs to" status "Used to return the status of the object"