Linkable class | objects.t[3309]

A "linkable" object is one that can participate in a master/slave relationship. This kind of relationship means that the state of both objects in the pair is controlled by one of the objects, called the master; the other object defers to the other to get and set all of its linkable state.

Note that this base class doesn't provide for the management of any of the actual linked state. Subclasses are responsible for doing this. The general pattern is to create a getter/setter method pair for each bit of linked state, and in these methods refer to masterObject.xxx rather than just self.xxx.

This is useful for objects such as doors that have two separate objects representing the two sides of the door. The two sides are always linked for things like open/closed and locked/unlocked state; this can be handled by linking the two sides, and managing all state of both sides in one side designated as the master.

`class Linkable : object`

Superclass Tree (in declaration order)

`Linkable`
`object`

Subclass Tree

`Linkable`
`BasicOpenable`
`BasicDoor`
`Door`
`AutoClosingDoor`
`SecretDoor`
`HiddenDoor`
`Openable`
`Door`
`AutoClosingDoor`
`Matchbook`
`OpenableContainer`
`KeyedContainer`
`LockableContainer`
`Lockable`
`IndirectLockable`
`LockableContainer`
`LockableWithKey`
`KeyedContainer`
`Passage`
`Stairway`
`StairwayDown`
`StairwayUp`
`ThroughPassage`
`BasicDoor`
`Door`
`AutoClosingDoor`
`SecretDoor`
`HiddenDoor`
`ExitOnlyPassage`
`PathPassage`

Global Objects

(none)

Summary of Properties

``

(none)

Summary of Methods

`initializeThing masterObject`

Properties

(none)

Methods

`initializeThing ( )` | `objects.t[3340]`

We're normally mixed into a Thing; do some extra work in initialization.

`masterObject ( )` | `objects.t[3324]`

Get the master object, which holds our state. By default, this is simply 'self', but some objects might want to override this. For example, doors are usually implemented with two separate objects, representing the two sides of the door, which share common state; in such cases, one of the pair can be designated as the master, which holds the common state of the door, and this method can be overridden so that all state operations on the lock are performed on the master side of the door.

We return self by default so that a linkable object can stand alone if desired. That is, a linkable object doesn't have to be part of a pair; it can just as well be a single object.

TADS 3 Library Manual
Generated on 8/21/2012 from TADS version 3.1.2