/** * Returns the list of all available systems of units. * * @return list of available systems of units. */ @Override public Collection<SystemOfUnits> getAvailableSystemsOfUnits() { return UnmodifiableArrayList.<SystemOfUnits>wrap(systems); }
/** * Returns the size of the backing array. * This is used only has a hint for optimizations in attempts to share internal arrays. */ @Override final int arraySize() { return parsedNames.arraySize(); }
/** * 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 the index in this list of the first occurrence of the specified element, * or -1 if the list does not contain the element. * * @param object the element to search for. * @return the index of the first occurrence of the given object, or {@code -1}. */ @Override public int indexOf(final Object object) { final int lower = lower(); final int upper = lower + size(); if (object == null) { for (int i=lower; i<upper; i++) { if (array[i] == null) { return i - lower; } } } else { for (int i=lower; i<upper; i++) { if (object.equals(array[i])) { return i - lower; } } } return -1; }
/** * 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")); } }
/** * 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 index in this list of the last occurrence of the specified element, * or -1 if the list does not contain the element. * * @param object the element to search for. * @return the index of the last occurrence of the given object, or {@code -1}. */ @Override public int lastIndexOf(final Object object) { final int lower = lower(); int i = lower + size(); if (object == null) { while (--i >= lower) { if (array[i] == null) { break; } } } else { while (--i >= lower) { if (object.equals(array[i])) { break; } } } return i - lower; }
/** * 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")); } }
/** * Returns the element at the given index. */ @Override public E get(final int index) { ArgumentChecks.ensureValidIndex(size, index); return super.get(index + lower); }
/** * Returns information about the <cite>range</cite> of this grid coverage. * Information include names, sample value ranges, fill values and transfer functions for all bands in this grid coverage. * * @return names, value ranges, fill values and transfer functions for all bands in this grid coverage. */ public List<SampleDimension> getSampleDimensions() { return UnmodifiableArrayList.wrap(sampleDimensions); }
/** * 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 the index in this list of the last occurrence of the specified element, * or -1 if the list does not contain the element. * * @param object the element to search for. * @return the index of the last occurrence of the given object, or {@code -1}. */ @Override public int lastIndexOf(final Object object) { final int lower = lower(); int i = lower + size(); if (object == null) { while (--i >= lower) { if (array[i] == null) { break; } } } else { while (--i >= lower) { if (object.equals(array[i])) { break; } } } return i - lower; }
/** * Returns the size of the backing array. * This is used only has a hint for optimizations in attempts to share internal arrays. */ @Override final int arraySize() { return parsedNames.arraySize(); }
/** * Returns all tables in declaration order. * The list contains only the tables explicitly requested at construction time. * * @return all tables in an unmodifiable list. */ public final List<Resource> tables() { return UnmodifiableArrayList.wrap(tables); }
/** * 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 {@code true} if this list contains the specified element. * * @param object the element to check for existence. * @return {@code true} if this collection contains the given element. */ @Override public boolean contains(final Object object) { final int lower = lower(); int i = lower + size(); if (object == null) { while (--i >= lower) { if (array[i] == null) { return true; } } } else { while (--i >= lower) { if (object.equals(array[i])) { return true; } } } return false; }
/** * Returns an unmodifiable view over the elements cached so far. * The returned list does not contain any elements that were not yet fetched from the source. * * @return the elements cached so far. */ protected final List<E> cached() { return UnmodifiableArrayList.wrap(cachedElements, 0, numCached); }
/** * 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 the index in this list of the first occurrence of the specified element, * or -1 if the list does not contain the element. * * @param object the element to search for. * @return the index of the first occurrence of the given object, or {@code -1}. */ @Override public int indexOf(final Object object) { final int lower = lower(); final int upper = lower + size(); if (object == null) { for (int i=lower; i<upper; i++) { if (array[i] == null) { return i - lower; } } } else { for (int i=lower; i<upper; i++) { if (object.equals(array[i])) { return i - lower; } } } return -1; }
/** * Returns an unmodifiable view over the elements cached so far. * The returned list does not contain any elements that were not yet fetched from the source. * * @return the elements cached so far. */ protected final List<E> cached() { return UnmodifiableArrayList.wrap(cachedElements, 0, numCached); }