Appends an operating system pattern to the map of pattern sorted by ID.

@param pattern
a pattern for a browser
@throws net.sf.qualitycheck.exception.IllegalNullArgumentException
if the pattern is {@code null}
@return itself
547498
@Nonnull
	public DataBuilder appendOperatingSystemPattern(@Nonnull final OperatingSystemPattern pattern) {
		Check.notNull(pattern, "pattern");

		if (!operatingSystemPatterns.containsKey(pattern.getId())) {
			operatingSystemPatterns.put(pattern.getId(), new TreeSet<OperatingSystemPattern>(OS_PATTERN_COMPARATOR));
		}

		operatingSystemPatterns.get(pattern.getId()).add(pattern);
		return this;
	}
356326
public CustomFormatter create(final String pattern) {
        
        final CustomFormatTokenizer tokenizer = new CustomFormatTokenizer();
        final TokenStore allStore = tokenizer.parse(pattern);
        if(allStore.getTokens().isEmpty()) {
            // 標準のフォーマッタ
            return CustomFormatter.DEFAULT_FORMATTER;
            
        } else if(pattern.equalsIgnoreCase("General")) {
            return CustomFormatter.DEFAULT_FORMATTER;
        }
        
        // セクション単位に分割し、処理していく。
        final List<TokenStore> sections = allStore.split(Token.SYMBOL_SEMI_COLON);
        if(sections.size() > 4) {
            throw new CustomFormatterParseException(pattern,
                    String.format("section size over 4. but '%s' number of %d secitions.", pattern, sections.size()));
        }
        
        final CustomFormatter formatter = new CustomFormatter(pattern);
        boolean containsTextFormatter = false;
        for(TokenStore section : sections) {
            
            final ConditionFormatter conditionFormatter;
            if(textFormatterFactory.isTextPattern(section)) {
                conditionFormatter = textFormatterFactory.create(section);
                containsTextFormatter = true;
                
            } else if(dateFormatterFactory.isDatePattern(section)) {
                conditionFormatter = dateFormatterFactory.create(section);
                
            } else if(numberFormatterFactory.isNumberPattern(section)) {
                conditionFormatter = numberFormatterFactory.create(section);
                
            } else {
                conditionFormatter = numberFormatterFactory.create(section);
                
            }
            
            formatter.addConditionFormatter(conditionFormatter);
            
        }
        
        // 条件式の設定
        int sectionSize = sections.size();
        if(containsTextFormatter) {
            // 文字列の書式を含む場合は、個数から除外する。
            sectionSize--;
        }
        
        // 1番目の書式がデフォルトの条件の場合
        boolean hasConditionFirst = false;
        
        for(int i=0; i < sectionSize; i++) {
            
            final ConditionFormatter conditionFormatter = formatter.getConditionFormatters().get(i);
            if(conditionFormatter.getOperator() != null) {
                if(i == 0) {
                    hasConditionFirst = true;
                }
                continue;
            }
            
            if(sectionSize <= 1) {
                // 書式が1つしかない場合
                conditionFormatter.setOperator(ConditionOperator.ALL);
                
            } else if(sectionSize == 2) {
                if(i==0) {
                    // ゼロ以上の数の書式
                    conditionFormatter.setOperator(ConditionOperator.NON_NEGATIVE);
                    
                } else if(i==1) {
                    // その他の書式
                    if(hasConditionFirst) {
                        conditionFormatter.setOperator(ConditionOperator.ALL);
                    } else {
                        conditionFormatter.setOperator(ConditionOperator.NEGATIVE);
                    }
                }
                
            } else if(sectionSize == 3) {
                if(i==0) {
                    // 正の書式
                    conditionFormatter.setOperator(ConditionOperator.POSITIVE);
                    
                } else if(i==1) {
                    // 負の数の書式
                    conditionFormatter.setOperator(ConditionOperator.NEGATIVE);
                    
                } else {
                    // その他の書式
                    conditionFormatter.setOperator(ConditionOperator.ALL);
                    
                }
                
            } else if(sectionSize == 4) {
                if(i==0) {
                    // 正の書式
                    conditionFormatter.setOperator(ConditionOperator.POSITIVE);
                    
                } else if(i==1) {
                    // 負の数の書式
                    conditionFormatter.setOperator(ConditionOperator.NEGATIVE);
                    
                } else if(i==2) {
                    // ゼロの書式
                    conditionFormatter.setOperator(ConditionOperator.ZERO);
                    
                } else {
                    // その他の書式
                    conditionFormatter.setOperator(ConditionOperator.ALL);
                    
                }
                
            } else {
                throw new CustomFormatterParseException(pattern,
                        String.format("section size over 4. but '%s' number of %d secitions.", pattern, sections.size()));
            }
            
        }
        
        return formatter;
    }
