/** Returns {@code true} if the specified factory is built by the vendor. */ @Override public boolean test(final Factory factory) { return Citations.titleMatches(factory.getVendor(), vendor); } }
/** * Returns a citation of the given name. If the given name matches a {@linkplain * Citation#getTitle title} or an {@linkplain Citation#getAlternateTitles alternate titles} of * one of the pre-defined constants ({@link #EPSG}, {@link #GEOTIFF}, <cite>etc.</cite>), then * this constant is returned. Otherwise, a new citation is created with the specified name as * the title. * * @param title The citation title (or alternate title). * @return A citation using the specified name */ public static Citation fromName(final String title) { for (int i = 0; i < AUTHORITIES.length; i++) { final Citation citation = AUTHORITIES[i]; if (titleMatches(citation, title)) { return citation; } } return new CitationImpl(title); }
/** * Returns {@code true} if any {@linkplain Citation#getIdentifiers identifiers} in the given * citation matches the given string. The comparaison is case-insensitive and ignores leading * and trailing spaces. If (and <em>only</em> if) the citation do not contains any identifier, * then this method fallback on titles comparaison using the {@link #titleMatches(Citation, * String) titleMatches} method. This fallback exists for compatibility with client codes using * citation {@linkplain Citation#getTitle titles} without identifiers. * * @param citation The citation to check for. * @param identifier The identifier to compare. * @return {@code true} if the title or alternate title matches the given string. */ public static boolean identifierMatches(final Citation citation, String identifier) { identifier = identifier.trim(); final Collection<? extends Identifier> identifiers = citation.getIdentifiers(); for (final Identifier id : identifiers) { final String code = id.getCode().trim(); if (identifier.equalsIgnoreCase(code)) { return true; } } if (identifiers.isEmpty()) { return titleMatches(citation, identifier); } else { return false; } }
if (titleMatches(c1, asString)) { return true; if (asLocalized != asString && titleMatches(c1, asLocalized)) { return true;
iterator = c1.getIdentifiers().iterator(); if (!iterator.hasNext()) { return titleMatches(c1, c2);
/** * Returns a citation of the given name. If the given name matches a {@linkplain * Citation#getTitle title} or an {@linkplain Citation#getAlternateTitles alternate titles} * of one of the pre-defined constants ({@link #EPSG}, {@link #GEOTIFF}, <cite>etc.</cite>), * then this constant is returned. Otherwise, a new citation is created with the specified * name as the title. * * @param title The citation title (or alternate title). * @return A citation using the specified name */ public static Citation fromName(final String title) { for (int i=0; i<AUTHORITIES.length; i++) { final Citation citation = AUTHORITIES[i]; if (titleMatches(citation, title)) { return citation; } } return new CitationImpl(title); }
/** * Returns a citation of the given name. If the given name matches a {@linkplain * Citation#getTitle title} or an {@linkplain Citation#getAlternateTitles alternate titles} * of one of the pre-defined constants ({@link #EPSG}, {@link #GEOTIFF}, <cite>etc.</cite>), * then this constant is returned. Otherwise, a new citation is created with the specified * name as the title. * * @param title The citation title (or alternate title). * @return A citation using the specified name */ public static Citation fromName(final String title) { for (int i=0; i<AUTHORITIES.length; i++) { final Citation citation = AUTHORITIES[i]; if (titleMatches(citation, title)) { return citation; } } return new CitationImpl(title); }
/** * Returns {@code true} if any {@linkplain Citation#getIdentifiers identifiers} in the given * citation matches the given string. The comparaison is case-insensitive and ignores leading * and trailing spaces. If (and <em>only</em> if) the citation do not contains any identifier, * then this method fallback on titles comparaison using the {@link #titleMatches(Citation, * String) titleMatches} method. This fallback exists for compatibility with client codes using * citation {@linkplain Citation#getTitle titles} without identifiers. * * @param citation The citation to check for. * @param identifier The identifier to compare. * @return {@code true} if the title or alternate title matches the given string. */ public static boolean identifierMatches(final Citation citation, String identifier) { identifier = identifier.trim(); final Collection identifiers = citation.getIdentifiers(); for (final Iterator it=identifiers.iterator(); it.hasNext();) { final String id = ((String) it.next()).trim(); if (identifier.equalsIgnoreCase(id)) { return true; } } if (identifiers.isEmpty()) { return titleMatches(citation, identifier); } else { return false; } }
/** * Returns {@code true} if any {@linkplain Citation#getIdentifiers identifiers} in the given * citation matches the given string. The comparaison is case-insensitive and ignores leading * and trailing spaces. If (and <em>only</em> if) the citation do not contains any identifier, * then this method fallback on titles comparaison using the {@link #titleMatches(Citation, * String) titleMatches} method. This fallback exists for compatibility with client codes using * citation {@linkplain Citation#getTitle titles} without identifiers. * * @param citation The citation to check for. * @param identifier The identifier to compare. * @return {@code true} if the title or alternate title matches the given string. */ public static boolean identifierMatches(final Citation citation, String identifier) { identifier = identifier.trim(); final Collection<? extends Identifier> identifiers = citation.getIdentifiers(); for (final Identifier id : identifiers) { final String code = id.getCode().trim(); if (identifier.equalsIgnoreCase(code)) { return true; } } if (identifiers.isEmpty()) { return titleMatches(citation, identifier); } else { return false; } }
do { final String asString = candidate.toString(Locale.US); if (titleMatches(c1, asString)) { return true; if (asLocalized!=asString && titleMatches(c1, asLocalized)) { return true;
if (titleMatches(c1, asString)) { return true; if (asLocalized!=asString && titleMatches(c1, asLocalized)) { return true;
iterator = c1.getIdentifiers().iterator(); if (!iterator.hasNext()) { return titleMatches(c1, c2);
iterator = c1.getIdentifiers().iterator(); if (!iterator.hasNext()) { return titleMatches(c1, c2);