Operatorbinarybase binary operator base class
File: operatorbinarybase. js
// ----------- Binary operator base ------------- <br/> function operatorbinarybase () {<br/> This. derivefrom (New operatorbase (); <br/> This. set_classname ("operatoradd"); <br/> This. _ type = new binarytype ("undefined"); </P> <p> // get two numerical operands. <br/> This. _ gettwonumberoperands = function (operands) {<br/> $ assert (operands. length >=2); </P> <p> var right = operands. pop (), <br/> left = ope Rands. Pop (); </P> <p> If (! (Left. isnumber () | left. isboolean () <br/> throw new exception (this, "_ gettwonumberoperands", "left operand is not number or boolean type "); </P> <p> If (! (Right. isnumber () | right. isboolean () <br/> throw new exception (this, "_ gettwonumberoperands", "right operand is not number or boolean type "); </P> <p> return [left, right]; <br/>}; // _ gettwonumberoperands <br/>}; <br/>
This chapter is relatively simple. As a foreshadowing, there will be more in the future.