"use strict"; var LeafMatchExpression = require('./LeafMatchExpression'); // Autogenerated by cport.py on 2013-09-17 14:37 var ModMatchExpression = module.exports = function ModMatchExpression(){ base.call(this); this._matchType = 'MOD'; }, klass = ModMatchExpression, base = LeafMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}}); // File: expression_leaf.h lines: 210-210 proto._divisor = undefined; // File: expression_leaf.h lines: 211-211 proto._remainder = undefined; /** * * Writes a debug string for this object * @method debugString * @param level * */ proto.debugString = function debugString(level) { // File: expression_leaf.cpp lines: 253-261 return this._debugAddSpace( level ) + this.path() + " mod " + this._divisor + " % x == " + this._remainder + (this.getTag() ? " " + this.getTag().debugString() : '') + "\n"; }; /** * * checks if this expression is == to the other * @method equivalent * @param other * */ proto.equivalent = function equivalent(other) { // File: expression_leaf.cpp lines: 264-272 if(other._matchType != 'MOD') return false; return this.path() == other.path() && this._divisor == other._divisor && this._remainder == other._remainder; }; /** * * Return the _divisor property * @method getDivisor * */ proto.getDivisor = function getDivisor(){ // File: expression_leaf.h lines: 206-205 return this._divisor; }; /** * * Return the _remainder property * @method getRemainder * */ proto.getRemainder = function getRemainder( /* */ ){ // File: expression_leaf.h lines: 207-206 return this._remainder; }; /** * * Initialize the necessary items * @method init * @param path * @param type * */ proto.init = function init(path,divisor,remainder) { // File: expression_leaf.cpp lines: 239-244 if (divisor === 0 ){ return {'code':'BAD_VALUE', 'desc':'Divisor cannot be 0'}; } this._divisor = divisor; this._remainder = remainder; return this.initPath( path ); }; /** * * Check if the input element matches * @method matchesSingleElement * @param e * */ proto.matchesSingleElement = function matchesSingleElement(e) { // File: expression_leaf.cpp lines: 247-250 if(typeof(e) != 'number') { return false; } return (e % this._divisor) == this._remainder; }; /** * * clone this instance to a new one * @method shallowClone * */ proto.shallowClone = function shallowClone(){ // File: expression_leaf.h lines: 194-197 var e = new ModMatchExpression(); e.init(this.path(),this._divisor, this._remainder); return e; };