设置复合分词等级 ($level = 0,15)
14711
function set_multi($level) {
        $level = (intval($level) << 12);
        $this->_mode &= ~PSCWS4_MULTI_MASK;
        if ($level & PSCWS4_MULTI_MASK) $this->_mode |= $level;
    }
1077216
public function getLevelNumericalValue($level) {
		$level = strtolower($level);
		if (isset($this->levelValues[$level])) {
			return $this->levelValues[$level];
		}

		return 0;
	}
1135902
private int calcFu() {
        if (normalYakuList.size() == 0) {
            return 0;
        }
        if (personalSituation == null || generalSituation == null) {
            return 20;
        }
        // 特例の平和ツモと七対子の符
        if (normalYakuList.contains(PINFU) && normalYakuList.contains(TSUMO)) {
            return 20;
        }
        if (normalYakuList.contains(CHITOITSU)) {
            return 25;
        }

        int tmpFu = 20;
        // 門前ロンなら+10
        tmpFu += calcFuByAgari();

        // 各メンツの種類による加符
        for (Mentsu mentsu : comp.getAllMentsu()) {
            tmpFu += mentsu.getFu();
        }

        tmpFu += calcFuByWait(comp, hands.getLast());
        tmpFu += calcFuByJanto();

        return tmpFu;
    }
1065382
protected static function processNum(&$value, $options)
    {
        if (isset($options['min']) && $options['min'] >= 0) {
            $ic = $value < $options['min'] ? 0 : 1;
        } else {
            $ic = 1;
        }

        if (isset($options['max']) && $options['max']) {
            if (isset($options['min'])) {
                $options['max'] = $options['max'] > $options['min'] ? $options['max'] : $options['min'];
            }
            $ac = $value > $options['max'] ? 0 : 1;
        } else {
            $ac = 1;
        }

        // 满足上限
        if ($ac) {
            // 不满足下限
            if (!$ic) {
                // default -> 下限 -> 上限 -> null
                if (isset($options['default'])) {
                    $value = $options['default'];
                } else if (isset($options['min'])) {
                    $value = $options['min'];
                } else if (isset($options['max'])) {
                    $value = $options['max'];
                } else {
                    $value = 0;
                }
            }
        } else {
            if ($ic) {
                // 满足下限
                // default -> 上限 -> 下限 -> null
                if (isset($options['default'])) {
                    $value = $options['default'];
                } else if (isset($options['max'])) {
                    $value = $options['max'];
                } else if (isset($options['min'])) {
                    $value = $options['min'];
                } else {
                    $value = 0;
                }
            } else {
                // 不满足下限
                // default -> 下限 -> 上限 -> null
                if (isset($options['default'])) {
                    $value = $options['default'];
                } else if (isset($options['min'])) {
                    $value = $options['min'];
                } else if (isset($options['max'])) {
                    $value = $options['max'];
                } else {
                    $value = 0;
                }
            }
        }
        return ;

        $value = $ac & $ic ?
            $value : (isset($options['default']) ?
                $options['default'] : (isset($options['min']) ?
                    $options['min'] : (isset($options['max']) ?
                        $options['max'] : 0
                    )
                )
            );
    }
808908
function getLevel(base, index) {
  var level = (0, _bigInteger2.default)('0');
  var current = index;
  var parent = void 0;
  while (current.gt(zero)) {
    parent = current.prev().divide(base);
    level = level.next();
    current = parent;
  }

  return level;
}
532671
private function quickRatio()
    {
        if ($this->fullBCount === null) {
            $this->fullBCount = [];
            $bLength = count($this->b);
            for ($i = 0; $i < $bLength; ++$i) {
                $char = $this->b[$i];
                $this->fullBCount[$char] = $this->arrayGetDefault($this->fullBCount, $char, 0) + 1;
            }
        }

        $avail = [];
        $matches = 0;
        $aLength = count($this->a);
        for ($i = 0; $i < $aLength; ++$i) {
            $char = $this->a[$i];
            if (isset($avail[$char])) {
                $numb = $avail[$char];
            } else {
                $numb = $this->arrayGetDefault($this->fullBCount, $char, 0);
            }
            $avail[$char] = $numb - 1;
            if ($numb > 0) {
                ++$matches;
            }
        }

        $this->calculateRatio($matches, count($this->a) + count($this->b));
    }
