Relationclass
The Relation class is used to define any kind of binary relation you like between objects, or between items of any other kind, e.g. x love y, or a is the father of b, or c knows d.
REQUIRES THE RELATIONS EXTENSION.
class
Relation
:
PreinitObject
Superclass Tree (in declaration order)
Relation
PreinitObject
ModuleExecObject
` object`
Subclass Tree
(none)
Global Objects
Summary of Properties
` name
reciprocal
relationType
relTab
reverseName
`
Inherited from PreinitObject
:
` execBeforeMe
reverseGlobalSymbols
`
Inherited from ModuleExecObject
:
` execAfterMe
hasInitialized_
isDoingExec_
isExecuted_
`
Summary of Methods
` addRelation
inverselyRelatedTo
isInverselyRelated
isRelated
makeUnique
relatedTo
removeRelation
`
Inherited from ModuleExecObject
:
` _execute
classExec
execute
`
Properties
name
A string name that can be used to refer to this relation, e.g. ‘loves’ or ‘is the parent of’ [RELATIONS EXTENSION]
reciprocal
Flag: are we a reciprocal relation (i.e. does x relation b imply b relation x)? Note that only oneToOne and manyToMany relations can be reciprocal. [RELATIONS EXTENSION]
relationType
The type of relation we are; this can be one of oneToOne, oneToMany, manyToOne or manyToMany. [RELATIONS EXTENSION]
relTab
A LookupTable to hold data about the items related via this relation. This is maintained by the library code and shouldn’t normally be directly accessed via game code. [RELATIONS EXTENSION]
reverseName
A string name that can be used to refer to this relation in reverse, e.g. ‘loved by’ or ‘is a child of’ [RELATIONS EXTENSION]
Methods
addRelation (objs)
Make two objects related via this relation. The objs should be supplied as a two-element list (e.g. [a, b]) such that a will be related to b. [RELATIONS EXTENSION]
inverselyRelatedTo (a)
Return a list of items inverselty related to a via this relation (e.g. if this is loving relation, return a list of the people a is loved by. [RELATIONS EXTENSION]
isInverselyRelated (a, b)
Test whether a is inversely related to b via this relation. [RELATIONS EXTENSION]
isRelated (a, b)
Test whether a is related to b via this relation. [RELATIONS EXTENSION]
makeUnique (key, val)
Ensure that key is the only entry in relTab with a value of [val]. [RELATIONS EXTENSION]
relatedTo (a)
Return a list of items related to a via this relation. [RELATIONS EXTENSION]
removeRelation (objs)
Remove this relation between the items specified in objs, which should be supplied as a two-element list [a, b], where a is the item that is no longer related to b. [RELATIONS EXTENSION]
Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1