指定した値を用いて変化点スコアを算出する。<br>
算出と同時に過去状態の更新も行う。

@param input 指定値
@return 変化点スコア
349938
public double calculateScore(double input)
    {
        this.pastData.addFirst(input);
        int dataLength = this.pastData.size();

        // #############################################
        // ## オンライン忘却アルゴリズムSDARを用いて1段階学習を行う。
        // #############################################
        // 最尤推定値「μ」を更新する。
        this.estimatedMyu = (1 - this.forgetability) * this.estimatedMyu + this.forgetability
                * input;

        // 確率密度関数用の係数配列を更新する。
        // 算出される個数は「過去データの数」「自己回帰モデルの次数 + 1」のうち小さい方
        int pdfBaseNum = Math.min(dataLength, this.arDimensionNum + 1);
        for (int index = 0; index < pdfBaseNum; index++)
        {
            this.pdfBase[index] = (1 - this.forgetability) * this.pdfBase[index]
                    + this.forgetability * (input - this.estimatedMyu)
                    * Math.pow((this.pastData.get(index) - this.estimatedMyu), 1);
        }

        // パラメータ推定に用いる係数配列「ω」の算出を行う。
        // 確率密度関数用の係数配列のインデックスと異なり1オリジンのため配列インデックスも1から使用している。
        for (int yuleIndex = 1; yuleIndex < pdfBaseNum; yuleIndex++)
        {
            double nowPdfBase = this.pdfBase[yuleIndex];

            for (int index = 1; index < yuleIndex; index++)
            {
                nowPdfBase = nowPdfBase
                        - (this.pdfBase[yuleIndex - index] * this.yuleWalkerAns[index]);
            }

            double yuleResult = nowPdfBase / (this.pdfBase[0]);
            this.yuleWalkerAns[yuleIndex] = yuleResult;
        }

        // データの推測値を算出
        double estimatedValue = this.estimatedMyu;
        for (int index = 1; index < pdfBaseNum; index++)
        {
            double dataResult = this.pastData.get(index);
            double dist = this.yuleWalkerAns[index] * (dataResult - this.estimatedMyu);
            estimatedValue = estimatedValue + dist;
        }

        if (this.pastData.size() > this.arDimensionNum)
        {
            this.pastData.pollLast();
        }

        // Σの最尤推定値を算出
        this.estimatedSigma = (1 - this.forgetability) * this.estimatedSigma + this.forgetability
                * Math.pow((input - estimatedValue), 2);

        // 1段階学習結果スコアを算出
        double firstScore = calcFirstScore(estimatedValue, input, this.estimatedSigma,
                this.smoothingWindow);
        this.scores.add(firstScore);
        if (this.scores.size() > this.smoothingWindow)
        {
            this.scores.remove(0);
        }

        // #############################################
        // ## 平滑化を行う。
        // #############################################
        double movingAverage = smoothing(this.scores, this.smoothingWindow);

        if (logger.isDebugEnabled() == true)
        {
            String logFormat = "CalculateResult. Input={0}, Myu={1}, Sigma={2}, Estimated={3}, Score={4}, MovingAverage={5}";
            logger.debug(this.logHeader
                    + MessageFormat.format(logFormat, input, this.estimatedMyu,
                            this.estimatedSigma, estimatedValue, firstScore, movingAverage));
        }

        // #############################################
        // ## オンライン忘却アルゴリズムSDARを用いて2段階学習を行う。
        // ## フィールド「secondFinder」が存在している場合、2段階学習結果をスコアとして返す。
        // ## 存在していない場合は本インスタンス自身が2段階目のChangeFinderのため、平滑化の結果をそのまま返す。
        // #############################################
        if (this.secondChangeFinder == null)
        {
            return movingAverage;
        }

        double secondScore = this.secondChangeFinder.calculateScore(movingAverage);
        return secondScore;
    }
104922
public static byte[] gzip(String input) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        GZIPOutputStream gzos = null;

        try {
            gzos = new GZIPOutputStream(baos);
            gzos.write(input.getBytes("UTF-8"));
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (gzos != null) {
                try {
                    gzos.close();
                } catch (IOException ignore) {
                }
            }
        }

        return baos.toByteArray();
    }
1197932
public static String escapeBytes(final byte[] input) {
      return escapeBytes(new ByteSequence() {
        public int size() {
          return input.length;
        }
        public byte byteAt(int offset) {
          return input[offset];
        }
      });
    }
910498
public static String unAccent(String input) {
        if (MAP_NORM == null || MAP_NORM.size() == 0) {
            MAP_NORM = new HashMap<Character, Character>();
            MAP_NORM.put('À', 'A');
            MAP_NORM.put('Á', 'A');
            MAP_NORM.put('Â', 'A');
            MAP_NORM.put('Ã', 'A');
            MAP_NORM.put('Ä', 'A');
            MAP_NORM.put('È', 'E');
            MAP_NORM.put('É', 'E');
            MAP_NORM.put('Ê', 'E');
            MAP_NORM.put('Ë', 'E');
            MAP_NORM.put('Í', 'I');
            MAP_NORM.put('Ì', 'I');
            MAP_NORM.put('Î', 'I');
            MAP_NORM.put('Ï', 'I');
            MAP_NORM.put('Ù', 'U');
            MAP_NORM.put('Ú', 'U');
            MAP_NORM.put('Û', 'U');
            MAP_NORM.put('Ü', 'U');
            MAP_NORM.put('Ò', 'O');
            MAP_NORM.put('Ó', 'O');
            MAP_NORM.put('Ô', 'O');
            MAP_NORM.put('Õ', 'O');
            MAP_NORM.put('Ö', 'O');
            MAP_NORM.put('Ñ', 'N');
            MAP_NORM.put('Ç', 'C');
            MAP_NORM.put('ª', 'A');
            MAP_NORM.put('º', 'O');
            MAP_NORM.put('§', 'S');
            MAP_NORM.put('³', '3');
            MAP_NORM.put('²', '2');
            MAP_NORM.put('¹', '1');
            MAP_NORM.put('à', 'a');
            MAP_NORM.put('á', 'a');
            MAP_NORM.put('â', 'a');
            MAP_NORM.put('ã', 'a');
            MAP_NORM.put('ä', 'a');
            MAP_NORM.put('è', 'e');
            MAP_NORM.put('é', 'e');
            MAP_NORM.put('ê', 'e');
            MAP_NORM.put('ë', 'e');
            MAP_NORM.put('í', 'i');
            MAP_NORM.put('ì', 'i');
            MAP_NORM.put('î', 'i');
            MAP_NORM.put('ï', 'i');
            MAP_NORM.put('ù', 'u');
            MAP_NORM.put('ú', 'u');
            MAP_NORM.put('û', 'u');
            MAP_NORM.put('ü', 'u');
            MAP_NORM.put('ò', 'o');
            MAP_NORM.put('ó', 'o');
            MAP_NORM.put('ô', 'o');
            MAP_NORM.put('õ', 'o');
            MAP_NORM.put('ö', 'o');
            MAP_NORM.put('ñ', 'n');
            MAP_NORM.put('ç', 'c');
        }

        if (input == null) {
            return "";
        }

        StringBuilder sb = new StringBuilder(input);

        for (int i = 0; i < input.length(); i++) {
            Character c = MAP_NORM.get(sb.charAt(i));
            if (c != null) {
                sb.setCharAt(i, c.charValue());
            }
        }

        return sb.toString();

    }
160702
function( input ) {

		if ( input == null ) {

			input = this.result;

		}

		for (var i = 0; i < input.length; i++) {

			if ( isNaN( parseInt( input.charAt( i ) ) ) ) continue;

			else {

			this.temp = this.persian_number[ parseInt( input.charAt( i ) ) ];

			this.result = this.result.replace( input.charAt( i ), this.temp );

			}

		}

		return this;

	}
1024428
public static String capitalize(final String input) throws IllegalArgumentException {
        if (input == null) {
            throw new IllegalArgumentException("input can't be null");
        }
        if (input.length() == 0) {
            return "";
        }
        return head(input).map(String::toUpperCase).map(h -> tail(input).map(t -> h + t.toLowerCase()).orElse(h)).get();
    }