94319
@SuppressWarnings("unchecked")
	public static void registerPattern(String id, String pattern, ParserContext parserContext) {
		if (!"".equals(id)) { // add to sitemap only if it has an id
			BeanDefinitionRegistry registry = parserContext.getRegistry();
			BeanDefinition sitemapBean;
			try {
				sitemapBean = registry.getBeanDefinition(BEAN_ID);
			} catch (NoSuchBeanDefinitionException e) {
				sitemapBean = BeanDefinitionBuilder.genericBeanDefinition(Sitemap.class)
					.addPropertyValue(BEAN_PROP_ENTRIES, new HashMap<String, String>())
					.getBeanDefinition();
				registry.registerBeanDefinition(BEAN_ID, sitemapBean);
			}
			((Map<String, String>) sitemapBean.getPropertyValues().getPropertyValue(BEAN_PROP_ENTRIES).getValue()).put(id, pattern);
		}
	}
187184
public static String preProcessPattern(String pattern) {
		int index = pattern.indexOf('\\');
		if (index < 0) {
			return pattern;
		}

		StringBuilder sb = new StringBuilder();
		for (int pos = 0; pos < pattern.length();) {
			char ch = pattern.charAt(pos);
			if (ch != '\\') {
				sb.append(ch);
				pos++;
				continue;
			}
			if (pos + 1 >= pattern.length()) {
				// we'll end the pattern with a '\\' char
				sb.append(ch);
				break;
			}
			ch = pattern.charAt(++pos);
			switch (ch) {
				case 'b':
					sb.append('\b');
					pos++;
					break;
				case 'f':
					sb.append('\f');
					pos++;
					break;
				case 'n':
					sb.append('\n');
					pos++;
					break;
				case '0':
				case '1':
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '7': {
					// 1-3 octal characters: \1 \01 or \017
					pos += radixCharsToChar(sb, pattern, pos, 3, 8);
					break;
				}
				case 'r':
					sb.append('\r');
					pos++;
					break;
				case 't':
					sb.append('\t');
					pos++;
					break;
				case 'x': {
					// 1-2 hex characters: \xD or \xD9
					int adjust = radixCharsToChar(sb, pattern, pos + 1, 2, 16);
					if (adjust > 0) {
						// adjust by 1 for the x
						pos += 1 + adjust;
					} else {
						sb.append(ch);
						pos++;
					}
					break;
				}
				case ' ':
				case '\\':
				default:
					sb.append(ch);
					pos++;
					break;
			}
		}
		return sb.toString();
	}
802709
private void setBrowserPattern(List<Pattern> pattern) {

        if ((pattern == null) || (pattern.size() == 0)) {
            setValidConfiguration(false);
            LOG.error(Messages.get().getBundle().key(Messages.LOG_EDITOR_CONFIG_NO_PATTERN_0));
        }
        m_browserPattern = pattern;
    }
910374
public static String format(Date date, String pattern) {
		return new DateTime(date.getTime()).toString(pattern);
	}
1098653
public static boolean isValidPattern(String pattern) {
    if (pattern == null) {
      return false;
    }
    String canon = pattern.replace('/', '.');
    return ClassName.isQualifiedName(canon)
        || ClassName.isStarQualifiedName(canon);
  }
