--------------------------------------------------------------------------- pzpr.util.checkpid()  メニューなどが表示対象のパズルかどうか返す ---------------------------------------------------------------------------
765073
function(str,pid){
		var matches = str.match(/!?[a-z0-9]+/g), isdisp = true;
		if(!!matches){
			isdisp = false;
			for(var i=0;i<matches.length;i++){
				if(matches[i].charAt(0)!=="!"){ if(matches[i]===pid){ isdisp = true;}}
				else                          { isdisp = (matches[i].substr(1)!==pid);}
			}
		}
		return isdisp;
	}
523690
private function scan_sitemap_tree_recursive($objSheet, $page_id = ''){
		if(!is_string($page_id)){return false;}
		$sitemap_definition = $this->get_sitemap_definition();
		$table_definition = $this->get_table_definition();
		// var_dump($this->site->get_sitemap());
		$page_info = $this->site->get_page_info($page_id);
		if(!is_array($page_info)){
			return false;
		}
		// var_dump($page_id);
		// var_dump($page_info);

		set_time_limit(30);

		$this->mk_xlsx_body($objSheet, $page_info, true);
		$this->current_row ++;

		$children = $this->site->get_children($page_id, array('filter'=>false));
		// var_dump($children);
		foreach( $children as $child ){
			$child_page_info = $this->site->get_page_info($child);
			if(!strlen($child_page_info['id'])){
				$this->px->error('ページIDがセットされていません。');
				continue;
			}
			$this->scan_sitemap_tree_recursive($objSheet, $child_page_info['id']);
		}

		// 転記し終わったページに完了マークをつける
		$this->site->done($page_id);

		return true;
	}
1100532
public static <T> void forEach(T[] input,boolean[] inputSkip,T[] output ,int outPutIndex,ForEachController<T> controller)
	{
		for(int i=0;i<input.length;i++)
		{
			if(inputSkip[i])
			{
				continue;
			}
			output[outPutIndex]=input[i];//输出当前位锁定值
			ComputeStatus status=controller.onOutEvent(output, outPutIndex);
			if(status.isStop())
			{
				return;
			}
			if(status.isSkip())
			{//跳过下层循环
				continue;
			}
			outPutIndex++;
			if(outPutIndex>=input.length)
			{//如果是最后一个则返回
				break;
			}
			//解锁下一个
			inputSkip[i]=true;//锁定当前位占用索引,其它位不可使用该索引
			forEach(input, inputSkip, output, outPutIndex,controller);
			outPutIndex--;//回到当前
			inputSkip[i]=false;//释放锁定
		}
	}
853519
public static void main(String[] args) throws Exception {
		CWSTagger tag = new CWSTagger("../models/seg.m");
		System.out.println("不使用词典的分词：");
		String str = " 媒体计算研究所成立了, 高级数据挖掘(data mining)很难。 乐phone热卖！";
		String s = tag.tag(str);
		System.out.println(s);
		
		//设置英文预处理
		tag.setEnFilter(true);
		s = tag.tag(str);
		System.out.println(s);
//		tag.setEnFilter(false);
		
		System.out.println("\n设置临时词典：");
		ArrayList<String> al = new ArrayList<String>();
		al.add("数据挖掘");
		al.add("媒体计算研究所");
		al.add("乐phone");
		Dictionary dict = new Dictionary(false);
		dict.addSegDict(al);
		tag.setDictionary(dict);
		s = tag.tag(str);
		System.out.println(s);
		
		
		CWSTagger tag2 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict.txt"));
		System.out.println("\n使用词典的分词：");
		String str2 = "媒体计算研究所成立了, 高级数据挖掘很难。 乐phone热卖！";
		String s2 = tag2.tag(str2);
		System.out.println(s2);
		
		//使用不严格的词典
		CWSTagger tag3 = new CWSTagger("../models/seg.m", new Dictionary("../models/dict_ambiguity.txt",true));
		//尽量满足词典，比如词典中有“成立”“成立了”和“了”, 会使用Viterbi决定更合理的输出
		System.out.println("\n使用不严格的词典的分词：");
		String str3 = "媒体计算研究所成立了, 高级数据挖掘很难";
		String s3 = tag3.tag(str3);
		System.out.println(s3);
		str3 = "我送给力学系的同学一个玩具 (送给给力力学力学系都在词典中)";
		s3 = tag3.tag(str3);
		System.out.println(s3);
		
		System.out.println("\n处理文件：");
		String s4 = tag.tagFile("../example-data/data-tag.txt");
		System.out.println(s4);
		
		String s5 = tag2.tagFile("../example-data/data-tag.txt");
		System.out.println(s5);
		
	}
