Oolite
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 75 of file OOProbabilitySet.m.

Method Documentation

◆ allObjects

- (NSArray *) allObjects
implementation

Reimplemented from OOProbabilitySet.

Definition at line 442 of file OOProbabilitySet.m.

443{
444 return [NSArray arrayWithObject:_object];
445}

References allObjects.

Referenced by allObjects.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count

- (NSUInteger) count
implementation

Reimplemented from OOProbabilitySet.

Definition at line 437 of file OOProbabilitySet.m.

438{
439 return 1;
440}

References count.

Referenced by count.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Definition at line 404 of file OOProbabilitySet.m.

405{
406 [_object release];
407
408 [super dealloc];
409}

References dealloc.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ if

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

Definition at line 396 of file OOProbabilitySet.m.

396 {
397 _object = [object retain];
398 _weight = fmax(weight, 0.0f);
399 }

References _object, _weight, and OOProbabilitySet::initPriv.

Here is the call graph for this function:

◆ initWithObject:weight:

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

◆ mutableCopyWithZone:

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

Reimplemented from OOProbabilitySet.

Definition at line 447 of file OOProbabilitySet.m.

447 :(NSZone*)zone
448{
449 return [[OOConcreteMutableProbabilitySet allocWithZone:zone] initWithObjects:&_object weights:&_weight count:1];
450}

◆ propertyListRepresentation

- (NSDictionary *) propertyListRepresentation
implementation

Reimplemented from OOProbabilitySet.

Definition at line 411 of file OOProbabilitySet.m.

412{
413 return [NSDictionary dictionaryWithObjectsAndKeys:
414 [NSArray arrayWithObject:_object], kObjectsKey,
415 [NSArray arrayWithObject:[NSNumber numberWithFloat:_weight]], kWeightsKey,
416 nil];
417}

References propertyListRepresentation.

Referenced by propertyListRepresentation.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomObject

- (id) randomObject
implementation

Reimplemented from OOProbabilitySet.

Definition at line 419 of file OOProbabilitySet.m.

420{
421 return _object;
422}

References _object, and randomObject.

Referenced by randomObject.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sumOfWeights

- (float) sumOfWeights
implementation

Reimplemented from OOProbabilitySet.

Definition at line 432 of file OOProbabilitySet.m.

433{
434 return _weight;
435}

References _weight, and sumOfWeights.

Referenced by sumOfWeights.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ weightForObject:

- (float) weightForObject: (id) object
implementation

Reimplemented from OOProbabilitySet.

Definition at line 424 of file OOProbabilitySet.m.

424 :(id)object
425{
426 if ([_object isEqual:object])
427 return _weight;
428 else
429 return -1.0f;
430}

References _object, and _weight.

Member Data Documentation

◆ _object

- (id) _object
private

Definition at line 77 of file OOProbabilitySet.m.

Referenced by if, randomObject, and weightForObject:.

◆ _weight

- (float) _weight
private

Definition at line 78 of file OOProbabilitySet.m.

Referenced by if, sumOfWeights, and weightForObject:.


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