64220
function Convertnumber2farsi($srting)

	{

    $num0="۰";

    $num1="۱";

    $num2="۲";

    $num3="۳";

    $num4="۴";

    $num5="۵";

    $num6="۶";

    $num7="۷";

    $num8="۸";

    $num9="۹";



		$stringtemp="";

		$len=strlen($srting);

		for($sub=0;$sub<$len;$sub++)

		{

			if(substr($srting,$sub,1)=="0")$stringtemp.=$num0;

			elseif(substr($srting,$sub,1)=="1")$stringtemp.=$num1;

			elseif(substr($srting,$sub,1)=="2")$stringtemp.=$num2;

			elseif(substr($srting,$sub,1)=="3")$stringtemp.=$num3;

			elseif(substr($srting,$sub,1)=="4")$stringtemp.=$num4;

			elseif(substr($srting,$sub,1)=="5")$stringtemp.=$num5;

			elseif(substr($srting,$sub,1)=="6")$stringtemp.=$num6;

			elseif(substr($srting,$sub,1)=="7")$stringtemp.=$num7;

			elseif(substr($srting,$sub,1)=="8")$stringtemp.=$num8;

			elseif(substr($srting,$sub,1)=="9")$stringtemp.=$num9;

			else $stringtemp.=substr($srting,$sub,1);



		}

		return   $stringtemp;



	}
1329990
function getNextLevel($level)
    {
        $levels = $this->getLevels();
        $level_incdeces = $this->getLevelIndeces();
        $level_index = $level_incdeces[$level];
        if (!isset($levels[$level_index + 1])) {
            return false;
        }
        $next_level = $levels[$level_index + 1];
        return $next_level;
    }
537560
function mergeAtLevel(summary, level, newValue) {
    var levelParts = level.split('.');
    var partIndex = Number(levelParts[0]) -1;

    var parts = summary.getParts();
    var part = parts.get(partIndex);
    if (!part) {
        return summary;
    }

    var isEditingPart = levelParts.length < 2;
    if (isEditingPart) {
        part = part.merge(newValue);
    } else {
        part = editArticleInPart(part, level, newValue);
    }

    parts = parts.set(partIndex, part);
    return summary.set('parts', parts);
}
159650
public static function distort($img, $level) 
    {        
        $rgb = [];
        $direct = rand(0, 1);
        $width  = imagesx($img); 
        $height = imagesy($img);
        $offset = mt_rand(3, 8)/10; // 偏移量
        
        for($y = 0; $y < $height; $y++) {
            // 获取像素图点阵像素
            for($x = 0; $x < $width; $x++) {
                $rgb[$x] = imagecolorat($img, $x , $y);
            }
            // 使用正弦函数水平方向扭曲图片（修改像素点x轴偏移）
            for($x = 0; $x < $width; $x++) {
                $r = sin($y / $height * 2 * M_PI - M_PI * $offset) * ($direct ? $level : -$level);
                imagesetpixel($img, $x + $r , $y , $rgb[$x]);
            }
        }
    }
