/** * Returns the first element in the sequence of {@linkplain #getParsedNames parsed names}. * * @since 2.6 */ public LocalName head() { return getName().head(); }
/** * Returns the first element in the sequence of {@linkplain #getParsedNames() parsed names}. * By default, this is the same value than the {@linkplain #getCodeSpace() code space} provided as a local name. * * @return the first element in the list of {@linkplain #getParsedNames() parsed names}. * * @see #scope() * @see #getCodeSpace() */ @Override public LocalName head() { return getName().head(); }
/** * Returns the first element in the sequence of {@linkplain #getParsedNames() parsed names}. * By default, this is the same value than the {@linkplain #getCodeSpace() code space} provided as a local name. * * @return the first element in the list of {@linkplain #getParsedNames() parsed names}. * * @see #scope() * @see #getCodeSpace() */ @Override public LocalName head() { return getName().head(); }
/** * Infers the authority from the scope if any, or from the code space otherwise. * * @return the authority, or {@code null} if none. */ @Override public Citation getAuthority() { GenericName scope = scope(name); if (scope == null) { scope = scope(name.tip()); if (scope == null) { return null; } } return Citations.fromName(scope.head().toString()); }
/** * Infers the authority from the scope if any, or from the code space otherwise. * * @return the authority, or {@code null} if none. */ @Override public Citation getAuthority() { GenericName scope = scope(name); if (scope == null) { scope = scope(name.tip()); if (scope == null) { return null; } } return Citations.fromName(scope.head().toString()); }
size, object.depth()); assertSame("GenericName: head() should be the first element in getParsedNames() list.", parsedNames.get(0), object.head()); assertSame("GenericName: tip() should be the last element in getParsedNames() list.", parsedNames.get(size-1), object.tip());
size, object.depth()); assertEquals("GenericName: head() shall be the first element in getParsedNames() list.", parsedNames.get(0), object.head()); assertEquals("GenericName: tip() shall be the last element in getParsedNames() list.", parsedNames.get(size-1), object.tip());
if (org.apache.sis.metadata.iso.citation.Citations.identifierMatches(authority, alias.head().toString())) { final String name = alias.tip().toString().trim(); if (ArraysExt.contains(IGNORE, name)) {
buffer.append(", "); final GenericName head = alias.head(); if (head == alias || Constants.EPSG.equalsIgnoreCase(head.toString())) { buffer.append(alias.tip());
GenericName name = factory.createLocalName(null, "http"); assertEquals(1, name.depth()); assertEquals("http", name.head().toString()); assertEquals("http", name.tip().toString()); NameSpace ns = createNameSpace(name, "://", "."); assertEquals("www", name.head().toString()); assertEquals("net", name.tip().toString()); ns = createNameSpace(name, "/", "/"); assertEquals("gml", name.head().toString()); assertEquals("epsg.xml", name.tip().toString()); ns = createNameSpace(name, "#", ":"); assertEquals("4326", name.head().toString()); assertEquals("4326", name.tip().toString()); validate(name); assertEquals("http://www.opengis.net/gml/srs/epsg.xml#4326", name.toString()); assertEquals(8, name.depth()); assertEquals("http", name.head().toString()); assertEquals("4326", name.tip().toString());
/** * Ensures that ISO 19103 or GeoAPI restrictions apply, then checks for yet more restrictive * Geotk conditions. This method requires the exact same instance where GeoAPI requires only * instances that are {@linkplain Object#equals(Object) equal}. * * @param object The object to validate, or {@code null}. */ @Override public void validate(final ScopedName object) { super.validate(object); if (object != null) { final List<? extends LocalName> parsedNames = object.getParsedNames(); assertSame("ScopedName: head.scope shall be same than scope.", object.scope(), object.head().scope()); assertSame("GenericName: head() shall be the first element in getParsedNames() list.", parsedNames.get(0), object.head()); assertSame("GenericName: tip() shall be the last element in getParsedNames() list.", parsedNames.get(parsedNames.size()-1), object.tip()); assertSame("ScopedName: tip() and tail.tip() shall be the same.", object.tip(), object.tail().tip()); assertSame("ScopedName: head() and path.head() shall be the same.", object.head(), object.path().head()); } } }
GenericName name = factory.createLocalName(null, "http"); assertEquals(1, name.depth()); assertEquals("http", name.head().toString()); assertEquals("http", name.tip().toString()); assertEquals("http", name.toString()); assertEquals("www", name.head().toString()); assertEquals("net", name.tip().toString()); assertEquals("www.opengis.net", name.toString()); assertEquals("gml", name.head().toString()); assertEquals("epsg.xml", name.tip().toString()); assertEquals("gml/srs/epsg.xml", name.toString()); assertEquals("4326", name.head().toString()); assertEquals("4326", name.tip().toString()); assertEquals("4326", name.toString()); assertEquals("http://www.opengis.net/gml/srs/epsg.xml#4326", name.toString()); assertEquals(8, name.depth()); assertEquals("http", name.head().toString()); assertEquals("4326", name.tip().toString());
depth-1, path.depth()); assertSame("ScopedName: head() and path.head() should be the same.", object.head(), path.head()); if (parsedNames != null) { assertEquals("ScopedName: path() should be defined as subList(0, depth-1).",
depth-1, path.depth()); assertEquals("ScopedName: head() and path.head() shall be equal.", object.head(), path.head()); if (parsedNames != null) { assertEquals("ScopedName: path() shall be defined as subList(0, depth-1).",
/** * Writes the primary name and aliases. */ private void writeName(final ParameterDescriptor<?> param) throws IOException { final int td = openTag("td class=\"sep\""); openTag("details"); final ReferenceIdentifier name = param.getName(); final String codeSpace = name.getCodeSpace(); if (Constants.EPSG.equalsIgnoreCase(codeSpace)) { println("summary", escape(name.getCode())); } else { println("summary", "<span class=\"non-epsg\">" + codeSpace + ":</span>" + "<code>" + name.getCode() + "</code>"); } openTag("table class=\"aliases\""); for (final GenericName alias : param.getAlias()) { reopenTag("tr"); println("th", escape(alias.head().toString() + ':')); println("td", escape(alias.tip().toString())); } closeTags(td); }
assertEquals("OGC", alias.head().toString()); assertEquals("OGC:central_meridian", alias.toString());