418961
def append(self, pattern):
        """"""
        assert isinstance(pattern, Pattern)
        self.patterns.append(pattern)
        if self._all_files is not None:
            self._all_files = self._all_files or pattern.all_files()
1346393
String format(String pattern) {
        return String.format(pattern, this.domain, this.major, this.minor);
    }
696481
public void compile(String pattern) {
		this.expandedPattern = expand(pattern);
		
		// Compile the regex
		if (!expandedPattern.isEmpty()) {
			regexp = Pattern.compile(expandedPattern);
		} else {
			throw new IllegalArgumentException("Pattern is not found '"
					+ pattern + "'");
		}
	}
41165
public void setPattern(String pattern) throws IllegalArgumentException{
		if (pattern == null) {
			throw new IllegalArgumentException("The pattern must not be null.");
		}

		this.pattern = pattern;
		parsePattern(this.pattern);
	}
1251499
public Router put(@NotNull final String pattern, @NotNull final IMiddleware... handlers) {
        addPattern("PUT", pattern, handlers, putBindings);
        return this;
    }
32896
protected static Map<Character, Integer> match_alphabet(String pattern) {
        Map<Character, Integer> s = new HashMap<Character, Integer>();
        char[] char_pattern = pattern.toCharArray();
        for (char c : char_pattern) {
            s.put(c, 0);
        }
        int i = 0;
        for (char c : char_pattern) {
            s.put(c, s.get(c) | (1 << (pattern.length() - i - 1)));
            i++;
        }
        return s;
    }
739209
public static List<String> getCamelKeys(String pattern) {
        List<String> keys = new ArrayList<String>();
        for (String s : getOriginalKeys(pattern)) {
            keys.add(StringUtil.underlineToCamel(s));
        }
        return keys;
    }
901396
public static Pattern compile(String pattern) throws IllegalArgumentException {
        if (pattern == null) {
            throw new IllegalArgumentException("Pattern can not be null");
        }

        if (pattern.startsWith("/") && pattern.endsWith("/") && pattern.length() > 1) {
            // This is a regular expression
            // So create matcher as is
            try {
                return Pattern.compile(pattern.substring(1, pattern.length() - 1));
            } catch (PatternSyntaxException e) {
                throw new IllegalArgumentException("Pattern contains an invalid expression", e);
            }
        }

        StringBuilder rEPattern = new StringBuilder("^");

        for (int i = 0; i < pattern.length(); i++) {
            if (pattern.charAt(i) == '*')
                rEPattern.append('.');
            if (pattern.charAt(i) == '?') {
                rEPattern.append('.');
            } else {
                rEPattern.append(pattern.charAt(i));
            }
        }

        rEPattern.append("$");

        try {
            return Pattern.compile(rEPattern.toString());
        } catch (PatternSyntaxException e) {
            throw new IllegalArgumentException("Pattern contains an invalid expression", e);
        }
    }
545883
public synchronized String format(final String pattern, final Object... args) {
		Map<String, Object> model = Collections.emptyMap();
		ModelAdaptor modelAdaptor = new ModelAdaptor() {

			@Override
			public Object getValue(TemplateContext context, Token token, List<String> segments, String expression) {
				int index = Integer.parseInt(expression) - 1;
				return args[index];
			}

            @Override
            public Iterable<Object> getIterable(Object value) {
                return null;
            }

            @Override
            public String getSpecialIteratorVariable() {
                return null;
            }

        };

		String output = transformInternal(pattern, null, model, modelAdaptor, null);
		return output;
	}
103178
public static WildcardPattern[] create(@Nullable String[] patterns) {
    if (patterns == null) {
      return new WildcardPattern[0];
    }
    WildcardPattern[] exclusionPAtterns = new WildcardPattern[patterns.length];
    for (int i = 0; i < patterns.length; i++) {
      exclusionPAtterns[i] = create(patterns[i]);
    }
    return exclusionPAtterns;
  }