/** * Returns the element at the given index. */ @Override public E get(final int index) { ArgumentChecks.ensureValidIndex(size, index); return super.get(index + lower); }
/** * Returns the element at the given index. */ @Override public E get(final int index) { ArgumentChecks.ensureValidIndex(size, index); return super.get(index + lower); }
/** * Returns every element in the sequence of {@linkplain #getParsedNames() parsed names} * except for the {@linkplain #tip() tip}. * * @return all elements except the last one in the in the list of {@linkplain #getParsedNames() parsed names}. */ @Override public synchronized GenericName path() { if (path == null) { final int size = parsedNames.size(); switch (size) { default: path = new DefaultScopedName(parsedNames.subList(0, size-1)); break; case 2: path = parsedNames.get(0); break; case 1: // fall through case 0: throw new AssertionError(size); } } return path; }
/** * Returns every elements in the sequence of {@linkplain #getParsedNames() parsed names} * except for the {@linkplain #head() head}. * * @return all elements except the first one in the in the list of {@linkplain #getParsedNames() parsed names}. */ @Override public synchronized GenericName tail() { if (tail == null) { final int size = parsedNames.size(); switch (size) { default: tail = new DefaultScopedName(parsedNames.subList(1, size)); break; case 2: tail = parsedNames.get(1); break; case 1: // fall through case 0: throw new AssertionError(size); } } return tail; }
/** * Returns every elements in the sequence of {@linkplain #getParsedNames() parsed names} * except for the {@linkplain #head() head}. * * @return all elements except the first one in the in the list of {@linkplain #getParsedNames() parsed names}. */ @Override public synchronized GenericName tail() { if (tail == null) { final int size = parsedNames.size(); switch (size) { default: tail = new DefaultScopedName(parsedNames.subList(1, size)); break; case 2: tail = parsedNames.get(1); break; case 1: // fall through case 0: throw new AssertionError(size); } } return tail; }
/** * Returns every element in the sequence of {@linkplain #getParsedNames() parsed names} * except for the {@linkplain #tip() tip}. * * @return all elements except the last one in the in the list of {@linkplain #getParsedNames() parsed names}. */ @Override public synchronized GenericName path() { if (path == null) { final int size = parsedNames.size(); switch (size) { default: path = new DefaultScopedName(parsedNames.subList(0, size-1)); break; case 2: path = parsedNames.get(0); break; case 1: // fall through case 0: throw new AssertionError(size); } } return path; }
/** * Creates a new scoped names from the given list of local names. This constructor is * not public because we do not check if the given local names have the proper scope. * * @param names the names to gives to the new scoped name. */ static AbstractName create(final UnmodifiableArrayList<? extends DefaultLocalName> names) { ArgumentChecks.ensureNonNull("names", names); switch (names.size()) { default: return new DefaultScopedName(names); case 1: return names.get(0); case 0: throw new IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, "names")); } }
/** * Creates a new scoped names from the given list of local names. This constructor is * not public because we do not check if the given local names have the proper scope. * * @param names the names to gives to the new scoped name. */ static AbstractName create(final UnmodifiableArrayList<? extends DefaultLocalName> names) { ArgumentChecks.ensureNonNull("names", names); switch (names.size()) { default: return new DefaultScopedName(names); case 1: return names.get(0); case 0: throw new IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, "names")); } }