1272221
function(e){
		if(e.touches!==void 0){
			/* touchイベントだった場合 */
			return (e.touches.length===1 ? 'left' : '');
		}
		else if(!!e.pointerType && e.pointerType!=='mouse'){
			/* pointerイベントだった場合 */
			return (e.isPrimary ? 'left' : '');
		}
		return ['left','middle','right'][(e.button!==void 0 ? e.button : e.which-1)] || '';
	}
194225
function onClicksetPresetData(){
$("#onClicksetPresetDataBtn").prop('disabled', true);
    setPresetData().then(()=>{
        alert("書き込み完了");
        $("#onClicksetPresetDataBtn").prop('disabled', false);
        $("#onplayPresetDataBtn").prop('disabled', false);

    }).catch((e)=>{
        alert(e);
        $("#onClicksetPresetDataBtn").prop('disabled', false);
    })
}
707147
function tokenize (parser, text) {
  var textLines = text.split(LINEBREAKE_MARK)

  if (textLines[textLines.length - 1] === '') {
    textLines = textLines.splice(0, textLines.length - 1)
  }

  var rootNode = parser.createParentNode('Root')

  /**
   * Callback Function
   * @param element
   * @param index
   * @param array
   */
  function tokenizeByLine (element, index, array) {
    parser.line = index + 1
    parser.column = 1

    var paragraphNode = parser.createParentNode('Paragraph')

    // 空行ではない場合
    if (element !== '') {
      // 半角括弧を全角括弧に変換
      var str = new Jaco(element).toWideJapneseSymbol().toString()

      // 改行ノードをParagraphNodeに追加する
      parser.add(parser.createTextNode('Text', str), paragraphNode)
    }

    // 改行ノードをParagraphNodeに追加する
    parser.add(parser.createTextNode('WhiteSpace', '\n'), paragraphNode)

    // ParagraphNodeをRoodNodeに追加
    parser.add(paragraphNode, rootNode)
  }

  textLines.forEach(tokenizeByLine)

  return rootNode
}
840159
public String getIntegerPartAfter(final int digit) {
        
        final int length = integerPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        String num = integerPart.substring(0, (length - digit + 1));
        if(isUseSeparator() && digit >= 4) {
            // 区切り文字を入れるために分割する。
            StringBuilder sb = new StringBuilder();
            for(int i=0; i < num.length(); i++) {
                char c = num.charAt(i);
                sb.append(c);
                
                // 現在の処理中の桁数
                int itemDigit = length -i;
                if((itemDigit >= 3) && (itemDigit -1) % 3 == 0) {
                    sb.append(",");
                }
            }
            
            num = sb.toString();
        }
        
        return num;
        
    }
546758
function getProp (names, props) {
  var prop = names.split('.').reduce(function(x, name) {
    return x && x.properties ? x.properties[name] : null;
  }, {properties: props});
  if (prop) {
    return prop;
  } else {
    console.log('（エラー）プロパティ' + names + 'のヘルプ情報が存在しません');
  }
}
1081263
function(){
		var inp = this.qdata.split("/"), col = 0, row = 0;
		delete this.qdata;
		/* URLにつけるオプション */
		if(this.type!==URL_KANPEN && this.type!==URL_HEYAAPP){
			if(!!inp[0] && !isNaN(inp[0])){ inp.unshift("");}
			this.pflag = inp.shift();
		}
		
		/* サイズを表す文字列 */
		if(this.type===URL_KANPEN){
			if(this.pid==="kakuro"){
				row = +inp.shift() - 1;
				col = +inp.shift() - 1;
			}
			else if(this.pid==="sudoku"){
				row = col = +inp.shift();
			}
			else{
				row = +inp.shift();
				col = +inp.shift();
			}
		}
		else if(this.type===URL_HEYAAPP){
			var size = inp.shift().split("x");
			col = +size[0];
			row = +size[1];
		}
		else{
			col = +inp.shift() || NaN;
			row = +inp.shift() || NaN;
		}
		this.rows = row;
		this.cols = col;

		/* サイズ以降のデータを取得 */
		if(!inp[inp.length-1]){ inp.pop();}
		this.body = inp.join("/");
	}