639060
function(){
		var loopcount = 0;

		while(1){
			var Rdeg = ((Math.random() * 384)|0)-64; if(Rdeg<0){Rdeg=0;} if(Rdeg>255){Rdeg=255;}
			var Gdeg = ((Math.random() * 384)|0)-64; if(Gdeg<0){Gdeg=0;} if(Gdeg>255){Gdeg=255;}
			var Bdeg = ((Math.random() * 384)|0)-64; if(Bdeg<0){Bdeg=0;} if(Bdeg>255){Bdeg=255;}

			// HLSの各組成値を求める
			var Cmax = Math.max(Rdeg,Math.max(Gdeg,Bdeg));
			var Cmin = Math.min(Rdeg,Math.min(Gdeg,Bdeg));

			var Hdeg = 0;
			var Ldeg = (Cmax+Cmin)*0.5 / 255;
			var Sdeg = (Cmax===Cmin?0:(Cmax-Cmin)/((Ldeg<=0.5)?(Cmax+Cmin):(2*255-Cmax-Cmin)) );

			if(Cmax===Cmin){ Hdeg = 0;}
			else if(Rdeg>=Gdeg && Rdeg>=Bdeg){ Hdeg = (    60*(Gdeg-Bdeg)/(Cmax-Cmin)+360)%360;}
			else if(Gdeg>=Rdeg && Gdeg>=Bdeg){ Hdeg = (120+60*(Bdeg-Rdeg)/(Cmax-Cmin)+360)%360;}
			else if(Bdeg>=Gdeg && Bdeg>=Rdeg){ Hdeg = (240+60*(Rdeg-Gdeg)/(Cmax-Cmin)+360)%360;}

			// YCbCrのYを求める
			var Ydeg = (0.29891*Rdeg + 0.58661*Gdeg + 0.11448*Bdeg) / 255;

			if( (this.minYdeg<Ydeg && Ydeg<this.maxYdeg) && (Math.abs(this.lastYdeg-Ydeg)>0.15) && (Sdeg<0.02 || 0.40<Sdeg) &&
				 (((360+this.lastHdeg-Hdeg)%360>=45)&&((360+this.lastHdeg-Hdeg)%360<=315)) ){
				this.lastHdeg = Hdeg;
				this.lastYdeg = Ydeg;
				//alert("rgb("+Rdeg+", "+Gdeg+", "+Bdeg+")\nHLS("+(Hdeg|0)+", "+(""+((Ldeg*1000)|0)*0.001).slice(0,5)+", "+(""+((Sdeg*1000|0))*0.001).slice(0,5)+")\nY("+(""+((Ydeg*1000)|0)*0.001).slice(0,5)+")");
				return "rgb("+Rdeg+","+Gdeg+","+Bdeg+")";
			}

			loopcount++;
			if(loopcount>100){ return "rgb("+Rdeg+","+Gdeg+","+Bdeg+")";}
		}
	}
207680
public function toRelative($time = null, $level = 7, $default = 'F d, Y')
    {
        Argument::i()
            //argument 1 must be an integer or string
            ->test(1, 'int', 'string', 'null')
            //argument 2 must be an integer
            ->test(2, 'int');
        
        //if no time
        if (is_null($time)) {
            //time get now
            $time = time();
        }
        
        if (is_string($time)) {
            $time = strtotime($time);
        }
        
        $passed =  $time - $this->time;
        
        $gravity = array(
            'second' => 1,
            'minute' => 60,
            'hour' => 60 * 60,
            'day' => 60 * 60 * 24,
            'week' => 60 * 60 * 24 * 7,
            'month' => 60 * 60 * 24 * 30,
            'year' => 60 * 60 * 24 * 30 * 12);
        
        $tokens = array();
        
        $i = 0;
        foreach ($gravity as $magnitude => $distance) {
            if ($i >= $level) {
                break;
            }
            
            array_unshift($tokens, array($distance, $magnitude));
            array_push($tokens, array($distance * -1, $magnitude));
            
            $i++;
        }
        
        if ($passed > $tokens[0][0] || $passed < $tokens[count($tokens) - 1][0]) {
            return date($default, $this->time);
        }
        
        for ($i = 0; $i < count($tokens); $i++) {
            $distance = $tokens[$i][0];
            $relative = $tokens[$i][1];
            
            if ($passed < $distance) {
                continue;
            }
            
            if ($distance < 0) {
                $distance = $tokens[$i-1][0];
                $relative = $tokens[$i-1][1];
            }
            
            $difference = (int) round($passed / $distance);
            
            if ($relative === 'second' && -5 < $difference && $difference < 5) {
                return 'Now';
            }
            
            if ($relative === 'day' && $difference === 1) {
                if ($tokens[$i][0] < 0) {
                    return 'Tomorrow';
                }
                
                return 'Yesterday';
            }
            
            $suffix = $distance > 0 ? ' ago': ' from now';

            return $difference . ' ' . $relative . ($difference === 1 ? '' : 's') . $suffix;
        }
        
        return date($default, $this->time);
    }
979882
public static function makeMsgId()
    {
        static $sequence = 0;
        static $t = 0;
        if (!$t) {
            $t = static::getMillisecond();
            $t = ($t - $t % 1000) / 1000;
            $t = $t % 10000 * 10000;
        }
        //获取msgId
        ++$sequence;

        return $t + $sequence;
    }
1167886
function _ssegment($end) {
        $start = $this->_off;
        $wlen = $end - $start;
        // check special words (need strtoupper)
        if ($wlen > 1) {
            $txt = strtoupper(substr($this->_txt, $start, $wlen));
            if ($this->_rule_checkbit($txt, PSCWS4_RULE_SPECIAL)) {
                $this->_put_res($start, 9.5, $wlen, 'nz');
                return;
            }
        }
        $txt = $this->_txt;
        // check brief words such as S.H.E M.R.
        if ($this->_is_ualpha(ord($txt[$start])) && $txt[$start + 1] == '.') {
            for ($ch = $start + 2; $ch < $end; $ch++) {
                if (!$this->_is_ualpha(ord($txt[$ch]))) break;
                $ch++;
                if ($ch == $end || $txt[$ch] != '.') break;
            }
            if ($ch == $end) {
                $this->_put_res($start, 7.5, $wlen, 'nz');
                return;
            }
        }
        // 取出单词及标点. 数字允许一个点且下一个为数字,不连续的. 字母允许一个不连续的'
        while ($start < $end) {
            $ch = $txt[$start++];
            $cx = ord($ch);
            if ($this->_is_alnum($cx)) {
                $pflag = $this->_is_digit($cx) ? PSCWS4_PFLAG_DIGIT : 0;
                $wlen = 1;
                while ($start < $end) {
                    $ch = $txt[$start];
                    $cx = ord($ch);
                    if ($pflag & PSCWS4_PFLAG_DIGIT) {
                        if (!$this->_is_digit($cx)) {
                            if (($pflag & PSCWS4_PFLAG_ADDSYM) || $cx != 0x2e || !$this->_is_digit(ord($txt[$start + 1])))
                                break;
                            $pflag |= PSCWS4_PFLAG_ADDSYM;
                        }
                    } else {
                        if (!$this->_is_alpha($cx)) {
                            if (($pflag & PSCWS4_PFLAG_ADDSYM) || $cx != 0x27 || !$this->_is_alpha(ord($txt[$start + 1])))
                                break;
                            $pflag |= PSCWS4_PFLAG_ADDSYM;
                        }
                    }
                    $start++;
                    if (++$wlen >= PSCWS4_MAX_EWLEN) break;
                }
                $this->_put_res($start - $wlen, 2.5 * log($wlen), $wlen, 'en');
            } else if (!($this->_mode & PSCWS4_IGN_SYMBOL)) {
                $this->_put_res($start - 1, 0, 1, 'un');
            }
        }
    }
130959
function($0, $1) {
                // 排除注释掉的require
                if(match.indexOf($0) === -1) return $0;
                
                // console.log('$1: ', $1);
                // 处理common
                var reqPath, flag = $1.slice(-2) === '!!' ? 2 : 1;
                $1 = reqPath = flag === 2 ? $1.slice(0, -2): $1;

                // console.log("flag:------------", $1, "----", flag);
                // 处理绝对路径的情况
                reqPath = path.isAbsolute(reqPath) ? reqPath : path.join(filebase, reqPath);
                // TODO: 触发
                //var absReqPath = path.join(buildPath, reqPath);
                var absReqPath = reqPath.indexOf(buildPath) === 0 ? reqPath : path.join(buildPath, reqPath);
                if (!fs.existsSync(absReqPath)) {
                    // 默认ext是.js
                    if (fs.existsSync(absReqPath + '.js')) {
                        reqPath += '.js';
                    } else {
                        // console.log('come in')
                        // 没有找到文件在检查是否有别名
                        for(var i in aliasObj){
                            var alias = i + '/';
                            // console.log('alias:', alias)
                            if($1.indexOf(alias) > -1){
                                var name = aliasObj[i] + '/';
                                // console.log('name:', name);
                                return replaceHandle($0, $1.replace(alias, name));
                            }
                        }
                        // 检查是否在module中
                        reqPath = modules[$1] || findInModulePackage(buildPath, modulesPath, $1);
                        // 模块库里面也没有
                        if (!reqPath) {
                            throw Error("error: can not find file(找不到文件) " + absReqPath);
                        }else{
                            reqPath = utils.toBasePath(reqPath, buildPath)
                            modules[$1] = reqPath;
                        }
                    }
                }

                var id = utils.convertID(reqPath);

                if (!modules[id]) {
                    // 处理循环引用
                    modules[id] = flag;
                    gutil.log(gutil.colors.cyan("dependence(处理依赖): "), reqPath);
                    requireIterator(buildPath, reqPath, modules, moduleListObj);
                }
                
                reqPath = utils.toBasePath(reqPath, buildPath);

                return exportType === 'require' ? 'require("' + reqPath + '")' : 
                        'window.__MODULES["' + id + '"]' + (utils.inArray(path.extname(reqPath), ['.tpl', '.json']) ? '()': '');
            }
209361
private static List<Integer> parseRange(String value, int step, ValueParser parser) {
		final List<Integer> results = new ArrayList<>();
		
		// 全部匹配形式
		if (value.length() <= 2) {
			//根据步进的第一个数字确定起始时间，类似于 12/3则从12（秒、分等）开始
			int minValue = parser.getMin();
			if(false == isMatchAllStr(value)) {
				minValue = Math.max(minValue, parser.parse(value));
			}else {
				//在全匹配模式下，如果步进不存在，表示步进为1
				if(step < 1) {
					step = 1;
				}
			}
			if(step > 0) {
				final int maxValue = parser.getMax();
				if(minValue > maxValue) {
					throw new CronException("Invalid value {} > {}", minValue, maxValue);
				}
				//有步进
				for (int i = minValue; i <= maxValue; i+=step) {
					results.add(i);
				}
			} else {
				//固定时间
				results.add(minValue);
			}
			return results;
		}

		//Range模式
		List<String> parts = StrUtil.split(value, '-');
		int size = parts.size();
		if (size == 1) {// 普通值
			final int v1 = parser.parse(value);
			if(step > 0) {//类似 20/2的形式
				NumberUtil.appendRange(v1, parser.getMax(), step, results);
			}else {
				results.add(v1);
			}
		} else if (size == 2) {// range值
			final int v1 = parser.parse(parts.get(0));
			final int v2 = parser.parse(parts.get(1));
			if(step < 1) {
				//在range模式下，如果步进不存在，表示步进为1
				step = 1;
			}
			if (v1 < v2) {// 正常范围，例如：2-5
				NumberUtil.appendRange(v1, v2, step, results);
			} else if (v1 > v2) {// 逆向范围，反选模式，例如：5-2
				NumberUtil.appendRange(v1, parser.getMax(), step, results);
				NumberUtil.appendRange(parser.getMin(), v2, step, results);
			} else {// v1 == v2，此时与单值模式一致
				if(step > 0) {//类似 20/2的形式
					NumberUtil.appendRange(v1, parser.getMax(), step, results);
				}else {
					results.add(v1);
				}
			}
		} else {
			throw new CronException("Invalid syntax of field: [{}]", value);
		}
		return results;
	}
349357
private function _toFormatTree($list, $level = 0)
    {
        $formatTree = [];
        foreach ($list as $val) {
            $tmp_str = str_repeat($this->tabSize, $level);
            $tmp_str .= "└&nbsp;";
            
            $val['level'] = intval($level);
            $val[$this->showTitleField] = $level == 0 ? $val[$this->showTitleField] : $tmp_str . $val[$this->showTitleField];
            if (!array_key_exists('_child', $val)) {
                array_push($formatTree, $val);
            } else {
                $tmp_ary = $val['_child'];
                unset($val['_child']);
                array_push($formatTree, $val);
                $formatTree = array_merge($formatTree, $this->_toFormatTree($tmp_ary, $level + 1));
            }
        }
        
        return $formatTree;
    }