ALValuesStack Class Reference

Inherits from NSObject
Declared in ALValuesStack.h

Overview

The ValuesStack allows you to save any result of the Anyline computation. The actual result will then be compared to previous results and if there are enough equal values a new result will be available.

The new value is inticated with the hasNewResult property and can be once get with the newResult method.

All objects added to the stack must implement the isEqual and hash method.

The ValuesStack should always be used in compination with an @see ALObjectResultStackOperation.

  size

The size of the value stack. Determines how many results should be saved and then compared.

@property (nonatomic) NSInteger size

Declared In

ALValuesStack.h

  minEqualResults

The minimum number of equal results needed in the stack to get a new result. Must be smaller or equal the size property.

@property (nonatomic) NSInteger minEqualResults

Declared In

ALValuesStack.h

  lastCommitedResult

The last computed result of the values stack.

@property (nonatomic, strong) id lastCommitedResult

Declared In

ALValuesStack.h

  hasNewResult

The boolean which inticate that a new result was generated.

@property (nonatomic) BOOL hasNewResult

Declared In

ALValuesStack.h

  consecutivelyValue

Property if values stack allows the same result consecutively.

@property (nonatomic) BOOL consecutivelyValue

Declared In

ALValuesStack.h

  currentEqualCount

@property (nonatomic) NSInteger currentEqualCount

  currentEqualCountWithoutEmpty

@property (nonatomic) NSInteger currentEqualCountWithoutEmpty

– initWithSize:minimalEqualResults:allowSameValueConsecutively:

Initialises a new values stack with a certain size, minEqualResult and if the same value consecutively is allowed.

- (instancetype)initWithSize:(NSInteger)size minimalEqualResults:(NSInteger)minEqualResults allowSameValueConsecutively:(BOOL)consecutivelyValue

Parameters

size

The size of the ValuesStack.

minEqualResults

The minimum equal results needed for a new result.

consecutivelyValue

indicator if consective same results are allowed.

Return Value

new ValuesStack object.

Declared In

ALValuesStack.h

– addResult:

Adds a new result to the value stack. If the size of the value stack is reached a new result will be searched and if found with the hasNewResult communicated.

- (void)addResult:(id)result

Parameters

result

The result to add to the stack.

Discussion

If no new result is found the stack will be cleared.

If the stack has not reached the his size the value is added and nothing happens.

Declared In

ALValuesStack.h

– newResult

Returns a new result if the hasNewResult is true and nil otherwise.

- (id)newResult

Return Value

new found result.

Discussion

Warning: Result is only returned once.

Declared In

ALValuesStack.h