799753
StringBuilder scanPara(String id) {
		char quotes = '"';
		int localState = 0;
		int parenDepth = 1;	// 指令后面参数的第一个 '(' 深度为 1
		next();
		int paraStart = forward;
		while (true) {
			switch (localState) {
			case 0:
				for (char c=peek(); true; c=next()) {
					if (c == ')') {
						parenDepth--;
						if (parenDepth == 0) {	// parenDepth 不可能小于0，因为初始值为 1
							next();
							return subBuf(paraStart, forward - 2);
						}
						continue ;
					}
					
					if (c == '(') {
						parenDepth++;
						continue ;
					}
					
					if (c == '"' || c == '\'') {
						quotes = c;
						localState = 1;
						break ;
					}
					
					if (CharTable.isExprChar(c)) {
						continue ;
					}
					
					if (c == EOF) {
						throw new ParseException("#" + id + " parameter can not match the end char ')'", new Location(fileName, beginRow));
					}
					
					throw new ParseException("#" + id + " parameter exists illegal char: '" + c + "'", new Location(fileName, beginRow));
				}
				break ;
			case 1:
				for (char c=next(); true; c=next()) {
					if (c == quotes) {
						if (buf[forward - 1] != '\\') {	// 前一个字符不是转义字符
							next();
							localState = 0;
							break ;
						} else {
							continue ;
						}
					}
					
					if (c == EOF) {
						throw new ParseException("#" + id + " parameter error, the string parameter not ending", new Location(fileName, beginRow));
					}
				}
				break ;
			}
		}
	}
228319
function makeFiles(list, dest, savedir, callback) {
  let shell = path.join(__dirname, '../sh/copy.sh');

  return exec('chmod +x ' + shell, (err) => {
    if (err !== null) throw ('[Error: makeFiles: chmod:] ' + err);
    let tmp = []; // 保存先のパスを格納する配列
    let fin = countup(list.length);

    list.forEach((file, index) => {
      let source = file; // コピー元
      let target = path.join(savedir, dest, file); // 保存先
      tmp[index] = target;

      // ファイルをコピーする
      let copied = execFile(shell, [source, target, index], (error, stdout, stderr) => {
        if (error !== null) throw ('[Error: makeFiles: copy.sh:] ' + error);
        fin.step(+stdout, (closed, progress) => {
          return (closed && callback) && callback(tmp, path.join(savedir, dest));
        });
      });
    });
  });
}
895312
protected int getNextIndex(final int currentIndex) {

        if (!isPaused()) {
            return currentIndex + 1;
        }

        int ret = currentIndex;

        while (isPaused()) {

            sendStepPausing(ret + 1);

            try {
                Thread.sleep(getPauseSpan());
            } catch (InterruptedException e) {
                LOG.warn("thread.sleep.error", e);
            }

            TestScript testScript = current.getTestScript();
            if (testScript.isScriptFileChanged()) {
                LOG.info("script.file.changed");
                current.setTestScript(
                        dao.load(testScript.getScriptFile(), testScript.getSheetName(), false));
            }

            // コンソールから有効なコマンド入力があるまでループします。
            if (cmd == null || cmd.key == null) {
                continue;
            }

            final int cmdRet = cmd.execute(ret, current.getTestScript(), appCtx);

            if (cmdRet < 0) {
                LOG.info("cmd.error");
            } else {
                ret = cmdRet;

                if (current.getTestScript().getTestStep(ret) == null) {
                    LOG.info("test.step.end");
                    break;
                }

                LOG.info("empty");
                LOG.info("test.step.next.prev");
                for (int i = ret - 1; i <= ret + 1; i++) {
                    TestStep nextStep = current.getTestScript().getTestStep(i);
                    if (nextStep == null) {
                        continue;
                    }
                    String nextMark = i == ret + 1 ? " <- 次に実行" : "";
                    LOG.info("test.step.next", new Object[] { nextStep.getNo(),
                            nextStep.getItemName(), nextStep.getLocator(), nextMark });
                }
                LOG.info("empty");
            }

            //
            if (cmd.key.release && cmdRet >= 0) {
                cmd = null;
                break;
            } else {
                cmd = null;
            }

        }

        return ret;
    }
