BinaryAnd

The asdk.condition.BinaryAnd class provides an implementation of the BinaryCondition interface that allows for more than one binary condition objects to be combined returning true only if all the binary conditions are true. The example below demonstrates how to use a BinaryAnd to determine if a number falls outside of a certain range of numbers (from 1 to 100).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
var greaterNumber : asdk.condition.BinaryCondition = new asdk.condition.GreaterNumber();
var lesserNumber : asdk.condition.BinaryCondition = new asdk.condition.BinaryNot( greaterNumber );

var isTwoLessThanOne = lesserNumber.execute( 2, 1 );
trace("isTwoLessThanOne: " + isTwoLessThanOne );
//displays isTwoLessThanOne: false in output window

var isTwoLessThanTwo = lesserNumber.execute( 2, 2 );
trace("isTwoLessThanTwo: " + isTwoLessThanTwo );
//displays isTwoLessThanTwo: false in output window

var isTwoLessThanThree = lesserNumber.execute( 2, 3 );
trace("isTwoLessThanThree: " + isTwoLessThanThree );
//displays isTwoLessThanThree: true in output window

When used in conjunction with another BinaryCondition, the BinaryNot class negates the result of that condition. In the case above a GreaterNumber object is passed into the BinaryNot constructor (line 2) so that each time the condition is executed, the GreaterNumber class is executed and then negated to determine if the first operand is less than the second operand. In this example only the last invocation returns true when 2 is compared to 3 on line 9.