This method applies the {@link HyphenationPattern pattern} matching at the given {@code offset}.

@param pattern is the matching {@link HyphenationPattern pattern}.
@param pos is the offset in the word to hyphenate.
4760
private void apply(HyphenationPattern pattern, int pos) {

    int internalOffset = pos - 2;
    HyphenationPatternPosition[] positions = pattern.getHyphenationPositions();
    for (HyphenationPatternPosition hyphenationPosition : positions) {
      int i = hyphenationPosition.index + internalOffset;
      if ((i >= 0) && (i < this.rankings.length) && (hyphenationPosition.ranking > this.rankings[i])) {
        this.rankings[i] = hyphenationPosition.ranking;
      }
    }
  }
848057
private int getMatchingPoint(String pattern, String itemName) {
        int index = pattern.indexOf('*');
        if (index == -1) {
            return -1;
        }

        String firstPart = pattern.substring(0, index);
        if (!itemName.startsWith(firstPart)) {
            return -1;
        }

        String secondPart = pattern.substring(index + 1);
        if (!itemName.endsWith(secondPart)) {
            return -1;
        }

        return firstPart.length() + secondPart.length();
    }
208004
public static Pattern compilePattern(final String expr) {
        Pattern pattern;
        final int lastChar = expr.length() - 1;
        if (expr.charAt(0) == '/' && expr.charAt(lastChar) == '/') {
            pattern = Pattern.compile(expr.substring(1, lastChar));
        } else {
            pattern = Pattern.compile(Pattern.quote(expr));
        }
        return pattern;
    }
722949
private void scanFractionAndSuffix(int pos) {
        radix = 10;
        scanFraction(pos);
        if (reader.ch == 'f' || reader.ch == 'F') {
            reader.putChar(true);
            tk = TokenKind.FLOATLITERAL;
        } else {
            if (reader.ch == 'd' || reader.ch == 'D') {
                reader.putChar(true);
            }
            tk = TokenKind.DOUBLELITERAL;
        }
    }
573617
public void addSynchronizeExcludePattern(String pattern) {

        try {
            m_synchronizeExcludePatterns.add(Pattern.compile(pattern));
        } catch (PatternSyntaxException e) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SYNCHRONIZE_EXCLUDE_PATTERN_1, pattern), e);
        }
    }
1036067
public static DecimalFormat decimalFormat(final String pattern)
    {
        DecimalFormat decFmt = context.get().getDecimalFormat();
        decFmt.applyPattern(pattern);
        return decFmt;
    }
1215058
private int readArgumentIndex(final String pattern, final ParsePosition pos) {
        final int start = pos.getIndex();
        seekNonWs(pattern, pos);
        final StringBuilder result = new StringBuilder();
        boolean error = false;
        for (; !error && pos.getIndex() < pattern.length(); next(pos)) {
            char c = pattern.charAt(pos.getIndex());
            if (Character.isWhitespace(c)) {
                seekNonWs(pattern, pos);
                c = pattern.charAt(pos.getIndex());
                if (c != START_FMT && c != END_FE) {
                    error = true;
                    continue;
                }
            }
            if ((c == START_FMT || c == END_FE) && result.length() > 0) {
                try {
                    return Integer.parseInt(result.toString());
                } catch (final NumberFormatException e) { // NOPMD
                    // we've already ensured only digits, so unless something
                    // outlandishly large was specified we should be okay.
                }
            }
            error = !Character.isDigit(c);
            result.append(c);
        }
        if (error) {
            throw new IllegalArgumentException(
                    "Invalid format argument index at position " + start + ": "
                            + pattern.substring(start, pos.getIndex()));
        }
        throw new IllegalArgumentException(
                "Unterminated format element at position " + start);
    }
863058
private void getQuotedString(String pattern, ParsePosition pos, boolean escapingOn)
    {

        appendQuotedString(pattern, pos, null, escapingOn);
    }
857939
public static TokenRegex compile(String pattern) throws ParseException {
      ExpressionIterator p = QueryToPredicate.PARSER.parse(pattern);
      Expression exp;
      TransitionFunction top = null;
      while ((exp = p.next()) != null) {
         if (top == null) {
            top = consumerize(exp);
         } else {
            top = new TransitionFunction.Sequence(top, consumerize(exp));
         }
      }
      return new TokenRegex(top);
   }
