Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOSingleObjectProbabilitySet Class Reference
+ Inheritance diagram for OOSingleObjectProbabilitySet:
+ Collaboration diagram for OOSingleObjectProbabilitySet:

Instance Methods

(id) - initWithObject:weight:
 
() - if [implementation]
 
(void) - dealloc [implementation]
 
(NSDictionary *) - propertyListRepresentation [implementation]
 
(id) - randomObject [implementation]
 
(float) - weightForObject: [implementation]
 
(float) - sumOfWeights [implementation]
 
(NSUInteger) - count [implementation]
 
(NSArray *) - allObjects [implementation]
 
(id) - mutableCopyWithZone: [implementation]
 
- Instance Methods inherited from OOProbabilitySet
(id) - init
 
(id) - initWithObjects:weights:count:
 
(id) - initWithPropertyListRepresentation:
 
(id) - initPriv [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(id) - copyWithZone: [implementation]
 
(BOOL) - containsObject:
 
(NSEnumerator *) - objectEnumerator
 
(float) - probabilityForObject:
 

Private Attributes

id _object
 
float _weight
 

Additional Inherited Members

- Class Methods inherited from OOProbabilitySet
(id) + probabilitySet
 
(id) + probabilitySetWithObjects:weights:count:
 
(id) + probabilitySetWithPropertyListRepresentation:
 

Detailed Description

Definition at line 80 of file OOProbabilitySet.m.

Method Documentation

◆ allObjects

- (NSArray *) allObjects
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

504{
505 return [NSArray arrayWithObject:_object];
506}
507

◆ count

- (NSUInteger) count
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

498{
499 return 1;
500}
501

◆ dealloc

- (void) dealloc
implementation

Definition at line 458 of file OOProbabilitySet.m.

462{
463 [_object release];
464
465 [super dealloc];
466}
467

◆ if

- if ((self=[super initPriv]))
implementation

Definition at line 452 of file OOProbabilitySet.m.

452 {
453 _object = [object retain];
454 _weight = fmax(weight, 0.0f);
455 }
456

◆ initWithObject:weight:

- (id) initWithObject: (id) object
weight: (float) weight 

◆ mutableCopyWithZone:

- (id) mutableCopyWithZone: (NSZone *) zone
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

510{
511 return [[OOConcreteMutableProbabilitySet allocWithZone:zone] initWithObjects:&_object weights:&_weight count:1];
512}
513

◆ propertyListRepresentation

- (NSDictionary *) propertyListRepresentation
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

470{
471 return [NSDictionary dictionaryWithObjectsAndKeys:
472 [NSArray arrayWithObject:_object], kObjectsKey,
473 [NSArray arrayWithObject:[NSNumber numberWithFloat:_weight]], kWeightsKey,
474 nil];
475}
476

◆ randomObject

- (id) randomObject
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

479{
480 return _object;
481}
482

◆ sumOfWeights

- (float) sumOfWeights
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

492{
493 return _weight;
494}
495

◆ weightForObject:

- (float) weightForObject: (id) object
implementation

Reimplemented from OOProbabilitySet.

Definition at line 458 of file OOProbabilitySet.m.

485{
486 if ([_object isEqual:object]) return _weight;
487 else return -1.0f;
488}
489

Member Data Documentation

◆ _object

- (id) _object
private

Definition at line 83 of file OOProbabilitySet.m.

◆ _weight

- (float) _weight
private

Definition at line 84 of file OOProbabilitySet.m.


The documentation for this class was generated from the following file: