*************************************************************************

Value Generator - Token Period

************************************************************************
429953
final public static function SetTokenPeriod( int $period ) : void {
        
        self::SetConfigFromSetter(
                $period,
                self::akTokenPeriod,
                self::ValidateTokenPeriod( )
        );
        
    }
277322
function () {
        var generator = this.generator;

        if (!generator || !generator.x || !generator.y || !generator.z) {
            throw new Error('Invalid generator');
        }
        var xFunc = generator.x;
        var yFunc = generator.y;
        var zFunc = generator.z;
        var uRange = generator.u || [0, 1, 0.05];
        var vRange = generator.v || [0, 1, 0.05];

        var uNum = Math.floor((uRange[1] - uRange[0] + uRange[2]) / uRange[2]);
        var vNum = Math.floor((vRange[1] - vRange[0] + vRange[2]) / vRange[2]);

        if (!isFinite(uNum) || !isFinite(vNum)) {
            throw new Error('Infinite generator');
        }

        var vertexNum = uNum * vNum;
        this.attributes.position.init(vertexNum);
        this.attributes.texcoord0.init(vertexNum);

        var pos = [];
        var texcoord = [];
        var nVertex = 0;
        for (var j = 0; j < vNum; j++) {
            for (var i = 0; i < uNum; i++) {
                var u = i * uRange[2] + uRange[0];
                var v = j * vRange[2] + vRange[0];
                pos[0] = xFunc(u, v);
                pos[1] = yFunc(u, v);
                pos[2] = zFunc(u, v);

                texcoord[0] = i / (uNum - 1);
                texcoord[1] = j / (vNum - 1);

                this.attributes.position.set(nVertex, pos);
                this.attributes.texcoord0.set(nVertex, texcoord);
                nVertex++;
            }
        }

        var IndicesCtor = vertexNum > 0xffff ? Uint32Array : Uint16Array;
        var nIndices = (uNum - 1) * (vNum - 1) * 6;
        var indices = this.indices = new IndicesCtor(nIndices);

        var n = 0;
        for (var j = 0; j < vNum - 1; j++) {
            for (var i = 0; i < uNum - 1; i++) {
                var i2 = j * uNum + i;
                var i1 = (j * uNum + i + 1);
                var i4 = (j + 1) * uNum + i + 1;
                var i3 = (j + 1) * uNum + i;

                indices[n++] = i1;
                indices[n++] = i2;
                indices[n++] = i4;

                indices[n++] = i2;
                indices[n++] = i3;
                indices[n++] = i4;
            }
        }

        this.generateVertexNormals();
        this.updateBoundingBox();
    }
1239477
function parseNamedHues(value) {
        var tokens = value.split(/\s+/);
        var l = tokens.length;

        if (l < 1 || l > 2) {
            return false;
        }

        var t1 = tokens[l - 1].toLowerCase();

        if (!(t1 in BASE_HUE)) {
            return false;
        }

        var h1 = BASE_HUE[t1];

        // single-value syntax
        if (l === 1) {
            return h1;
        }

        // double-value syntax
        var h2;
        var t2 = tokens[0].toLowerCase();
        var hues;
        if (t2 in BASE_HUE) {
            h2 = BASE_HUE[t2];
            hues = fixHues(h1, h2);
            return hues ? (hues.h1 + hues.h2) / 2 : false;
        } else if (t2 in SPLASH_HUE) {
            h2 = SPLASH_HUE[t2];
            hues = fixHues(h1, h2);
            return hues ? (hues.h1 + (hues.h2 - hues.h1) / 4) : false;
        } else {
            var found = t2.match(/(\w+)\(\s*([^\)]+)\s*\)/i);
            if (!found) {
                return false;
            }
            t2 = found[1];
            if (t2 in SPLASH_HUE) {
                h2 = SPLASH_HUE[t2];
                hues = fixHues(h1, h2);
                var percent = DATATYPES[PERCENT].parse(found[2]);
                if (percent === false) {
                    return percent;
                }
                return hues ? (hues.h1 + (hues.h2 - hues.h1) * percent) : false;
            }
        }

        return false;
    }
1004900
function addTimeToArrayFromToken(token, input, config) {
        var a, b,
            datePartArray = config._a;

        switch (token) {
        // MONTH
        case 'M' : // fall through to MM
        case 'MM' :
            datePartArray[1] = (input == null) ? 0 : ~~input - 1;
            break;
        case 'MMM' : // fall through to MMMM
        case 'MMMM' :
            a = getLangDefinition(config._l).monthsParse(input);
            // if we didn't find a month name, mark the date as invalid.
            if (a != null) {
                datePartArray[1] = a;
            } else {
                config._isValid = false;
            }
            break;
        // DAY OF MONTH
        case 'D' : // fall through to DDDD
        case 'DD' : // fall through to DDDD
        case 'DDD' : // fall through to DDDD
        case 'DDDD' :
            if (input != null) {
                datePartArray[2] = ~~input;
            }
            break;
        // YEAR
        case 'YY' :
            datePartArray[0] = ~~input + (~~input > 68 ? 1900 : 2000);
            break;
        case 'YYYY' :
        case 'YYYYY' :
            datePartArray[0] = ~~input;
            break;
        // AM / PM
        case 'a' : // fall through to A
        case 'A' :
            config._isPm = ((input + '').toLowerCase() === 'pm');
            break;
        // 24 HOUR
        case 'H' : // fall through to hh
        case 'HH' : // fall through to hh
        case 'h' : // fall through to hh
        case 'hh' :
            datePartArray[3] = ~~input;
            break;
        // MINUTE
        case 'm' : // fall through to mm
        case 'mm' :
            datePartArray[4] = ~~input;
            break;
        // SECOND
        case 's' : // fall through to ss
        case 'ss' :
            datePartArray[5] = ~~input;
            break;
        // MILLISECOND
        case 'S' :
        case 'SS' :
        case 'SSS' :
            datePartArray[6] = ~~ (('0.' + input) * 1000);
            break;
        // UNIX TIMESTAMP WITH MS
        case 'X':
            config._d = new Date(parseFloat(input) * 1000);
            break;
        // TIMEZONE
        case 'Z' : // fall through to ZZ
        case 'ZZ' :
            config._useUTC = true;
            a = (input + '').match(parseTimezoneChunker);
            if (a && a[1]) {
                config._tzh = ~~a[1];
            }
            if (a && a[2]) {
                config._tzm = ~~a[2];
            }
            // reverse offsets
            if (a && a[0] === '+') {
                config._tzh = -config._tzh;
                config._tzm = -config._tzm;
            }
            break;
        }

        // if the input is null, the date is not valid
        if (input == null) {
            config._isValid = false;
        }
    }
103690
def generate_single_return_period(args):
    
    qout_file, return_period_file, rivid_index_list, step, num_years, \
        method, mp_lock = args

    skewvals = [-3.0, -2.8, -2.6, -2.4, -2.2, -2.0, -1.8, -1.6, -1.4, -1.2,
                -1.0, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 1.0,
                1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0]
    kfac2 = [0.396, 0.384, 0.368, 0.351, 0.33, 0.307, 0.282, 0.254, 0.225,
             0.195, 0.164, 0.132, 0.099, 0.066, 0.033, 0, -0.033, -0.066,
             -0.099, -0.132, -0.164, -0.195, -0.225, -0.254, -0.282, -0.307,
             -0.33, -0.351, -0.368, -0.384, -0.396]
    kfac10 = [0.66, 0.702, 0.747, 0.795, 0.844, 0.895, 0.945, 0.994, 1.041,
              1.086, 1.128, 1.166, 1.2, 1.231, 1.258, 1.282, 1.301, 1.317,
              1.328, 1.336, 1.34, 1.34, 1.337, 1.329, 1.318, 1.302, 1.284,
              1.262, 1.238, 1.21, 1.18]
    kfac25 = [.666, .712, .764, .823, .888, .959, 1.035, 1.116, 1.198, 1.282,
              1.366, 1.448, 1.528, 1.606, 1.680, 1.751, 1.818, 1.880, 1.939,
              1.993, 2.043, 2.087, 2.128, 2.163, 2.193, 2.219, 2.240, 2.256,
              2.267, 2.275, 2.278]
    kfac50 = [0.666, 0.714, 0.768, 0.83, 0.9, 0.98, 1.069, 1.166, 1.27, 1.379,
              1.492, 1.606, 1.72, 1.834, 1.945, 2.054, 2.159, 2.261, 2.359,
              2.453, 2.542, 2.626, 2.706, 2.78, 2.848, 2.912, 2.97, 3.023,
              3.071, 3.114, 3.152]
    kfac100 = [0.667, 0.714, 0.769, 0.832, 0.905, 0.99, 1.087, 1.197, 1.318,
               1.499, 1.588, 1.733, 1.88, 2.029, 2.178, 2.326, 2.472, 2.615,
               2.755, 2.891, 3.022, 3.149, 3.271, 3.388, 3.499, 3.605, 3.705,
               3.8, 3.889, 3.973, 4.051]

    with RAPIDDataset(qout_file) as qout_nc_file:
        # get index of return period data
        if method == 'weibull':
            rp_index_20 = int((num_years + 1)/20.0)
            rp_index_10 = int((num_years + 1)/10.0)
            rp_index_2 = int((num_years + 1)/2.0)

        if method == 'weibull':
            return_20_array = np.zeros(len(rivid_index_list))
        elif method == 'gumble':
            return_100_array = np.zeros(len(rivid_index_list))
            return_50_array = np.zeros(len(rivid_index_list))
            return_20_array = np.zeros(len(rivid_index_list))
        elif method == 'log_pearson':
            return_100_array = np.zeros(len(rivid_index_list))
            return_50_array = np.zeros(len(rivid_index_list))
            return_25_array = np.zeros(len(rivid_index_list))
        return_10_array = np.zeros(len(rivid_index_list))
        return_2_array = np.zeros(len(rivid_index_list))
        max_flow_array = np.zeros(len(rivid_index_list))

        # iterate through rivids to generate return periods
        for iter_idx, rivid_index in enumerate(rivid_index_list):
            filtered_flow_data = qout_nc_file.get_qout_index(
                rivid_index,
                pd_filter="{0}D".format(step),
                filter_mode="max")
            sorted_flow_data = np.sort(filtered_flow_data)[:num_years:-1]
            max_flow = sorted_flow_data[0]
            if max_flow < 0.01:
                log("Return period data < 0.01 generated for rivid {0}"
                    .format(qout_nc_file.qout_nc.variables[
                        qout_nc_file.river_id_dimension][rivid_index]),
                    "WARNING")
            max_flow_array[iter_idx] = max_flow

            if method == 'weibull':
                return_20_array[iter_idx] = sorted_flow_data[rp_index_20]
                return_10_array[iter_idx] = sorted_flow_data[rp_index_10]
                return_2_array[iter_idx] = sorted_flow_data[rp_index_2]

            elif method == 'gumble':
                mean_flow = np.mean(filtered_flow_data)
                stddev = np.std(filtered_flow_data)
                return_100_array[iter_idx] = mean_flow + 3.14*stddev
                return_50_array[iter_idx] = mean_flow + 2.59*stddev
                return_20_array[iter_idx] = mean_flow + 1.87*stddev
                return_10_array[iter_idx] = mean_flow + 1.3*stddev
                return_2_array[iter_idx] = mean_flow - .164*stddev

            elif method == 'log_pearson':
                log_flow = np.log10(filtered_flow_data[filtered_flow_data > 0])
                if len(log_flow) <= 0:
                    continue
                mean_log_flow = np.mean(log_flow)
                std_log_flow = np.std(log_flow)
                log_flow_array = np.array(log_flow)
                skew = (num_years * (np.sum(
                    np.power((log_flow_array - mean_log_flow), 3)))) / \
                    ((num_years - 1) * (num_years - 2) * std_log_flow ** 3)
                k2 = np.interp(skew, skewvals, kfac2)
                k10 = np.interp(skew, skewvals, kfac10)
                k25 = np.interp(skew, skewvals, kfac25)
                k50 = np.interp(skew, skewvals, kfac50)
                k100 = np.interp(skew, skewvals, kfac100)
                return_100_array[iter_idx] = \
                    np.power(10, (mean_log_flow + k100*std_log_flow))
                return_50_array[iter_idx] = \
                    np.power(10, (mean_log_flow + k50*std_log_flow))
                return_25_array[iter_idx] = \
                    np.power(10, (mean_log_flow + k25*std_log_flow))
                return_10_array[iter_idx] = \
                    np.power(10, (mean_log_flow + k10*std_log_flow))
                return_2_array[iter_idx] = \
                    np.power(10, (mean_log_flow + k2*std_log_flow))

        mp_lock.acquire()
        return_period_nc = Dataset(return_period_file, 'a')
        return_period_nc.variables['max_flow'][rivid_index_list] = \
            max_flow_array
        if method == 'weibull':
            return_period_nc.variables['return_period_20'][
                rivid_index_list] = return_20_array
        elif method in 'gumble':
            return_period_nc.variables['return_period_100'][
                rivid_index_list] = return_100_array
            return_period_nc.variables['return_period_50'][
                rivid_index_list] = return_50_array
            return_period_nc.variables['return_period_20'][
                rivid_index_list] = return_20_array
        elif method == 'log_pearson':
            return_period_nc.variables['return_period_100'][
                rivid_index_list] = return_100_array
            return_period_nc.variables['return_period_50'][
                rivid_index_list] = return_50_array
            return_period_nc.variables['return_period_25'][
                rivid_index_list] = return_25_array
        return_period_nc.variables['return_period_10'][
            rivid_index_list] = return_10_array
        return_period_nc.variables['return_period_2'][
            rivid_index_list] = return_2_array
        return_period_nc.close()
        mp_lock.release()
4405
function prepareTemplates(templates){
  var valueGeneratorsDict = {
    select: function(obj){
      var types = {
        random:function(){
          return obj.choice[Math.floor(Math.random() * obj.choice.length)];
        },
        liner: function(){
          var el = obj.choice.shift();
          obj.choice.push(el);
          return el;
        },
        random_unique: function(){
          function shuffle(o) {
            for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
            return o;
          };
          if(!obj.randomized){obj.randomized = shuffle(obj.choice.slice());}
          var el = obj.randomized.shift();
          if(el===undefined){
            log.notEnoughChoice('random_unique','choice');
            process.exit()
          }
          return el;
        }
      }
      if(!types[obj.type]){
        return log.noTemplateType('select', obj.type, Object.keys(types))
      }
      return types[obj.type]
    },
    lipsum: function(obj){
      if(!(obj.max_char_length&&obj.min_char_length)){
        return log.missingSettings('lipsum', '', ['max_char_length','mim_char_length'])
      }
      var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
      return function(){
        var chars = Math.floor(Math.random()*(obj.max_char_length-obj.min_char_length)+obj.min_char_length)
        var str = lorem.slice(0, chars)
        while(str.length < chars){
          var len = chars - str.length
          str += ' '+lorem.slice(0, len)
        }
        return str
      }
    },
    number: function(obj){
      var types = {
        random:function(){
          return Math.floor(Math.random()*(obj.max_num-obj.min_num)+obj.min_num);
        },
        incremental: function(){
          tempdata += obj.increments
          return tempdata;
        }
      }

      if(!types[obj.type]){
        return log.noTemplateType('number', obj.type, Object.keys(types))
      }
      if(obj.type == 'random' && !(obj.max_num&&obj.min_num)){
        return log.missingSettings('number', 'random', ['max_num','min_num'])
      }
      if(obj.type == 'incremental'){
        if(!(obj.starting_num&&obj.increments)){
          return log.missingSettings('number', 'incremental', ['starting_num','increments'])
        }
        var tempdata = this[obj.id] = obj.starting_num - obj.increments
      }

      return types[obj.type]
    },
    datetime: function(obj){
      var types = {
        random:function(){
          return output[obj.output_format](new Date(Math.floor(Math.random()*(max-min)+min)));
        },
        incremental: function(){
          tempdata += obj.increments
          return output[obj.output_format](new Date(tempdata));
        }
      }
      var output = {
        toString: function(d){ return d.toString(); },
        toDateString: function(d){ return d.toDateString(); },
        toISOString: function(d){ return d.toISOString(); },
        toJSON: function(d){ return d.toJSON(); },
        toGMTString: function(d){ return d.toGMTString(); },
        toLocaleDateString: function(d){ return d.toLocaleDateString(); },
        toLocaleString: function(d){ return d.toLocaleString(); },
        toLocaleTimeString: function(d){ return d.toLocaleTimeString(); },
        toTimeString: function(d){ return d.toTimeString(); },
        toUTCString: function(d){ return d.toUTCString(); },
        toYMDString:function(d){
          return d.toJSON().split('T')[0]
        }
      }

      if(!types[obj.type]){
        return log.noTemplateType('date', obj.type, Object.keys(types))
      }
      if(obj.type == 'random'){
        if(!(obj.max_datetime&&obj.min_datetime&&obj.output_format)){
          return log.missingSettings('date', 'random', ['max_datetime','min_datetime','output_format'])
        }
        var min = Date.parse(obj.min_datetime)
        var max = Date.parse(obj.max_datetime)
        if(isNaN(min)){
          return log.notParseableDatetime('min_datetime', obj.min_datetime)
        }else if(isNaN(max)){
          return log.notParseableDatetime('max_datetime', obj.max_datetime)
        }
      }
      if(obj.type == 'incremental'){
        if(!(obj.starting_datetime&&obj.increments&&obj.output_format)){
          return log.missingSettings('number', 'incremental', ['starting_datetime','increments','output_format'])
        }
        var tempdata = this[obj.id] = Date.parse(obj.starting_datetime) - obj.increments
        if(isNaN(tempdata)){
          return log.notParseableDatetime('starting_datetime', obj.starting_datetime)
        }
      }

      return types[obj.type]
    }
  }

  /*
  Recursively iterate each key in template object to find `stub_type` key.
  If the object has `stub_type` key, replace itself with corresponding
  function in valueGenerators valid
  Arg:
    - obj (Object)
  */
  function parseTemplate(obj) {
    for (var key in obj) {
      if (obj[key] !== null && typeof(obj[key])=="object") {
        if(obj[key].stub_type){
          if(!valueGeneratorsDict[obj[key].stub_type]){
            log.stubTypeNotFound(obj[key].stub_type)
          }else{
            obj[key].id = crypto.randomBytes(16).toString('hex');
            obj[key] = valueGeneratorsDict[obj[key].stub_type](obj[key])
          }
        }else{
          parseTemplate(obj[key]);
        }
      }
    }
  }

  if(templates){
    Object.keys(templates).map(function(t){
      parseTemplate(templates[t]);
    })
    return templates;
  }else{
    return [];
  }
}
1285491
function(x) {
      var b = prng.getBytesSync(x.length);
      for(var i = 0; i < x.length; ++i) {
        x[i] = b.charCodeAt(i);
      }
    }
999690
function perfFindInterlacedInserts(multiplier) {
  var start, end;
  var totalTimes = [];
  var totalMS = 0;

  var loopIterations = arraySize;
  if (typeof (multiplier) != "undefined") {
    loopIterations = loopIterations * multiplier;
  }

  for (var idx = 0; idx < loopIterations; idx++) {
    var customidx = Math.floor(Math.random() * arraySize) + 1;

    start = process.hrtime();
    var results = samplecoll.find({
      'customId': customidx
    });
    // insert junk record, now (outside timing routine) to force index rebuild
    var obj = samplecoll.insert({
        customId: 999,
        val: 999,
        val2: 999,
        val3: "more data 1234567890"
    });  
    
    end = process.hrtime(start);
    totalTimes.push(end);
    
  }

  for (var idx = 0; idx < totalTimes.length; idx++) {
    totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1] / 1e6;
  }

  totalMS = totalMS.toFixed(2);
  var rate = loopIterations * 1000 / totalMS;
  rate = rate.toFixed(2);
  console.log("interlaced inserts + coll.find() : " + totalMS + "ms (" + rate + " ops/s) " + loopIterations + " iterations");
  
}
450665
public final void mTHEN() throws RecognitionException {
		try {
			int _type = THEN;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// druidG.g:644:6: ( ( 'THEN' | 'then' ) )
			// druidG.g:644:8: ( 'THEN' | 'then' )
			{
			// druidG.g:644:8: ( 'THEN' | 'then' )
			int alt32=2;
			int LA32_0 = input.LA(1);
			if ( (LA32_0=='T') ) {
				alt32=1;
			}
			else if ( (LA32_0=='t') ) {
				alt32=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 32, 0, input);
				throw nvae;
			}

			switch (alt32) {
				case 1 :
					// druidG.g:644:9: 'THEN'
					{
					match("THEN"); 

					}
					break;
				case 2 :
					// druidG.g:644:18: 'then'
					{
					match("then"); 

					}
					break;

			}

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
907632
function Token(p) {


  this.type = p.type;
  this.value = p.value;
  this.start = p.start;
  this.end = p.end;
  if (p.options.locations) this.loc = new _locutil.SourceLocation(p, p.startLoc, p.endLoc);
  if (p.options.ranges) this.range = [p.start, p.end];
}
1150162
function _init() {
  // create padding
  _padding = String.fromCharCode(128);
  _padding += forge.util.fillString(String.fromCharCode(0x00), 64);

  // g values
  _g = [
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
    1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12,
    5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2,
    0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9];

  // rounds table
  _r = [
    7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,
    5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,
    4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,
    6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21];

  // get the result of abs(sin(i + 1)) as a 32-bit integer
  _k = new Array(64);
  for(var i = 0; i < 64; ++i) {
    _k[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 0x100000000);
  }

  // now initialized
  _initialized = true;
}
57006
function lcg( val ) {
	var seed;
	if ( arguments.length ) {
		if ( typeof val !== 'number' || val !== val || val % 1 !== 0 || val < 1 ) {
			throw new TypeError( 'lcg()::invalid input argument. Seed must be a positive integer.' );
		}
		seed = val;
	} else {
		seed = Date.now() % 100000000;
	}
	/**
	* FUNCTION: lcg( [N] )
	*	Linear congruential pseudorandom number generator.
	*
	* @param {Number} [N] - number of pseudorandom numbers to return
	* @returns {Number|Array} pseudorandom floating-point number(s) between 0 and 1
	*/
	return function lcg( N ) {
		var arr,
			rand;
		if ( !arguments.length ) {
			seed = seed ^ MASK;
			seed = ( A * seed ) % M;
			rand = seed / M;
			seed = seed ^ MASK;
			return rand;
		}
		if ( typeof N !== 'number' || N !== N || N%1 !== 0 || N < 1 ) {
			throw new TypeError( 'lcg()::invalid input argument. Array length must be a positive integer.' );
		}
		arr = new Array( N );
		for ( var i = 0; i < N; i++ ) {
			seed = seed ^ MASK;
			seed = ( A * seed ) % M;
			arr[ i ] = seed / M;
			seed = seed ^ MASK;
		}
		return arr;
	};
}
918288
function (token, charset) {
        var arity = [ 1, 1 ];
        if (   token.len >= 5
            && token.peek(0) === "{"
            && token.peek(1).match(/^[0-9]+$/)
            && token.peek(2) === ","
            && token.peek(3).match(/^(?:[0-9]+|oo)$/)
            && token.peek(4) === "}"          ) {
            arity = [
                parseInt(token.peek(1), 10),
                (  token.peek(3) === "oo"
                 ? Number.MAX_VALUE
                 : parseInt(token.peek(3), 10))
            ];
            token.skip(5);
        }
        else if (
               token.len >= 1
            && token.peek().length === 1
            && charset.indexOf(token.peek()) >= 0) {
            var c = token.peek();
            switch (c) {
                case "?": arity = [ 0, 1 ];                break;
                case "*": arity = [ 0, Number.MAX_VALUE ]; break;
                case "+": arity = [ 1, Number.MAX_VALUE ]; break;
            }
            token.skip();
        }
        return arity;
    }
59461
function preparePeriod(period, value, year) {

    var range;
    var subUnit;
    var start;
    var length;
    var unit;

    switch (period) {
      case 'year':
        unit = 'month';
        break;
      case 'month':
        unit = 'dayOfYear';
        break;
      case 'dayOfYear':
        unit = 'hourOfYear';
        break;
    }

    var result = {
      year: year,
      period: period,
      unit: unit
    };

    var utc = moment().utc();

    if (year) {
      utc.year(year);
    } else {
      year = utc.year();
    }

    if (value || value ===0) {
      utc[period](value);
    } else {
      value = utc[period]();
    }

    result.value = value;
    result.period = period;

    switch (unit) {

      case 'month':
        switch (period) {
          case 'year':
            range = _.range(12);
            break;

          default:
        }

        subUnit = 'dayOfYear';
        break;

      case 'dayOfYear':

        switch (period) {
          case 'month':
            start = utc.month(value).date(1).dayOfYear();
            length = utc.month(value).daysInMonth();

            range = _.range(start, start + length);
            break;

          default:
        }

        subUnit = 'hourOfYear';
        break;

      case 'hourOfYear':

        switch (period) {
          case 'dayOfYear':
            start = utc.dayOfYear(value).hour(0).hourOfYear();
            length = 24;

            range = _.range(start, start + length);
            break;

          default:
        }
        break;
    }

    result.subUnit = subUnit;

    if (!range) {

      var err = new Error('Could not calculate the range');
      err.statusCode = 400;
      err.code = 'NO_RANGE_SET';

      throw err;
    }

    return {
      unit: unit,
      range: range,
      year: year,
      result: result
    };

  }
339172
function processValuesFromContext(node, params, msg, varList) {
                let pMsg = {};
                Object.assign(pMsg, params);
                varList.forEach((varItem) => {
                    if (varItem.type === undefined || params[varItem.type] === undefined) {
                        pMsg[varItem.name] = params[varItem.name];
                    } else if (params[varItem.type] === 'flow' || params[varItem.type] === 'global') {
                        pMsg[varItem.name] = RED.util.evaluateNodeProperty(params[varItem.name], params[varItem.type], node, msg);
                        pMsg[varItem.type] = params[varItem.type];
                        console.log('Inside flow or global');
                        console.log(varItem.name + ' - - ' + pMsg[varItem.name]);
                    } else {
                        pMsg[varItem.name] = params[varItem.name];
                        pMsg[varItem.type] = params[varItem.type];
                    }
                });
                return pMsg;
            }
585790
@Override
	public void mTokens() throws RecognitionException {
		// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:8: ( WS | FLOAT | HEX | DECIMAL | STRING | TIME_INTERVAL | BOOL | NULL | AT | PLUS_ASSIGN | MINUS_ASSIGN | MULT_ASSIGN | DIV_ASSIGN | AND_ASSIGN | OR_ASSIGN | XOR_ASSIGN | MOD_ASSIGN | UNIFY | DECR | INCR | ARROW | SEMICOLON | COLON | EQUALS | NOT_EQUALS | GREATER_EQUALS | LESS_EQUALS | GREATER | LESS | EQUALS_ASSIGN | LEFT_PAREN | RIGHT_PAREN | LEFT_SQUARE | RIGHT_SQUARE | LEFT_CURLY | RIGHT_CURLY | COMMA | DOT | NULL_SAFE_DOT | DOUBLE_AMPER | DOUBLE_PIPE | QUESTION | NEGATION | TILDE | PIPE | AMPER | XOR | MOD | STAR | MINUS | PLUS | HASH | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT | ID | DIV | MISC )
		int alt63=57;
		alt63 = dfa63.predict(input);
		switch (alt63) {
			case 1 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:10: WS
				{
				mWS(); if (state.failed) return;

				}
				break;
			case 2 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:13: FLOAT
				{
				mFLOAT(); if (state.failed) return;

				}
				break;
			case 3 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:19: HEX
				{
				mHEX(); if (state.failed) return;

				}
				break;
			case 4 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:23: DECIMAL
				{
				mDECIMAL(); if (state.failed) return;

				}
				break;
			case 5 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:31: STRING
				{
				mSTRING(); if (state.failed) return;

				}
				break;
			case 6 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:38: TIME_INTERVAL
				{
				mTIME_INTERVAL(); if (state.failed) return;

				}
				break;
			case 7 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:52: BOOL
				{
				mBOOL(); if (state.failed) return;

				}
				break;
			case 8 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:57: NULL
				{
				mNULL(); if (state.failed) return;

				}
				break;
			case 9 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:62: AT
				{
				mAT(); if (state.failed) return;

				}
				break;
			case 10 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:65: PLUS_ASSIGN
				{
				mPLUS_ASSIGN(); if (state.failed) return;

				}
				break;
			case 11 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:77: MINUS_ASSIGN
				{
				mMINUS_ASSIGN(); if (state.failed) return;

				}
				break;
			case 12 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:90: MULT_ASSIGN
				{
				mMULT_ASSIGN(); if (state.failed) return;

				}
				break;
			case 13 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:102: DIV_ASSIGN
				{
				mDIV_ASSIGN(); if (state.failed) return;

				}
				break;
			case 14 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:113: AND_ASSIGN
				{
				mAND_ASSIGN(); if (state.failed) return;

				}
				break;
			case 15 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:124: OR_ASSIGN
				{
				mOR_ASSIGN(); if (state.failed) return;

				}
				break;
			case 16 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:134: XOR_ASSIGN
				{
				mXOR_ASSIGN(); if (state.failed) return;

				}
				break;
			case 17 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:145: MOD_ASSIGN
				{
				mMOD_ASSIGN(); if (state.failed) return;

				}
				break;
			case 18 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:156: UNIFY
				{
				mUNIFY(); if (state.failed) return;

				}
				break;
			case 19 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:162: DECR
				{
				mDECR(); if (state.failed) return;

				}
				break;
			case 20 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:167: INCR
				{
				mINCR(); if (state.failed) return;

				}
				break;
			case 21 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:172: ARROW
				{
				mARROW(); if (state.failed) return;

				}
				break;
			case 22 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:178: SEMICOLON
				{
				mSEMICOLON(); if (state.failed) return;

				}
				break;
			case 23 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:188: COLON
				{
				mCOLON(); if (state.failed) return;

				}
				break;
			case 24 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:194: EQUALS
				{
				mEQUALS(); if (state.failed) return;

				}
				break;
			case 25 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:201: NOT_EQUALS
				{
				mNOT_EQUALS(); if (state.failed) return;

				}
				break;
			case 26 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:212: GREATER_EQUALS
				{
				mGREATER_EQUALS(); if (state.failed) return;

				}
				break;
			case 27 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:227: LESS_EQUALS
				{
				mLESS_EQUALS(); if (state.failed) return;

				}
				break;
			case 28 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:239: GREATER
				{
				mGREATER(); if (state.failed) return;

				}
				break;
			case 29 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:247: LESS
				{
				mLESS(); if (state.failed) return;

				}
				break;
			case 30 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:252: EQUALS_ASSIGN
				{
				mEQUALS_ASSIGN(); if (state.failed) return;

				}
				break;
			case 31 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:266: LEFT_PAREN
				{
				mLEFT_PAREN(); if (state.failed) return;

				}
				break;
			case 32 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:277: RIGHT_PAREN
				{
				mRIGHT_PAREN(); if (state.failed) return;

				}
				break;
			case 33 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:289: LEFT_SQUARE
				{
				mLEFT_SQUARE(); if (state.failed) return;

				}
				break;
			case 34 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:301: RIGHT_SQUARE
				{
				mRIGHT_SQUARE(); if (state.failed) return;

				}
				break;
			case 35 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:314: LEFT_CURLY
				{
				mLEFT_CURLY(); if (state.failed) return;

				}
				break;
			case 36 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:325: RIGHT_CURLY
				{
				mRIGHT_CURLY(); if (state.failed) return;

				}
				break;
			case 37 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:337: COMMA
				{
				mCOMMA(); if (state.failed) return;

				}
				break;
			case 38 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:343: DOT
				{
				mDOT(); if (state.failed) return;

				}
				break;
			case 39 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:347: NULL_SAFE_DOT
				{
				mNULL_SAFE_DOT(); if (state.failed) return;

				}
				break;
			case 40 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:361: DOUBLE_AMPER
				{
				mDOUBLE_AMPER(); if (state.failed) return;

				}
				break;
			case 41 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:374: DOUBLE_PIPE
				{
				mDOUBLE_PIPE(); if (state.failed) return;

				}
				break;
			case 42 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:386: QUESTION
				{
				mQUESTION(); if (state.failed) return;

				}
				break;
			case 43 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:395: NEGATION
				{
				mNEGATION(); if (state.failed) return;

				}
				break;
			case 44 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:404: TILDE
				{
				mTILDE(); if (state.failed) return;

				}
				break;
			case 45 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:410: PIPE
				{
				mPIPE(); if (state.failed) return;

				}
				break;
			case 46 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:415: AMPER
				{
				mAMPER(); if (state.failed) return;

				}
				break;
			case 47 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:421: XOR
				{
				mXOR(); if (state.failed) return;

				}
				break;
			case 48 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:425: MOD
				{
				mMOD(); if (state.failed) return;

				}
				break;
			case 49 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:429: STAR
				{
				mSTAR(); if (state.failed) return;

				}
				break;
			case 50 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:434: MINUS
				{
				mMINUS(); if (state.failed) return;

				}
				break;
			case 51 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:440: PLUS
				{
				mPLUS(); if (state.failed) return;

				}
				break;
			case 52 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:445: HASH
				{
				mHASH(); if (state.failed) return;

				}
				break;
			case 53 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:450: C_STYLE_SINGLE_LINE_COMMENT
				{
				mC_STYLE_SINGLE_LINE_COMMENT(); if (state.failed) return;

				}
				break;
			case 54 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:478: MULTI_LINE_COMMENT
				{
				mMULTI_LINE_COMMENT(); if (state.failed) return;

				}
				break;
			case 55 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:497: ID
				{
				mID(); if (state.failed) return;

				}
				break;
			case 56 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:500: DIV
				{
				mDIV(); if (state.failed) return;

				}
				break;
			case 57 :
				// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:1:504: MISC
				{
				mMISC(); if (state.failed) return;

				}
				break;

		}
	}
175119
void put(ChronoElement<?> element, int v) {

        int pos;
        Object current;
        Object[] keys = this.keys;

        if (keys == null) {
            if (element == PlainDate.YEAR) {
                if (this.duplicateKeysAllowed || (this.ints[0] == Integer.MIN_VALUE) || (this.ints[0] == v)) {
                    this.ints[0] = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainDate.MONTH_AS_NUMBER) {
                if (this.duplicateKeysAllowed || (this.ints[1] == Integer.MIN_VALUE) || (this.ints[1] == v)) {
                    this.ints[1] = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainDate.DAY_OF_MONTH) {
                if (this.duplicateKeysAllowed || (this.ints[2] == Integer.MIN_VALUE) || (this.ints[2] == v)) {
                    this.ints[2] = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.DIGITAL_HOUR_OF_DAY) {
                if (this.duplicateKeysAllowed || (this.len == Integer.MIN_VALUE) || (this.len == v)) {
                    this.len = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.MINUTE_OF_HOUR) {
                if (this.duplicateKeysAllowed || (this.mask == Integer.MIN_VALUE) || (this.mask == v)) {
                    this.mask = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.SECOND_OF_MINUTE) {
                if (this.duplicateKeysAllowed || (this.threshold == Integer.MIN_VALUE) || (this.threshold == v)) {
                    this.threshold = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else if (element == PlainTime.NANO_OF_SECOND) {
                if (this.duplicateKeysAllowed || (this.count == Integer.MIN_VALUE) || (this.count == v)) {
                    this.count = v;
                } else {
                    throw new AmbivalentValueException(element);
                }
            } else {
                Map<ChronoElement<?>, Object> m = this.map;
                if (m == null) {
                    m = new HashMap<>();
                    this.map = m;
                }
                Object newValue = Integer.valueOf(v);
                if (this.duplicateKeysAllowed || !m.containsKey(element) || newValue.equals(m.get(element))) {
                    m.put(element, newValue);
                    return;
                } else {
                    throw new AmbivalentValueException(element);
                }
            }
            return;
        }

        if (!((current = keys[pos = (mix(element.hashCode()) & this.mask)]) == null)) {
            if (current.equals(element)) {
                if (this.duplicateKeysAllowed || (this.ints[pos] == v)) {
                    this.ints[pos] = v;
                    return;
                } else {
                    throw new AmbivalentValueException(element);
                }
            }
            while (!((current = keys[pos = (pos + 1) & this.mask]) == null)) {
                if (current.equals(element)) {
                    if (this.duplicateKeysAllowed || (this.ints[pos] == v)) {
                        this.ints[pos] = v;
                        return;
                    } else {
                        throw new AmbivalentValueException(element);
                    }
                }
            }
        }

        keys[pos] = element;
        this.ints[pos] = v;

        if (this.count++ >= this.threshold) {
            rehash(arraySize(this.count));
        }

    }