319531
public void setPattern(final ConwayPattern pattern) {
        final boolean[][] gridData = pattern.getPattern();
        int gridWidth = gridData[0].length;
        int gridHeight = gridData.length;

        int columnOffset = 0;
        int rowOffset = 0;

        if ( gridWidth > getNumberOfColumns() ) {
            gridWidth = getNumberOfColumns();
        } else {
            columnOffset = (getNumberOfColumns() - gridWidth) / 2;
        }

        if ( gridHeight > getNumberOfRows() ) {
            gridHeight = getNumberOfRows();
        } else {
            rowOffset = (getNumberOfRows() - gridHeight) / 2;
        }

        this.delegate.killAll();

        for ( int column = 0; column < gridWidth; column++ ) {
            for ( int row = 0; row < gridHeight; row++ ) {
                if ( gridData[row][column] ) {
                    final Cell cell = getCellAt( row + rowOffset,
                                                 column + columnOffset );
                    updateCell( cell, CellState.LIVE );
                }
            }
        }

        //this.delegate.setPattern();
    }
215844
public void applyPatterns(String[] patterns)
   {
      m_formats = new SimpleDateFormat[patterns.length];
      for (int index = 0; index < patterns.length; index++)
      {
         m_formats[index] = new SimpleDateFormat(patterns[index]);
      }
   }
1281320
public static final String prefix(String pattern)
    {
        int idx = CharSequences.lastIndexOf(pattern, BeanHelper::separator);
        if (idx != -1)
        {
            return pattern.substring(0, idx);
        }
        else
        {
            return "";
        }
    }
1361337
private static void parsePatternTo(DateTimeFormatterBuilder builder, String pattern) {
        int length = pattern.length();
        int[] indexRef = new int[1];

        for (int i=0; i<length; i++) {
            indexRef[0] = i;
            String token = parseToken(pattern, indexRef);
            i = indexRef[0];

            int tokenLen = token.length();
            if (tokenLen == 0) {
                break;
            }
            char c = token.charAt(0);

            switch (c) {
            case 'G': // era designator (text)
                builder.appendEraText();
                break;
            case 'C': // century of era (number)
                builder.appendCenturyOfEra(tokenLen, tokenLen);
                break;
            case 'x': // weekyear (number)
            case 'y': // year (number)
            case 'Y': // year of era (number)
                if (tokenLen == 2) {
                    boolean lenientParse = true;

                    // Peek ahead to next token.
                    if (i + 1 < length) {
                        indexRef[0]++;
                        if (isNumericToken(parseToken(pattern, indexRef))) {
                            // If next token is a number, cannot support
                            // lenient parse, because it will consume digits
                            // that it should not.
                            lenientParse = false;
                        }
                        indexRef[0]--;
                    }

                    // Use pivots which are compatible with SimpleDateFormat.
                    switch (c) {
                    case 'x':
                        builder.appendTwoDigitWeekyear
                            (new DateTime().getWeekyear() - 30, lenientParse);
                        break;
                    case 'y':
                    case 'Y':
                    default:
                        builder.appendTwoDigitYear(new DateTime().getYear() - 30, lenientParse);
                        break;
                    }
                } else {
                    // Try to support long year values.
                    int maxDigits = 9;

                    // Peek ahead to next token.
                    if (i + 1 < length) {
                        indexRef[0]++;
                        if (isNumericToken(parseToken(pattern, indexRef))) {
                            // If next token is a number, cannot support long years.
                            maxDigits = tokenLen;
                        }
                        indexRef[0]--;
                    }

                    switch (c) {
                    case 'x':
                        builder.appendWeekyear(tokenLen, maxDigits);
                        break;
                    case 'y':
                        builder.appendYear(tokenLen, maxDigits);
                        break;
                    case 'Y':
                        builder.appendYearOfEra(tokenLen, maxDigits);
                        break;
                    }
                }
                break;
            case 'M': // month of year (text and number)
                if (tokenLen >= 3) {
                    if (tokenLen >= 4) {
                        builder.appendMonthOfYearText();
                    } else {
                        builder.appendMonthOfYearShortText();
                    }
                } else {
                    builder.appendMonthOfYear(tokenLen);
                }
                break;
            case 'd': // day of month (number)
                builder.appendDayOfMonth(tokenLen);
                break;
            case 'a': // am/pm marker (text)
                builder.appendHalfdayOfDayText();
                break;
            case 'h': // clockhour of halfday (number, 1..12)
                builder.appendClockhourOfHalfday(tokenLen);
                break;
            case 'H': // hour of day (number, 0..23)
                builder.appendHourOfDay(tokenLen);
                break;
            case 'k': // clockhour of day (1..24)
                builder.appendClockhourOfDay(tokenLen);
                break;
            case 'K': // hour of halfday (0..11)
                builder.appendHourOfHalfday(tokenLen);
                break;
            case 'm': // minute of hour (number)
                builder.appendMinuteOfHour(tokenLen);
                break;
            case 's': // second of minute (number)
                builder.appendSecondOfMinute(tokenLen);
                break;
            case 'S': // fraction of second (number)
                builder.appendFractionOfSecond(tokenLen, tokenLen);
                break;
            case 'e': // day of week (number)
                builder.appendDayOfWeek(tokenLen);
                break;
            case 'E': // dayOfWeek (text)
                if (tokenLen >= 4) {
                    builder.appendDayOfWeekText();
                } else {
                    builder.appendDayOfWeekShortText();
                }
                break;
            case 'D': // day of year (number)
                builder.appendDayOfYear(tokenLen);
                break;
            case 'w': // week of weekyear (number)
                builder.appendWeekOfWeekyear(tokenLen);
                break;
            case 'z': // time zone (text)
                if (tokenLen >= 4) {
                    builder.appendTimeZoneName();
                } else {
                    builder.appendTimeZoneShortName(null);
                }
                break;
            case 'Z': // time zone offset
                if (tokenLen == 1) {
                    builder.appendTimeZoneOffset(null, "Z", false, 2, 2);
                } else if (tokenLen == 2) {
                    builder.appendTimeZoneOffset(null, "Z", true, 2, 2);
                } else {
                    builder.appendTimeZoneId();
                }
                break;
            case '\'': // literal text
                String sub = token.substring(1);
                if (sub.length() == 1) {
                    builder.appendLiteral(sub.charAt(0));
                } else {
                    // Create copy of sub since otherwise the temporary quoted
                    // string would still be referenced internally.
                    builder.appendLiteral(new String(sub));
                }
                break;
            default:
                throw new IllegalArgumentException
                    ("Illegal pattern component: " + token);
            }
        }
    }