728975
function(filetype, option){
		var puzzle = this.puzzle, bd = puzzle.board;
		var pzl = new pzpr.parser.FileData('', puzzle.pid);
		
		this.currentType = filetype = filetype || pzl.FILE_PZPR; /* type===pzl.FILE_AUTO(0)もまとめて変換する */
		option = option || {};

		this.filever = 0;
		this.datastr = "";
		if(filetype===pzl.FILE_PBOX_XML){
			this.xmldoc = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="utf-8" ?><puzzle />', 'text/xml');
			var puzzlenode = this.xmldoc.querySelector('puzzle');
			puzzlenode.appendChild(this.createXMLNode('board'));
			puzzlenode.appendChild(this.createXMLNode('answer'));
		}

		// メイン処理
		switch(filetype){
		case pzl.FILE_PZPR:
			this.encodeData();
			if(!option.history && option.trial && bd.trialstage>0){ this.encodeTrial();}
			break;

		case pzl.FILE_PBOX:
			this.kanpenSave();
			break;

		case pzl.FILE_PBOX_XML:
			this.kanpenSaveXML();
			break;

		default:
			throw "invalid File Type";
		}

		pzl.type  = filetype;
		pzl.filever = this.filever;
		pzl.cols  = bd.cols;
		pzl.rows  = bd.rows;
		if(filetype!==pzl.FILE_PBOX_XML){
			pzl.body = this.datastr;
		}
		else{
			pzl.body = this.xmldoc;
		}
		pzl.metadata.update(puzzle.metadata);
		if(option.history && (filetype===pzl.FILE_PZPR)){
			pzl.history = puzzle.opemgr.encodeHistory({time:!!option.time});
		}

		this.datastr = "";

		return pzl.generate();
	}
425502
function(){
		if(this.mouseend && this.notInputted() && !!this.clickTateyoko){
			this.clickTateyoko();
			return;
		}

		var cell = this.getcell();
		if(cell.isnull){ return;}

		// 黒マス上なら何もしない
		if     (this.pid!=="amibo" && cell.ques===1){ }
		else if(this.pid==="amibo" && cell.isNum()){ }
		// 初回 or 入力し続けていて別のマスに移動した場合
		else if(this.mouseCell!==cell){
			this.firstPoint.set(this.inputPoint);
		}
		// まだ入力していないセルの場合
		else if(this.firstPoint.bx!==null){
			var val=null,
				dx = this.inputPoint.bx-this.firstPoint.bx,
				dy = this.inputPoint.by-this.firstPoint.by;
			if     (dy<=-0.50 || 0.50<=dy){ val=1;}
			else if(dx<=-0.50 || 0.50<=dx){ val=2;}
			
			if(val!==null){
				var plus = (this.pid==="amibo"||this.pid==="tatamibari");
				
				var shape = 0;
				if(this.puzzle.playmode){ shape = {0:0,11:3,12:1,13:2}[cell.qans];}
				else                    { shape = {'-1':0,1:3,2:1,3:2}[cell.qnum];}
				if((this.inputData===null) ? (shape & val) : this.inputData<=0){
					val = (!plus ? 0 : -val);
				}
				
				// 描画・後処理
				if(!plus)     { shape  = val;}
				else if(val>0){ shape |= val;}
				else          { shape &= ~(-val);}
				
				if(this.puzzle.playmode){ cell.setQans([0,12,13,11][shape]);}
				else                    { cell.setQnum([-1,2,3,1][shape]);}
				cell.draw();
				
				this.inputData = +(val>0);
				this.firstPoint.reset();
				
				if(this.pid==="tatamibari"){ this.mousereset();}
			}
		}

		this.mouseCell = cell;
	}
513294
function(){
		var lines = this.qdata.split("\n"), col = 0, row = 0;
		delete this.qdata;
		
		/* サイズを表す文字列 */
		if(this.type===FILE_PBOX_XML){
			row = +this.body.querySelector('size').getAttribute('row');
			col = +this.body.querySelector('size').getAttribute('col');
			if(this.pid==="slither"||this.pid==='kakuro'){ row--; col--;}
		}
		else if(this.type===FILE_PBOX && this.pid==="kakuro"){
			row = +lines.shift() - 1;
			col = +lines.shift() - 1;
		}
		else if(this.pid==="sudoku"){
			row = col = +lines.shift();
		}
		else{
			row = +lines.shift();
			col = +lines.shift();
		}
		if(row<=0 || col<=0){ return false;}
		this.rows = row;
		this.cols = col;
		
		/* サイズ以降のデータを取得 */
		if(this.type===FILE_PZPR){
			var historypos = null, str = "", strs = [], isinfo = false;
			for(var i=0;i<lines.length;i++){
				/* かなり昔のぱずぷれファイルは最終行にURLがあったので、末尾扱いする */
				if(lines[i].match(/^http\:\/\//)){ break;}
				
				/* info行に到達した場合 */
				if(lines[i].match(/info:\{/)){ historypos=i; isinfo = true; break;}
				
				/* 履歴行に到達した場合 */
				if(lines[i].match(/history:\{|__HISTORY__/)){ historypos=i; break;}
				
				strs.push(lines[i]);
			}
			this.body += strs.join('\n');
			
			/* 履歴部分の読み込み */
			if(historypos!==null && !!JSON){
				var count = 0, cnt;
				for(var i=historypos;i<lines.length;i++){
					str += lines[i];
					
					cnt = count;
					count += (lines[i].match(/\{/g)||[]).length;
					count -= (lines[i].match(/\}/g)||[]).length;
					if(cnt>0 && count===0){ break;}
				}
			}
			
			/* 履歴出力があったら入力する */
			if(!!JSON){
				if(isinfo && (str.substr(0,5)==="info:")){
					var info = JSON.parse(str.substr(5));
					this.metadata.update(info.metadata);
					this.history = info.history || '';
				}
				else if(str.substr(0,8)==="history:"){
					this.history = JSON.parse(str.substr(8));
				}
			}
		}
		else if(this.type===FILE_PBOX){
			this.body = lines.join("\n");
		}
		else if(this.type===FILE_PBOX_XML){
			if(!!this.body){
				var metanode = this.body.querySelector('property'), meta = this.metadata;
				meta.author = metanode.querySelector('author').getAttribute('value');
				meta.source = metanode.querySelector('source').getAttribute('value');
				meta.hard   = metanode.querySelector('difficulty').getAttribute('value');
				var commentnode = metanode.querySelector('comment');
				meta.comment= (!!commentnode ? commentnode.childNodes[0].data : '');
			}
		}
		
		return true;
	}
992755
function(datastr){
		var puzzle = this.puzzle, bd = puzzle.board, pzl = pzpr.parser.parseFile(datastr, puzzle.pid);
		var filetype = this.currentType = pzl.type;

		bd.initBoardSize(pzl.cols, pzl.rows);

		this.filever = pzl.filever;
		if(filetype!==pzl.FILE_PBOX_XML){
			this.lineseek = 0;
			this.dataarray = pzl.body.split("\n");
		}
		else{
			this.xmldoc = pzl.body;
		}

		// メイン処理
		switch(filetype){
		case pzl.FILE_PZPR:
			this.decodeData();
			if((this.readLine()||'').match(/TrialData/)){ this.lineseek--; this.decodeTrial();}
			break;

		case pzl.FILE_PBOX:
			this.kanpenOpen();
			break;

		case pzl.FILE_PBOX_XML:
			this.kanpenOpenXML();
			break;
		}

		puzzle.metadata.update(pzl.metadata);
		if(pzl.history && (filetype===pzl.FILE_PZPR)){
			puzzle.opemgr.decodeHistory(pzl.history);
		}

		bd.rebuildInfo();

		this.dataarray = null;
	}