BDAssignment

Inherits from:
NSObject
Conforms to:
NSCoding
BDPropertyListEncoding (informal protocol)
Declared in:
BDRuleEngine/BDAssignment.h

Class at a Glance

A BDAssignment respresents the right-hand side of a rule in the rule system.


Class Description

The rule system uses assignment objects to represent the right-hand side of rules. Each assignment object is an instance of BDAssignment or a subclass.

Assignments have two halves: A key path, and a value. When an assignment is "fired" in a particular rule context it returns its value; this is the value returned by the rule system when looking up a key in that context with the same key path as the assignment.

This firing behavior can be overridden in subclasses by overriding -[BDAssignment fireInContext:]. An example is BDKeyAssignment, which treats its value as a key path within the rule context, and returns the value at that key path.


Adopted Protocols

NSCoding
-encodeWithCoder:
-initWithCoder:
 
BDPropertyListEncoding (informal protocol)
-encodeIntoPropertyList:
-initWithPropertyList:owner:
-awakeWithPropertyList:

Method Types

Initialization
+assignmentWithKeyPath:value:
-initWithKeyPath:value:
Accessors
-setKeyPath:
-keyPath
-setValue:
-value
Firing
-fireInContext:

Class Methods

assignmentWithKeyPath:value:

+ (id)assignmentWithKeyPath:(NSString *)keyPath value:(id)value

Returns an autoreleased assignment with the corresponding key path and value.


Instance Methods

initWithKeyPath:value:

- (id)initWithKeyPath:(NSString *)keyPath value:(id)value

Initializes an instance of BDAssignment with the corresponding key path and value.

fireInContext:

- (id)fireInContext:(BDRuleContext *)context

"Fires" the assignment in the given context. In BDAssignment, this just returns its value.

Subclasses can override this to specialize their behavior. See BDKeyAssignment for an example.

keyPath

- (id)keyPath

Returns the key path of the assignment object.

setKeyPath:

- (void)setKeyPath:(NSString *)value

Sets the new key path of the assignment object.

setValue:

- (void)setValue:(id)value

Assigns a new value to the assignment object.

value

- (id)value

Returns the value of the assignment object.


Copyright © 2002, 2003 bDistributed.com, Inc. All rights reserved worldwide.