364896
private void patternSource(PatternDescrBuilder<?> pattern) throws RecognitionException {
        match(input,
                DRL6Lexer.ID,
                DroolsSoftKeywords.FROM,
                null,
                DroolsEditorType.KEYWORD);
        if (state.failed)
            return;

        if (state.backtracking == 0) {
            helper.emit(Location.LOCATION_LHS_FROM);
        }

        if (helper.validateIdentifierKey(DroolsSoftKeywords.ACCUMULATE) || helper.validateIdentifierKey(DroolsSoftKeywords.ACC)) {
            fromAccumulate(pattern);
        } else if (helper.validateIdentifierKey(DroolsSoftKeywords.COLLECT)) {
            fromCollect(pattern);
        } else if (helper.validateIdentifierKey(DroolsSoftKeywords.ENTRY) &&
                helper.validateLT(2,
                        "-") &&
                helper.validateLT(3,
                        DroolsSoftKeywords.POINT)) {
            fromEntryPoint(pattern);
            if (state.failed)
                return;
        } else if (helper.validateIdentifierKey(DroolsSoftKeywords.WINDOW)) {
            fromWindow(pattern);
        } else {
            fromExpression(pattern);
            if (!lastTokenWasWhiteSpace() && input.LA(1) == DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_FROM);
                throw new RecognitionException();
            }
            if (state.failed)
                return;
        }
        if (input.LA(1) == DRL6Lexer.SEMICOLON) {
            match(input,
                    DRL6Lexer.SEMICOLON,
                    null,
                    null,
                    DroolsEditorType.SYMBOL);
            if (state.failed)
                return;
        }
    }
1048471
@Deprecated
    public void setPattern(Pattern pattern) {
        patterns = new ArrayList<Pattern>(1);
        patterns.add(pattern);
    }
75431
public void apply(HyphenationPattern pattern) {

    String wordPart = pattern.getWordPart();
    int wordPartLength = wordPart.length();
    int wordPartHash = pattern.getWordPartHash();
    int[] subHashes = getHashes(wordPartLength);
    if (subHashes.length == 0) {
      return;
    }
    int start = 0;
    int end = subHashes.length - 1;
    if (wordPart.charAt(0) == HyphenationPattern.TERMINATOR) {
      end = 0;
    } else if (wordPart.charAt(wordPartLength - 1) == HyphenationPattern.TERMINATOR) {
      start = end;
    }
    for (int i = start; i <= end; i++) {
      if (subHashes[i] == wordPartHash) {
        if (isSubstring(this.normalizedWord, wordPart, i)) {
          apply(pattern, i);
        }
      }
    }
  }
380066
@Override
	public Date parse(String text, ParsePosition pos) {
		text = convertW3cTimeZoneToRfc822(text); 
		if (pattern == Pattern.AUTO) {
			return autoParse(text, pos);
		}
		return super.parse(text, pos);
	}