PositiveNumber

The asdk.condition.PositiveNumber class is used to test for a positive number condition. It provides an implementation of the UnaryCondition interface that when executed will determine whether the operand passed to the execute method is positive. This allows for encapsulation of the logic for determining whether or not a number is positive. The example below demonstrates the use of this class:

1
2
3
4
5
6
7
8
9
10
11
12
13
var isPositiveCondition : UnaryCondition = new PositiveNumber();

var isNegativeOnePositive = isPositiveCondition.execute( -1 );
trace("isNegativeOnePositive: " + isNegativeOnePositive );
//displays isNegativeOnePositive: false in output window

var isZeroPositive = isPositiveCondition.execute( 0 );
trace("isZeroPositive: " + isZeroPositive );
//displays isZeroPositive: false in output window

var isOnePositive = isPositiveCondition.execute( 1 );
trace("isOnePositive: " + isOnePositive );
//displays isOnePositive: true in output window

In this example only the last call to the execute method returns true when the number one is tested as a positive number.