555563
public static String stripNonAlphaNumericCharacters(String input) {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < input.length(); i++) {
      char current = input.charAt(i);
      if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ".indexOf(current) >= 0)
        output.append(current);
    }
    return output.toString();
  }
944147
public static String primArrayToString(Object input) {
		return new StructBehavior<String>(input) {

			@Override protected String booleanIf() { return Arrays.toString((boolean[]) this.delegate); }
			@Override protected String byteIf() { return Arrays.toString((byte[]) this.delegate); }
			@Override protected String characterIf() { return Arrays.toString((char[]) this.delegate); }
			@Override protected String doubleIf() { return Arrays.toString((double[]) this.delegate); }
			@Override protected String floatIf() { return Arrays.toString((float[]) this.delegate); }
			@Override protected String integerIf() { return Arrays.toString((int[]) this.delegate); }
			@Override protected String longIf() { return Arrays.toString((long[]) this.delegate); }
			@Override protected String shortIf() { return Arrays.toString((short[]) this.delegate); }
			@Override protected String nullIf() { return null; }
			@Override protected String noneMatched() { return null; }
			
		}.doDetect();
	}
618210
public static String encodeBrackets(final String input) {
		if (input == null || input.length() == 0) {  // For performance reasons don't use Util.empty
			return input;
		}
		return ENCODE_BRACKETS.translate(input);
	}
536232
public Token[] tokenize(String input) 
    {
        Token[] initialTokens = innerTokenizer.tokenize(input);
        List tokens = new ArrayList();
        for (int i=0; i<initialTokens.length; i++) {
            Token tok = initialTokens[i];
            String str = "^"+tok.getValue()+"$";
            if (keepOldTokens) tokens.add( intern(str) );
            for (int lo=0; lo<str.length(); lo++) {
                for (int len=minNGramSize; len<=maxNGramSize; len++) {
                    if (lo+len<str.length()) {
                        tokens.add( innerTokenizer.intern( str.substring(lo,lo+len) )); 
                    }
                }
            }
        }
        return (Token[]) tokens.toArray(new BasicToken[tokens.size()]);
    }
101416
public static byte[] decodeMultiple(final byte[] input) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        final byte[] output = new byte[input.length >> 1]; // /2

        decodeMultiple(input, 0, output, 0, output.length);

        return output;
    }
248624
public static String extractKey(String input) {
        int index = input.indexOf('=');
        if (-1 == index) {
            return input.trim();
        }
        return input.substring(0, index).trim();
    }
130387
@Sensitive
    @Trivial
    public static String digest(@Sensitive String input) {
        if (input == null || input.isEmpty())
            return null;
        return digest(input, DEFAULT_ALGORITHM, DEFAULT_CHARSET);
    }
150661
public static String convertToRegexString(final String input) {
        return input.replaceAll("\\\\", "\\\\").replaceAll("\\*", "\\*").replaceAll("\\+", "\\+").replaceAll("\\]", "\\]").replaceAll("\\[",
                "\\[").replaceAll("\\(", "\\(").replaceAll("\\)", "\\)").replaceAll("\\?", "\\?").replaceAll("\\$", "\\$").replaceAll("\\|",
                "\\|").replaceAll("\\^", "\\^").replaceAll("\\.", "\\.");
    }
1206569
function(input) {
    return input.replace(/\{{2,}/g, function(match) {
      return match.length > 2 ? match.substr(2) : '<%=';
    }).replace(/\}{2,}/g, function(match) {
      return match.length > 2 ? match.substr(2) : '%>';
    });
  }
437713
public static String doubleDecodeBrackets(final String input) {
		if (input == null || input.length() == 0) {  // For performance reasons don't use Util.empty
			return input;
		}
		return DOUBLE_DECODE_BRACKETS.translate(input);
	}
372748
public static String getImageFormat(ImageInputStream input) {
        Iterator<ImageReader> readers = ImageIO.getImageReaders(input);
        String format = "unknown";
        if (readers.hasNext()) {
            ImageReader reader = readers.next();
            try {
                format = reader.getFormatName();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                reader.dispose();
            }
        }

        return format;
    }