diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-12-03 15:33:31 -0800 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-12-03 15:33:31 -0800 |
commit | 63ab72220f5ec6831cc9567949abe05b8056caef (patch) | |
tree | 85c56a49aa7cdf987e4973fa2a709c54e5145482 /vespajlib | |
parent | 328b9da010a66558c8d4078df9d0d248d82c5ee9 (diff) |
Rename method
Diffstat (limited to 'vespajlib')
21 files changed, 45 insertions, 51 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/collections/ArraySet.java b/vespajlib/src/main/java/com/yahoo/collections/ArraySet.java index 64ff6d736ea..a0fe01925c1 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/ArraySet.java +++ b/vespajlib/src/main/java/com/yahoo/collections/ArraySet.java @@ -39,7 +39,7 @@ public final class ArraySet<E> implements Set<E> { @Override public E next() { if (!hasNext()) { - throw new NoSuchElementException("No more elements available"); + throw new NoSuchElementException("No more labels available"); } removed = false; return (E) entries[++i]; @@ -66,7 +66,7 @@ public final class ArraySet<E> implements Set<E> { /** * Create a set with an initial capacity of initSize. The internal array - * will grow automatically with a linear growth rate if more elements than + * will grow automatically with a linear growth rate if more labels than * initSize are added. * * @param initSize diff --git a/vespajlib/src/main/java/com/yahoo/collections/BobHash.java b/vespajlib/src/main/java/com/yahoo/collections/BobHash.java index 41e4a934d71..916d93bbe49 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/BobHash.java +++ b/vespajlib/src/main/java/com/yahoo/collections/BobHash.java @@ -106,7 +106,7 @@ public class BobHash { * mod a prime (mod is sooo slow!). If you need less than 32 bits, * use a bitmask. For example, if you need only 10 bits, do * h = (h & hashmask(10)); - * In which case, the hash table should have hashsize(10) elements. + * In which case, the hash table should have hashsize(10) labels. * * If you are hashing n strings (ub1 **)k, do it like this: * for (i=0, h=0; i<n; ++i) h = hash( k[i], len[i], h); diff --git a/vespajlib/src/main/java/com/yahoo/collections/ByteArrayComparator.java b/vespajlib/src/main/java/com/yahoo/collections/ByteArrayComparator.java index c0f630a92e5..e6e3f4b0e1c 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/ByteArrayComparator.java +++ b/vespajlib/src/main/java/com/yahoo/collections/ByteArrayComparator.java @@ -10,9 +10,9 @@ package com.yahoo.collections; public class ByteArrayComparator { /** * Compare the arguments. Shorter arrays are always considered - * smaller than longer arrays. For arrays of equal lengths, the elements - * are compared one-by-one. Whenever two corresponding elements in the - * two arrays are non-equal, the method returns. If all elements at + * smaller than longer arrays. For arrays of equal lengths, the labels + * are compared one-by-one. Whenever two corresponding labels in the + * two arrays are non-equal, the method returns. If all labels at * corresponding positions in the two arrays are equal, the arrays * are considered equal. * diff --git a/vespajlib/src/main/java/com/yahoo/collections/CollectionComparator.java b/vespajlib/src/main/java/com/yahoo/collections/CollectionComparator.java index 8999f0cac9c..6f434221cbb 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/CollectionComparator.java +++ b/vespajlib/src/main/java/com/yahoo/collections/CollectionComparator.java @@ -13,9 +13,9 @@ import java.util.Iterator; public class CollectionComparator { /** * Compare the arguments. Shorter Collections are always considered - * smaller than longer Collections. For Collections of equal lengths, the elements - * are compared one-by-one. Whenever two corresponding elements in the - * two Collections are non-equal, the method returns. If all elements at + * smaller than longer Collections. For Collections of equal lengths, the labels + * are compared one-by-one. Whenever two corresponding labels in the + * two Collections are non-equal, the method returns. If all labels at * corresponding positions in the two Collections are equal, the Collections * are considered equal. * diff --git a/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java b/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java index ddcc6e97dff..d3df67dcf78 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java +++ b/vespajlib/src/main/java/com/yahoo/collections/CollectionUtil.java @@ -20,7 +20,7 @@ import java.util.stream.Collectors; public class CollectionUtil { /** - * Returns a String containing the string representation of all elements from + * Returns a String containing the string representation of all labels from * the given collection, separated by the separator string. * * @param collection The collection @@ -32,7 +32,7 @@ public class CollectionUtil { } /** - * Returns a String containing the string representation of all elements from + * Returns a String containing the string representation of all labels from * the given collection, using a start string, separator strings, and an end string. * * @param collection The collection @@ -57,7 +57,7 @@ public class CollectionUtil { } /** - * Returns the symmetric difference between two collections, i.e. the set of elements + * Returns the symmetric difference between two collections, i.e. the set of labels * that occur in exactly one of the collections. */ public static <T> Set<T> symmetricDifference(Collection<? extends T> c1, Collection<? extends T> c2) { @@ -72,7 +72,7 @@ public class CollectionUtil { } /** - * Returns the subset of elements from the given collection that can be cast to the reference + * Returns the subset of labels from the given collection that can be cast to the reference * type, defined by the given Class object. */ public static <T> Collection<T> filter(Collection<?> collection, Class<T> lowerBound) { diff --git a/vespajlib/src/main/java/com/yahoo/collections/IntArrayComparator.java b/vespajlib/src/main/java/com/yahoo/collections/IntArrayComparator.java index 21c6f514cbf..d7b6b13abce 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/IntArrayComparator.java +++ b/vespajlib/src/main/java/com/yahoo/collections/IntArrayComparator.java @@ -10,9 +10,9 @@ package com.yahoo.collections; public class IntArrayComparator { /** * Compare the arguments. Shorter arrays are always considered - * smaller than longer arrays. For arrays of equal lengths, the elements - * are compared one-by-one. Whenever two corresponding elements in the - * two arrays are non-equal, the method returns. If all elements at + * smaller than longer arrays. For arrays of equal lengths, the labels + * are compared one-by-one. Whenever two corresponding labels in the + * two arrays are non-equal, the method returns. If all labels at * corresponding positions in the two arrays are equal, the arrays * are considered equal. * diff --git a/vespajlib/src/main/java/com/yahoo/collections/ListMap.java b/vespajlib/src/main/java/com/yahoo/collections/ListMap.java index 8054179be30..2952b5267d6 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/ListMap.java +++ b/vespajlib/src/main/java/com/yahoo/collections/ListMap.java @@ -31,7 +31,7 @@ public class ListMap<K, V> { } } - /** Puts an element into this. Multiple elements at the same position are added to the list at this key */ + /** Puts an element into this. Multiple labels at the same position are added to the list at this key */ public void put(K key, V value) { List<V> list = map.get(key); if (list == null) { @@ -68,8 +68,8 @@ public class ListMap<K, V> { } /** - * Returns the List containing the elements with this key, or an empty list - * if there are no elements. The list returned is unmodifiable. + * Returns the List containing the labels with this key, or an empty list + * if there are no labels. The list returned is unmodifiable. */ public List<V> get(K key) { List<V> list = map.get(key); diff --git a/vespajlib/src/main/java/com/yahoo/collections/ListenableArrayList.java b/vespajlib/src/main/java/com/yahoo/collections/ListenableArrayList.java index d195cf36172..cadc285cba3 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/ListenableArrayList.java +++ b/vespajlib/src/main/java/com/yahoo/collections/ListenableArrayList.java @@ -57,7 +57,7 @@ public class ListenableArrayList<ITEM> extends ArrayList<ITEM> { } /** - * Adds a listener which is invoked whenever elements are added to this. + * Adds a listener which is invoked whenever labels are added to this. * This may not be invoked once for each added element. */ public void addListener(Runnable listener) { diff --git a/vespajlib/src/main/java/com/yahoo/collections/TinyIdentitySet.java b/vespajlib/src/main/java/com/yahoo/collections/TinyIdentitySet.java index 177a4e6720b..bfa985c77e5 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/TinyIdentitySet.java +++ b/vespajlib/src/main/java/com/yahoo/collections/TinyIdentitySet.java @@ -39,7 +39,7 @@ public final class TinyIdentitySet<E> implements Set<E> { @Override public E next() { if (!hasNext()) { - throw new NoSuchElementException("No more elements available"); + throw new NoSuchElementException("No more labels available"); } removed = false; return (E) entries[++i]; @@ -66,7 +66,7 @@ public final class TinyIdentitySet<E> implements Set<E> { /** * Create a set with an initial capacity of initSize. The internal array - * will grow automatically with a linear growth rate if more elements than + * will grow automatically with a linear growth rate if more labels than * initSize are added. * * @param initSize diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/ThreadRobustList.java b/vespajlib/src/main/java/com/yahoo/concurrent/ThreadRobustList.java index 42d3ff51aae..0465eb2a918 100644 --- a/vespajlib/src/main/java/com/yahoo/concurrent/ThreadRobustList.java +++ b/vespajlib/src/main/java/com/yahoo/concurrent/ThreadRobustList.java @@ -46,7 +46,7 @@ public class ThreadRobustList<T> implements Iterable<T> { } /** - * Returns an iterator over the elements of this. This iterator does not + * Returns an iterator over the labels of this. This iterator does not * support remove. */ @Override @@ -55,7 +55,7 @@ public class ThreadRobustList<T> implements Iterable<T> { } /** - * Returns an iterator over the elements of this, starting at the last + * Returns an iterator over the labels of this, starting at the last * element and working backwards. This iterator does not support remove. */ public Iterator<T> reverseIterator() { @@ -86,7 +86,7 @@ public class ThreadRobustList<T> implements Iterable<T> { @Override public T next() { if (!hasNext()) { - throw new NoSuchElementException("No more elements"); + throw new NoSuchElementException("No more labels"); } return (T) items[nextIndex++]; @@ -135,7 +135,7 @@ public class ThreadRobustList<T> implements Iterable<T> { @Override public T next() { if (!hasNext()) { - throw new NoSuchElementException("No more elements"); + throw new NoSuchElementException("No more labels"); } return (T) items[nextIndex--]; diff --git a/vespajlib/src/main/java/com/yahoo/path/Path.java b/vespajlib/src/main/java/com/yahoo/path/Path.java index a15ebacc4cf..62f743614f4 100644 --- a/vespajlib/src/main/java/com/yahoo/path/Path.java +++ b/vespajlib/src/main/java/com/yahoo/path/Path.java @@ -10,7 +10,7 @@ import java.util.List; // TODO: Remove and replace usage by java.nio.file.Path /** - * Represents a path represented by a list of elements. Immutable + * Represents a path represented by a list of labels. Immutable * * @author lulf * @since 5.1 @@ -37,8 +37,8 @@ public final class Path { } /** - * Create path with given elements. - * @param elements a list of path elements + * Create path with given labels. + * @param elements a list of path labels */ private Path(List<String> elements, String delimiter) { this.elements.addAll(elements); @@ -51,7 +51,7 @@ public final class Path { } /** - * Add path elements by splitting based on delimiter and appending to elements. + * Add path labels by splitting based on delimiter and appending to labels. */ private void addElementsFromString(String path) { String[] pathElements = path.split(delimiter); @@ -116,7 +116,7 @@ public final class Path { } /** - * Get the parent path (all elements except last). + * Get the parent path (all labels except last). * @return the parent path. */ public Path getParentPath() { diff --git a/vespajlib/src/main/java/com/yahoo/tensor/MapTensor.java b/vespajlib/src/main/java/com/yahoo/tensor/MapTensor.java index 436b31e7dae..d5beb60b22b 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/MapTensor.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/MapTensor.java @@ -75,7 +75,7 @@ public class MapTensor implements Tensor { for (String elementString : addressBody.split(",")) { String[] pair = elementString.split(":"); if (pair.length != 2) - throw new IllegalArgumentException("Expecting argument elements to be on the form dimension:label, " + + throw new IllegalArgumentException("Expecting argument labels to be on the form dimension:label, " + "got '" + elementString + "'"); builder.mapped(pair[0].trim()); } @@ -120,7 +120,7 @@ public class MapTensor implements Tensor { for (String elementString : addressBody.split(",")) { String[] pair = elementString.split(":"); if (pair.length != 2) - throw new IllegalArgumentException("Expecting argument elements to be on the form dimension:label, " + + throw new IllegalArgumentException("Expecting argument labels to be on the form dimension:label, " + "got '" + elementString + "'"); builder.add(pair[0].trim(), pair[1].trim()); } diff --git a/vespajlib/src/main/java/com/yahoo/tensor/MapTensorBuilder.java b/vespajlib/src/main/java/com/yahoo/tensor/MapTensorBuilder.java index f3c1db06b05..f7a9f15e313 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/MapTensorBuilder.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/MapTensorBuilder.java @@ -4,9 +4,7 @@ package com.yahoo.tensor; import com.google.common.annotations.Beta; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; /** * Builder class for a MapTensor. @@ -46,7 +44,7 @@ public class MapTensorBuilder { if (cells.size() == 0) return TensorType.empty; TensorType.Builder b = new TensorType.Builder(); - for (String dimension : cells.keySet().iterator().next().elements()) + for (String dimension : cells.keySet().iterator().next().labels()) b.mapped(dimension); return b.build(); } diff --git a/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java b/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java index 801d5f1069a..74ea0a48c69 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java @@ -30,7 +30,7 @@ public final class TensorAddress implements Comparable<TensorAddress> { } /** Returns the labels of this as an immutable list in the order of the tensor this is the type of */ - public List<String> elements() { return labels; } + public List<String> labels() { return labels; } @Override public int compareTo(TensorAddress other) { diff --git a/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java b/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java index 9ce0370aaf5..0026f7b11e3 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java @@ -7,11 +7,9 @@ import com.yahoo.tensor.Tensor; import com.yahoo.tensor.TensorAddress; import com.yahoo.tensor.TensorType; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.function.DoubleBinaryOperator; /** @@ -99,8 +97,8 @@ public class Join extends PrimitiveTensorFunction { private TensorAddress combineAddresses(TensorAddress a, int[] aToIndexes, TensorAddress b, int[] bToIndexes, TensorType joinedType) { String[] joinedLabels = new String[joinedType.dimensions().size()]; - mapContent(a.elements(), joinedLabels, aToIndexes); - boolean compatible = mapContent(b.elements(), joinedLabels, bToIndexes); + mapContent(a.labels(), joinedLabels, aToIndexes); + boolean compatible = mapContent(b.labels(), joinedLabels, bToIndexes); if ( ! compatible) return null; return new TensorAddress(joinedLabels); } diff --git a/vespajlib/src/main/java/com/yahoo/tensor/functions/Reduce.java b/vespajlib/src/main/java/com/yahoo/tensor/functions/Reduce.java index 9251521f6bf..0a94a1e7b5e 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/functions/Reduce.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/functions/Reduce.java @@ -14,7 +14,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.stream.Collectors; /** * The <i>reduce</i> tensor operation returns a tensor produced from the argument tensor where some dimensions @@ -125,9 +124,9 @@ public class Reduce extends PrimitiveTensorFunction { String[] reducedLabels = new String[reducedType.dimensions().size()]; int reducedLabelIndex = 0; - for (int i = 0; i < address.elements().size(); i++) + for (int i = 0; i < address.labels().size(); i++) if ( ! indexesToRemove.contains(i)) - reducedLabels[reducedLabelIndex++] = address.elements().get(i); + reducedLabels[reducedLabelIndex++] = address.labels().get(i); return new TensorAddress(reducedLabels); } diff --git a/vespajlib/src/main/java/com/yahoo/tensor/functions/Rename.java b/vespajlib/src/main/java/com/yahoo/tensor/functions/Rename.java index 81582fd64ac..4b3a2f4142f 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/functions/Rename.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/functions/Rename.java @@ -84,7 +84,7 @@ public class Rename extends PrimitiveTensorFunction { private TensorAddress rename(TensorAddress address, int[] toIndexes) { String[] reorderedLabels = new String[toIndexes.length]; for (int i = 0; i < toIndexes.length; i++) - reorderedLabels[toIndexes[i]] = address.elements().get(i); + reorderedLabels[toIndexes[i]] = address.labels().get(i); return new TensorAddress(reorderedLabels); } diff --git a/vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java b/vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java index 967c05f0878..b707802c55f 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/serialization/SparseBinaryFormat.java @@ -2,7 +2,6 @@ package com.yahoo.tensor.serialization; import com.google.common.annotations.Beta; -import com.google.common.collect.Sets; import com.yahoo.io.GrowableByteBuffer; import com.yahoo.tensor.MapTensorBuilder; import com.yahoo.tensor.Tensor; @@ -50,7 +49,7 @@ class SparseBinaryFormat implements BinaryFormat { } private static void encodeAddress(GrowableByteBuffer buffer, TensorAddress address) { - for (String label : address.elements()) + for (String label : address.labels()) encodeString(buffer, label); } diff --git a/vespajlib/src/main/java/com/yahoo/text/XML.java b/vespajlib/src/main/java/com/yahoo/text/XML.java index c688d5f9722..e22e71b5c6c 100644 --- a/vespajlib/src/main/java/com/yahoo/text/XML.java +++ b/vespajlib/src/main/java/com/yahoo/text/XML.java @@ -458,7 +458,7 @@ public class XML { /** * Returns the child Element objects from a w3c dom spec * - * @return List of elements. Empty list (never null) if none found or if the + * @return List of labels. Empty list (never null) if none found or if the * given element is null */ public static List<Element> getChildren(Element spec) { @@ -480,7 +480,7 @@ public class XML { /** * Returns the child Element objects with given name from a w3c dom spec * - * @return List of elements. Empty list (never null) if none found or the + * @return List of labels. Empty list (never null) if none found or the * given element is null */ public static List<Element> getChildren(Element spec, String name) { diff --git a/vespajlib/src/main/java/com/yahoo/vespa/objects/Selectable.java b/vespajlib/src/main/java/com/yahoo/vespa/objects/Selectable.java index b856f78c5d6..b5c739aac88 100644 --- a/vespajlib/src/main/java/com/yahoo/vespa/objects/Selectable.java +++ b/vespajlib/src/main/java/com/yahoo/vespa/objects/Selectable.java @@ -13,7 +13,7 @@ public class Selectable { /** * Apply the predicate to this object. If the predicate returns true, pass this object to the operation, otherwise - * invoke the {@link #selectMembers(ObjectPredicate, ObjectOperation)} method to locate sub-elements that might + * invoke the {@link #selectMembers(ObjectPredicate, ObjectOperation)} method to locate sub-labels that might * trigger the predicate. * * @param predicate component used to select (sub-)objects diff --git a/vespajlib/src/test/java/com/yahoo/slime/JsonBenchmark.java b/vespajlib/src/test/java/com/yahoo/slime/JsonBenchmark.java index 5963f5a8eca..1e64a077383 100644 --- a/vespajlib/src/test/java/com/yahoo/slime/JsonBenchmark.java +++ b/vespajlib/src/test/java/com/yahoo/slime/JsonBenchmark.java @@ -92,7 +92,7 @@ public class JsonBenchmark { * jacksons 1000 40000 = 5.6 seconds * jacksont 1000 40000 = 11.0 seconds * slime 1000 40000 = 17.5 seconds - * @param argv type, num elements in weigted set, num iterations + * @param argv type, num labels in weigted set, num iterations */ static public void main(String argv[]) { String type = argv[0]; |