- Inherits from:
- NSObject
- Conforms to:
- NSCoding
- BDPropertyListEncoding (informal protocol)
- Declared in:
- BDRuleEngine/BDAssignment.h
A BDAssignment respresents the right-hand side of a rule in the rule system.
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.
- NSCoding
- -encodeWithCoder:
- -initWithCoder:
- BDPropertyListEncoding (informal protocol)
- -encodeIntoPropertyList:
- -initWithPropertyList:owner:
- -awakeWithPropertyList:
- Initialization
- +assignmentWithKeyPath:value:
- -initWithKeyPath:value:
- Accessors
- -setKeyPath:
- -keyPath
- -setValue:
- -value
- Firing
- -fireInContext:
+ (id)assignmentWithKeyPath:(NSString *)keyPath value:(id)value
Returns an autoreleased assignment with the corresponding key path and value.
- (id)initWithKeyPath:(NSString *)keyPath value:(id)value
Initializes an instance of BDAssignment with the corresponding key path and value.
- (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.
- (id)keyPath
Returns the key path of the assignment object.
- (void)setKeyPath:(NSString *)value
Sets the new key path of the assignment object.
- (void)setValue:(id)value
Assigns a new value to the assignment object.
- (id)value
Returns the value of the assignment object.