Java Code Examples for java.util.regex.Pattern#equals()
The following examples show how to use
java.util.regex.Pattern#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractGeospatialType.java From olingo-odata4 with Apache License 2.0 | 6 votes |
private Matcher getMatcher(final Pattern pattern, final String value) throws EdmPrimitiveTypeException { final Matcher matcher = pattern.matcher(value); if (!matcher.matches()) { throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content."); } Geospatial.Dimension _dimension = null; Geospatial.Type _type = null; try { _dimension = Geospatial.Dimension.valueOf(matcher.group(1).toUpperCase()); _type = Geospatial.Type.valueOf(matcher.group(3).toUpperCase()); } catch (IllegalArgumentException e) { throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content.", e); } if (_dimension != this.dimension || (!pattern.equals(COLLECTION_PATTERN) && _type != this.type)) { throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content."); } return matcher; }
Example 2
Source File: TestBlockCopier.java From RDFS with Apache License 2.0 | 6 votes |
@Override protected Map<String, Integer> getLostFiles( Pattern pattern, String[] dfsckArgs) throws IOException { Map<String, Integer> map = new HashMap<String, Integer>(); // Disable CorruptionMonitor if (pattern.equals(DistBlockIntegrityMonitor.LIST_CORRUPT_FILE_PATTERN)) { return map; } for (String file : TestBlockCopier.decommissioningFiles) { map.put(file, 1); } return map; }
Example 3
Source File: AvContentUtil.java From xipl with Apache License 2.0 | 5 votes |
/** * Returns a given attribute for an M3U playlist file based on it's parameter. * * @param attribute an attribute as found in {@link Constants} * @param playlistLine a line from a given playlist. * @return The attribute for that line. */ private static String getAttributeFromPlaylistLine(Pattern attribute, String playlistLine) { Matcher matcher = attribute.matcher(playlistLine); if (matcher.find()) { String[] parts = matcher.group().split("="); String contents = parts[1].replace("\"", ""); /* It might be possible that the title isn't in the tvg-name tag, retrieve it from the region after the comma. */ if (TextUtils.isEmpty(contents) && attribute.equals(Constants.ATTRIBUTE_TVG_NAME_PATTERN)) { Pattern commaPattern = Pattern.compile(",.*"); Matcher commaMatcher = commaPattern.matcher(playlistLine); if (commaMatcher.find()) { // Don't include the first comma in the title return (commaMatcher.group().substring(1)); } } return (contents); } else { return (""); } }