BinaryNot

The asdk.condition.BinaryNot class is used to negate another Binary Condition. As was mentioned previously in the GreaterNumber section, this class can be used to determine if the first operand is less than the second operand by combining GreaterThan with the BinaryNot class.

The example below demonstrates how to use these two classes together to extend the functionality of GreaterNumber:

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 12.