remove unused utility classes (collection)
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/0556482f Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/0556482f Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/0556482f Branch: refs/heads/master Commit: 0556482ff14ec8de9974db0d0652d5946a11a04e Parents: 9eed476 Author: Sebastian Schaffert <[email protected]> Authored: Tue Nov 11 16:56:44 2014 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Tue Nov 11 16:56:44 2014 +0100 ---------------------------------------------------------------------- .../commons/collections/EquivalenceHashMap.java | 561 ------------------- .../commons/collections/EquivalenceHashSet.java | 472 ---------------- .../collections/BaseEquivalenceHashMapTest.java | 98 ---- .../collections/BaseEquivalenceHashSetTest.java | 211 ------- .../collections/FastEquivalenceHashSetTest.java | 62 -- .../StandardEquivalenceHashMapTest.java | 35 -- .../StandardEquivalenceHashSetTest.java | 35 -- .../commons/sesame/tripletable/TripleTable.java | 1 - 8 files changed, 1475 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashMap.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashMap.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashMap.java deleted file mode 100644 index 9c7822a..0000000 --- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashMap.java +++ /dev/null @@ -1,561 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; -import com.google.common.base.Function; -import com.google.common.collect.Collections2; -import com.google.common.collect.Iterators; - -import java.lang.reflect.Array; -import java.util.*; - -/** - * A hashmap implementation accepting different notions of equvialence for keys (based on the Guava Equivalence class). - * - * @author Sebastian Schaffert ([email protected]) - */ -public class EquivalenceHashMap<K,V> implements Map<K,V> { - - private Equivalence equivalence; - - private HashMap<ElementWrapper, V> delegate; - - - private UnwrapFunction unwrapper = new UnwrapFunction(); - private WrapFunction wrapper = new WrapFunction(); - - - public EquivalenceHashMap(Equivalence equivalence) { - this.equivalence = equivalence; - this.delegate = new HashMap<>(); - } - - /** - * Removes all of the mappings from this map (optional operation). - * The map will be empty after this call returns. - * - * @throws UnsupportedOperationException if the <tt>clear</tt> operation - * is not supported by this map - */ - @Override - public void clear() { - delegate.clear(); - } - - /** - * Returns the number of key-value mappings in this map. If the - * map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns - * <tt>Integer.MAX_VALUE</tt>. - * - * @return the number of key-value mappings in this map - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * Returns <tt>true</tt> if this map contains no key-value mappings. - * - * @return <tt>true</tt> if this map contains no key-value mappings - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * Returns <tt>true</tt> if this map contains a mapping for the specified - * key. More formally, returns <tt>true</tt> if and only if - * this map contains a mapping for a key <tt>k</tt> such that - * <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be - * at most one such mapping.) - * - * @param key key whose presence in this map is to be tested - * @return <tt>true</tt> if this map contains a mapping for the specified - * key - * @throws ClassCastException if the key is of an inappropriate type for - * this map - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified key is null and this map - * does not permit null keys - * (<a href="Collection.html#optional-restrictions">optional</a>) - */ - @Override - public boolean containsKey(Object key) { - return delegate.containsKey(new ElementWrapper((K)key)); - } - - /** - * Returns <tt>true</tt> if this map maps one or more keys to the - * specified value. More formally, returns <tt>true</tt> if and only if - * this map contains at least one mapping to a value <tt>v</tt> such that - * <tt>(value==null ? v==null : value.equals(v))</tt>. This operation - * will probably require time linear in the map size for most - * implementations of the <tt>Map</tt> interface. - * - * @param value value whose presence in this map is to be tested - * @return <tt>true</tt> if this map maps one or more keys to the - * specified value - * @throws ClassCastException if the value is of an inappropriate type for - * this map - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified value is null and this - * map does not permit null values - * (<a href="Collection.html#optional-restrictions">optional</a>) - */ - @Override - public boolean containsValue(Object value) { - return delegate.containsValue(value); - } - - /** - * Returns the value to which the specified key is mapped, - * or {@code null} if this map contains no mapping for the key. - * <p/> - * <p>More formally, if this map contains a mapping from a key - * {@code k} to a value {@code v} such that {@code (key==null ? k==null : - * key.equals(k))}, then this method returns {@code v}; otherwise - * it returns {@code null}. (There can be at most one such mapping.) - * <p/> - * <p>If this map permits null values, then a return value of - * {@code null} does not <i>necessarily</i> indicate that the map - * contains no mapping for the key; it's also possible that the map - * explicitly maps the key to {@code null}. The {@link #containsKey - * containsKey} operation may be used to distinguish these two cases. - * - * @param key the key whose associated value is to be returned - * @return the value to which the specified key is mapped, or - * {@code null} if this map contains no mapping for the key - * @throws ClassCastException if the key is of an inappropriate type for - * this map - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified key is null and this map - * does not permit null keys - * (<a href="Collection.html#optional-restrictions">optional</a>) - */ - @Override - public V get(Object key) { - return delegate.get(new ElementWrapper((K)key)); - } - - /** - * Associates the specified value with the specified key in this map - * (optional operation). If the map previously contained a mapping for - * the key, the old value is replaced by the specified value. (A map - * <tt>m</tt> is said to contain a mapping for a key <tt>k</tt> if and only - * if {@link #containsKey(Object) m.containsKey(k)} would return - * <tt>true</tt>.) - * - * @param key key with which the specified value is to be associated - * @param value value to be associated with the specified key - * @return the previous value associated with <tt>key</tt>, or - * <tt>null</tt> if there was no mapping for <tt>key</tt>. - * (A <tt>null</tt> return can also indicate that the map - * previously associated <tt>null</tt> with <tt>key</tt>, - * if the implementation supports <tt>null</tt> values.) - * @throws UnsupportedOperationException if the <tt>put</tt> operation - * is not supported by this map - * @throws ClassCastException if the class of the specified key or value - * prevents it from being stored in this map - * @throws NullPointerException if the specified key or value is null - * and this map does not permit null keys or values - * @throws IllegalArgumentException if some property of the specified key - * or value prevents it from being stored in this map - */ - @Override - public V put(K key, V value) { - return delegate.put(new ElementWrapper(key), value); - } - - /** - * Removes the mapping for a key from this map if it is present - * (optional operation). More formally, if this map contains a mapping - * from key <tt>k</tt> to value <tt>v</tt> such that - * <code>(key==null ? k==null : key.equals(k))</code>, that mapping - * is removed. (The map can contain at most one such mapping.) - * <p/> - * <p>Returns the value to which this map previously associated the key, - * or <tt>null</tt> if the map contained no mapping for the key. - * <p/> - * <p>If this map permits null values, then a return value of - * <tt>null</tt> does not <i>necessarily</i> indicate that the map - * contained no mapping for the key; it's also possible that the map - * explicitly mapped the key to <tt>null</tt>. - * <p/> - * <p>The map will not contain a mapping for the specified key once the - * call returns. - * - * @param key key whose mapping is to be removed from the map - * @return the previous value associated with <tt>key</tt>, or - * <tt>null</tt> if there was no mapping for <tt>key</tt>. - * @throws UnsupportedOperationException if the <tt>remove</tt> operation - * is not supported by this map - * @throws ClassCastException if the key is of an inappropriate type for - * this map - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified key is null and this - * map does not permit null keys - * (<a href="Collection.html#optional-restrictions">optional</a>) - */ - @Override - public V remove(Object key) { - return delegate.remove(new ElementWrapper((K)key)); - } - - /** - * Copies all of the mappings from the specified map to this map - * (optional operation). The effect of this call is equivalent to that - * of calling {@link #put(Object, Object) put(k, v)} on this map once - * for each mapping from key <tt>k</tt> to value <tt>v</tt> in the - * specified map. The behavior of this operation is undefined if the - * specified map is modified while the operation is in progress. - * - * @param m mappings to be stored in this map - * @throws UnsupportedOperationException if the <tt>putAll</tt> operation - * is not supported by this map - * @throws ClassCastException if the class of a key or value in the - * specified map prevents it from being stored in this map - * @throws NullPointerException if the specified map is null, or if - * this map does not permit null keys or values, and the - * specified map contains null keys or values - * @throws IllegalArgumentException if some property of a key or value in - * the specified map prevents it from being stored in this map - */ - @Override - public void putAll(Map<? extends K, ? extends V> m) { - for(Entry entry : m.entrySet()) { - put((K)entry.getKey(),(V)entry.getValue()); - } - } - - /** - * Returns a {@link java.util.Set} view of the keys contained in this map. - * The set is backed by the map, so changes to the map are - * reflected in the set, and vice-versa. If the map is modified - * while an iteration over the set is in progress (except through - * the iterator's own <tt>remove</tt> operation), the results of - * the iteration are undefined. The set supports element removal, - * which removes the corresponding mapping from the map, via the - * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, - * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> - * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> - * operations. - * - * @return a set view of the keys contained in this map - */ - @Override - public Set<K> keySet() { - final Set<ElementWrapper> wrapped = delegate.keySet(); - - return new Set<K>() { - @Override - public int size() { - return wrapped.size(); - } - - @Override - public boolean isEmpty() { - return wrapped.isEmpty(); - } - - @Override - public boolean contains(Object o) { - return wrapped.contains(new ElementWrapper((K)o)); - } - - @Override - public Iterator<K> iterator() { - return Iterators.transform(wrapped.iterator(),unwrapper); - } - - @Override - public Object[] toArray() { - return Iterators.toArray(this.iterator(), Object.class); - } - - @Override - public <T> T[] toArray(T[] a) { - T[] result; - if(a.length < size()) { - result = (T[]) Array.newInstance(a.getClass().getComponentType(), size()); - } else { - result = a; - } - int pos = 0; - for(ElementWrapper w : wrapped) { - try { - result[pos++] = (T) w.delegate; - } catch (ClassCastException ex) { - throw new ArrayStoreException("invalid type for array"); - } - } - if(pos < result.length) { - result[pos] = null; - } - return result; - } - - @Override - public boolean add(K k) { - return wrapped.add(new ElementWrapper(k)); - } - - @Override - public boolean remove(Object o) { - return wrapped.remove(new ElementWrapper((K)o)); - } - - @Override - public boolean containsAll(Collection<?> c) { - return wrapped.containsAll(Collections2.transform(c, wrapper)); - } - - @Override - public boolean addAll(Collection<? extends K> c) { - return wrapped.addAll(Collections2.transform(c, wrapper)); - } - - @Override - public boolean retainAll(Collection<?> c) { - return wrapped.retainAll(Collections2.transform(c, wrapper)); - } - - @Override - public boolean removeAll(Collection<?> c) { - return wrapped.removeAll(Collections2.transform(c, wrapper)); - } - - @Override - public void clear() { - wrapped.clear(); - } - }; - } - - /** - * Returns a {@link java.util.Collection} view of the values contained in this map. - * The collection is backed by the map, so changes to the map are - * reflected in the collection, and vice-versa. If the map is - * modified while an iteration over the collection is in progress - * (except through the iterator's own <tt>remove</tt> operation), - * the results of the iteration are undefined. The collection - * supports element removal, which removes the corresponding - * mapping from the map, via the <tt>Iterator.remove</tt>, - * <tt>Collection.remove</tt>, <tt>removeAll</tt>, - * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not - * support the <tt>add</tt> or <tt>addAll</tt> operations. - * - * @return a collection view of the values contained in this map - */ - @Override - public Collection<V> values() { - return delegate.values(); - } - - /** - * Returns a {@link java.util.Set} view of the mappings contained in this map. - * The set is backed by the map, so changes to the map are - * reflected in the set, and vice-versa. If the map is modified - * while an iteration over the set is in progress (except through - * the iterator's own <tt>remove</tt> operation, or through the - * <tt>setValue</tt> operation on a map entry returned by the - * iterator) the results of the iteration are undefined. The set - * supports element removal, which removes the corresponding - * mapping from the map, via the <tt>Iterator.remove</tt>, - * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and - * <tt>clear</tt> operations. It does not support the - * <tt>add</tt> or <tt>addAll</tt> operations. - * - * @return a set view of the mappings contained in this map - */ - @Override - public Set<Entry<K, V>> entrySet() { - final Set<Entry<ElementWrapper,V>> wrapped = delegate.entrySet(); - final EntryUnwrapFunction entryUnwrapFunction = new EntryUnwrapFunction(); - final EntryWrapFunction entryWrapFunction = new EntryWrapFunction(); - - return new Set<Entry<K, V>>() { - @Override - public int size() { - return wrapped.size(); - } - - @Override - public boolean isEmpty() { - return wrapped.isEmpty(); - } - - @Override - public boolean contains(Object o) { - return wrapped.contains(new ElementWrapper((K)o)); - } - - @Override - public Iterator<Entry<K, V>> iterator() { - return Iterators.transform(wrapped.iterator(), entryUnwrapFunction); - } - - @Override - public Object[] toArray() { - return Iterators.toArray(this.iterator(), Object.class); - } - - @Override - public <T> T[] toArray(T[] a) { - T[] result; - if(a.length < size()) { - result = (T[]) Array.newInstance(a.getClass().getComponentType(), size()); - } else { - result = a; - } - int pos = 0; - for(Entry<ElementWrapper,V> w : wrapped) { - try { - result[pos++] = (T) entryUnwrapFunction.apply(w); - } catch (ClassCastException ex) { - throw new ArrayStoreException("invalid type for array"); - } - } - if(pos < result.length) { - result[pos] = null; - } - return result; - } - - @Override - public boolean add(Entry<K, V> k) { - return wrapped.add(entryWrapFunction.apply(k)); - } - - @Override - public boolean remove(Object o) { - return wrapped.remove(entryWrapFunction.apply((Entry<K, V>)o)); - } - - @Override - public boolean containsAll(Collection<?> c) { - return wrapped.containsAll(Collections2.transform(c, entryWrapFunction)); - } - - @Override - public boolean addAll(Collection<? extends Entry<K, V>> c) { - return wrapped.addAll(Collections2.transform(c, entryWrapFunction)); - } - - @Override - public boolean retainAll(Collection<?> c) { - return wrapped.retainAll(Collections2.transform(c, entryWrapFunction)); - } - - @Override - public boolean removeAll(Collection<?> c) { - return wrapped.removeAll(Collections2.transform(c, entryWrapFunction)); - } - - @Override - public void clear() { - wrapped.clear(); - } - }; - } - - private class ElementWrapper { - - private K delegate; - - private ElementWrapper(K delegate) { - this.delegate = delegate; - } - - @Override - public boolean equals(Object o) { - if(o instanceof EquivalenceHashMap<?,?>.ElementWrapper) { - return equivalence.equivalent(ElementWrapper.this.delegate, ((ElementWrapper)o).delegate); - } else { - return false; - } - } - - @Override - public int hashCode() { - return equivalence.hash(delegate); - } - } - - private class UnwrapFunction implements Function<ElementWrapper, K> { - @Override - public K apply(ElementWrapper input) { - return input.delegate; - } - } - - private class WrapFunction implements Function<Object,ElementWrapper> { - @Override - public ElementWrapper apply(Object input) { - return new ElementWrapper((K)input); - } - } - - private class EntryUnwrapFunction implements Function<Entry<ElementWrapper,V>, Entry<K, V>> { - @Override - public Entry<K, V> apply(final Entry<ElementWrapper, V> input) { - return new Entry<K, V>() { - @Override - public K getKey() { - return input.getKey().delegate; - } - - @Override - public V getValue() { - return input.getValue(); - } - - @Override - public V setValue(V value) { - return input.setValue(value); - } - }; - } - } - - private class EntryWrapFunction implements Function<Object,Entry<ElementWrapper,V>> { - @Override - public Entry<ElementWrapper, V> apply(Object o) { - final Entry<K, V> input = (Entry<K,V>)o; - return new Entry<ElementWrapper, V>() { - @Override - public ElementWrapper getKey() { - return new ElementWrapper(input.getKey()); - } - - @Override - public V getValue() { - return input.getValue(); - } - - @Override - public V setValue(V value) { - return input.setValue(value); - } - }; - } - } - -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashSet.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashSet.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashSet.java deleted file mode 100644 index 9927efb..0000000 --- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/EquivalenceHashSet.java +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; -import com.google.common.base.Function; -import com.google.common.collect.Collections2; -import com.google.common.collect.Iterators; - -import java.util.*; - -/** - * A hashset implementation accepting different notions of equvialence (based on the Guava Equivalence class). - * - * @author Sebastian Schaffert ([email protected]) - */ -public class EquivalenceHashSet<E> implements Set<E> { - - private Equivalence equivalence; - - private HashSet<ElementWrapper> delegate; - - - private UnwrapFunction unwrapper = new UnwrapFunction(); - private WrapFunction wrapper = new WrapFunction(); - - - public EquivalenceHashSet() { - this.equivalence = Equivalence.equals(); - this.delegate = new HashSet<>(); - } - - public EquivalenceHashSet(Equivalence equivalence) { - this.equivalence = equivalence; - this.delegate = new HashSet<>(); - } - - - /** - * Adds the specified element to this set if it is not already present - * (optional operation). More formally, adds the specified element - * <tt>e</tt> to this set if the set contains no element <tt>e2</tt> - * such that - * <tt>(e==null ? e2==null : e.equals(e2))</tt>. - * If this set already contains the element, the call leaves the set - * unchanged and returns <tt>false</tt>. In combination with the - * restriction on constructors, this ensures that sets never contain - * duplicate elements. - * <p/> - * <p>The stipulation above does not imply that sets must accept all - * elements; sets may refuse to add any particular element, including - * <tt>null</tt>, and throw an exception, as described in the - * specification for {@link java.util.Collection#add Collection.add}. - * Individual set implementations should clearly document any - * restrictions on the elements that they may contain. - * - * @param e element to be added to this set - * @return <tt>true</tt> if this set did not already contain the specified - * element - * @throws UnsupportedOperationException if the <tt>add</tt> operation - * is not supported by this set - * @throws ClassCastException if the class of the specified element - * prevents it from being added to this set - * @throws NullPointerException if the specified element is null and this - * set does not permit null elements - * @throws IllegalArgumentException if some property of the specified element - * prevents it from being added to this set - */ - @Override - public boolean add(E e) { - return delegate.add(new ElementWrapper(e)); - } - - /** - * Returns the number of elements in this set (its cardinality). If this - * set contains more than <tt>Integer.MAX_VALUE</tt> elements, returns - * <tt>Integer.MAX_VALUE</tt>. - * - * @return the number of elements in this set (its cardinality) - */ - @Override - public int size() { - return delegate.size(); - } - - /** - * Returns <tt>true</tt> if this set contains no elements. - * - * @return <tt>true</tt> if this set contains no elements - */ - @Override - public boolean isEmpty() { - return delegate.isEmpty(); - } - - /** - * Returns <tt>true</tt> if this set contains the specified element. - * More formally, returns <tt>true</tt> if and only if this set - * contains an element <tt>e</tt> such that - * <tt>(o==null ? e==null : o.equals(e))</tt>. - * - * @param o element whose presence in this set is to be tested - * @return <tt>true</tt> if this set contains the specified element - * @throws ClassCastException if the type of the specified element - * is incompatible with this set - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified element is null and this - * set does not permit null elements - * (<a href="Collection.html#optional-restrictions">optional</a>) - */ - @Override - public boolean contains(Object o) { - return delegate.contains(new ElementWrapper((E)o)); - } - - /** - * Returns an iterator over the elements in this set. The elements are - * returned in no particular order (unless this set is an instance of some - * class that provides a guarantee). - * - * @return an iterator over the elements in this set - */ - @Override - public Iterator<E> iterator() { - return Iterators.transform(delegate.iterator(), unwrapper); - } - - /** - * Returns an array containing all of the elements in this set. - * If this set makes any guarantees as to what order its elements - * are returned by its iterator, this method must return the - * elements in the same order. - * <p/> - * <p>The returned array will be "safe" in that no references to it - * are maintained by this set. (In other words, this method must - * allocate a new array even if this set is backed by an array). - * The caller is thus free to modify the returned array. - * <p/> - * <p>This method acts as bridge between array-based and collection-based - * APIs. - * - * @return an array containing all the elements in this set - */ - @Override - public Object[] toArray() { - return Iterators.toArray(this.iterator(), Object.class); - } - - /** - * Returns an array containing all of the elements in this set; the - * runtime type of the returned array is that of the specified array. - * If the set fits in the specified array, it is returned therein. - * Otherwise, a new array is allocated with the runtime type of the - * specified array and the size of this set. - * <p/> - * <p>If this set fits in the specified array with room to spare - * (i.e., the array has more elements than this set), the element in - * the array immediately following the end of the set is set to - * <tt>null</tt>. (This is useful in determining the length of this - * set <i>only</i> if the caller knows that this set does not contain - * any null elements.) - * <p/> - * <p>If this set makes any guarantees as to what order its elements - * are returned by its iterator, this method must return the elements - * in the same order. - * <p/> - * <p>Like the {@link #toArray()} method, this method acts as bridge between - * array-based and collection-based APIs. Further, this method allows - * precise control over the runtime type of the output array, and may, - * under certain circumstances, be used to save allocation costs. - * <p/> - * <p>Suppose <tt>x</tt> is a set known to contain only strings. - * The following code can be used to dump the set into a newly allocated - * array of <tt>String</tt>: - * <p/> - * <pre> - * String[] y = x.toArray(new String[0]);</pre> - * - * Note that <tt>toArray(new Object[0])</tt> is identical in function to - * <tt>toArray()</tt>. - * - * @param a the array into which the elements of this set are to be - * stored, if it is big enough; otherwise, a new array of the same - * runtime type is allocated for this purpose. - * @return an array containing all the elements in this set - * @throws ArrayStoreException if the runtime type of the specified array - * is not a supertype of the runtime type of every element in this - * set - * @throws NullPointerException if the specified array is null - */ - @Override - public <T> T[] toArray(T[] a) { - // stolen from AbstractCollection - - // Estimate size of array; be prepared to see more or fewer elements - int size = size(); - T[] r = a.length >= size ? a : - (T[])java.lang.reflect.Array - .newInstance(a.getClass().getComponentType(), size); - Iterator<E> it = iterator(); - - for (int i = 0; i < r.length; i++) { - if (! it.hasNext()) { // fewer elements than expected - if (a != r) - return Arrays.copyOf(r, i); - r[i] = null; // null-terminate - return r; - } - r[i] = (T)it.next(); - } - return it.hasNext() ? finishToArray(r, it) : r; - } - - - /** - * The maximum size of array to allocate. - * Some VMs reserve some header words in an array. - * Attempts to allocate larger arrays may result in - * OutOfMemoryError: Requested array size exceeds VM limit - */ - private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; - - /** - * Reallocates the array being used within toArray when the iterator - * returned more elements than expected, and finishes filling it from - * the iterator. - * - * @param r the array, replete with previously stored elements - * @param it the in-progress iterator over this collection - * @return array containing the elements in the given array, plus any - * further elements returned by the iterator, trimmed to size - */ - private static <T> T[] finishToArray(T[] r, Iterator<?> it) { - int i = r.length; - while (it.hasNext()) { - int cap = r.length; - if (i == cap) { - int newCap = cap + (cap >> 1) + 1; - // overflow-conscious code - if (newCap - MAX_ARRAY_SIZE > 0) - newCap = hugeCapacity(cap + 1); - r = Arrays.copyOf(r, newCap); - } - r[i++] = (T)it.next(); - } - // trim if overallocated - return (i == r.length) ? r : Arrays.copyOf(r, i); - } - - - private static int hugeCapacity(int minCapacity) { - if (minCapacity < 0) // overflow - throw new OutOfMemoryError - ("Required array size too large"); - return (minCapacity > MAX_ARRAY_SIZE) ? - Integer.MAX_VALUE : - MAX_ARRAY_SIZE; - } - - - /** - * Removes the specified element from this set if it is present - * (optional operation). More formally, removes an element <tt>e</tt> - * such that - * <tt>(o==null ? e==null : o.equals(e))</tt>, if - * this set contains such an element. Returns <tt>true</tt> if this set - * contained the element (or equivalently, if this set changed as a - * result of the call). (This set will not contain the element once the - * call returns.) - * - * @param o object to be removed from this set, if present - * @return <tt>true</tt> if this set contained the specified element - * @throws ClassCastException if the type of the specified element - * is incompatible with this set - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified element is null and this - * set does not permit null elements - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws UnsupportedOperationException if the <tt>remove</tt> operation - * is not supported by this set - */ - @Override - public boolean remove(Object o) { - return delegate.remove(new ElementWrapper((E)o)); - } - - /** - * Returns <tt>true</tt> if this set contains all of the elements of the - * specified collection. If the specified collection is also a set, this - * method returns <tt>true</tt> if it is a <i>subset</i> of this set. - * - * @param c collection to be checked for containment in this set - * @return <tt>true</tt> if this set contains all of the elements of the - * specified collection - * @throws ClassCastException if the types of one or more elements - * in the specified collection are incompatible with this - * set - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if the specified collection contains one - * or more null elements and this set does not permit null - * elements - * (<a href="Collection.html#optional-restrictions">optional</a>), - * or if the specified collection is null - * @see #contains(Object) - */ - @Override - public boolean containsAll(Collection<?> c) { - return delegate.containsAll(Collections2.transform(c,wrapper)); - } - - /** - * Adds all of the elements in the specified collection to this set if - * they're not already present (optional operation). If the specified - * collection is also a set, the <tt>addAll</tt> operation effectively - * modifies this set so that its value is the <i>union</i> of the two - * sets. The behavior of this operation is undefined if the specified - * collection is modified while the operation is in progress. - * - * @param c collection containing elements to be added to this set - * @return <tt>true</tt> if this set changed as a result of the call - * @throws UnsupportedOperationException if the <tt>addAll</tt> operation - * is not supported by this set - * @throws ClassCastException if the class of an element of the - * specified collection prevents it from being added to this set - * @throws NullPointerException if the specified collection contains one - * or more null elements and this set does not permit null - * elements, or if the specified collection is null - * @throws IllegalArgumentException if some property of an element of the - * specified collection prevents it from being added to this set - * @see #add(Object) - */ - @Override - public boolean addAll(Collection<? extends E> c) { - return delegate.addAll(Collections2.transform(c, wrapper)); - } - - /** - * Retains only the elements in this set that are contained in the - * specified collection (optional operation). In other words, removes - * from this set all of its elements that are not contained in the - * specified collection. If the specified collection is also a set, this - * operation effectively modifies this set so that its value is the - * <i>intersection</i> of the two sets. - * - * @param c collection containing elements to be retained in this set - * @return <tt>true</tt> if this set changed as a result of the call - * @throws UnsupportedOperationException if the <tt>retainAll</tt> operation - * is not supported by this set - * @throws ClassCastException if the class of an element of this set - * is incompatible with the specified collection - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if this set contains a null element and the - * specified collection does not permit null elements - * (<a href="Collection.html#optional-restrictions">optional</a>), - * or if the specified collection is null - * @see #remove(Object) - */ - @Override - public boolean retainAll(Collection<?> c) { - return delegate.retainAll(Collections2.transform(c, wrapper)); - } - - /** - * Removes from this set all of its elements that are contained in the - * specified collection (optional operation). If the specified - * collection is also a set, this operation effectively modifies this - * set so that its value is the <i>asymmetric set difference</i> of - * the two sets. - * - * @param c collection containing elements to be removed from this set - * @return <tt>true</tt> if this set changed as a result of the call - * @throws UnsupportedOperationException if the <tt>removeAll</tt> operation - * is not supported by this set - * @throws ClassCastException if the class of an element of this set - * is incompatible with the specified collection - * (<a href="Collection.html#optional-restrictions">optional</a>) - * @throws NullPointerException if this set contains a null element and the - * specified collection does not permit null elements - * (<a href="Collection.html#optional-restrictions">optional</a>), - * or if the specified collection is null - * @see #remove(Object) - * @see #contains(Object) - */ - @Override - public boolean removeAll(Collection<?> c) { - return delegate.removeAll(Collections2.transform(c, wrapper)); - } - - /** - * Removes all of the elements from this set (optional operation). - * The set will be empty after this call returns. - * - * @throws UnsupportedOperationException if the <tt>clear</tt> method - * is not supported by this set - */ - @Override - public void clear() { - delegate.clear(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - EquivalenceHashSet that = (EquivalenceHashSet) o; - - if (!delegate.equals(that.delegate)) return false; - if (!equivalence.equals(that.equivalence)) return false; - - return true; - } - - @Override - public int hashCode() { - int result = equivalence.hashCode(); - result = 31 * result + delegate.hashCode(); - return result; - } - - private class ElementWrapper { - - private E delegate; - - private ElementWrapper(E delegate) { - this.delegate = delegate; - } - - @Override - public boolean equals(Object o) { - if(o instanceof EquivalenceHashSet<?>.ElementWrapper) { - return equivalence.equivalent(ElementWrapper.this.delegate, ((ElementWrapper)o).delegate); - } else { - return false; - } - } - - @Override - public int hashCode() { - return equivalence.hash(delegate); - } - } - - private class UnwrapFunction implements Function<ElementWrapper, E> { - @Override - public E apply(ElementWrapper input) { - return input.delegate; - } - } - - private class WrapFunction implements Function<Object,ElementWrapper> { - @Override - public ElementWrapper apply(Object input) { - return new ElementWrapper((E)input); - } - } -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashMapTest.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashMapTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashMapTest.java deleted file mode 100644 index 29d1890..0000000 --- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashMapTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; -import org.junit.Test; - -import java.util.Map; - -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -/** - * Add file description here! - * - * @author Sebastian Schaffert ([email protected]) - */ -public abstract class BaseEquivalenceHashMapTest { - - // a simple equivalence function on strings, saying they are equal if their first character is the same - Equivalence<String> equivalence = new Equivalence<String>() { - @Override - protected boolean doEquivalent(String a, String b) { - return a.charAt(0) == b.charAt(0); - } - - @Override - protected int doHash(String s) { - return s.charAt(0) * 31; - } - }; - - public abstract Map<String,String> createHashMap(Equivalence<String> equivalence); - - @Test - public void testPutGet() { - Map<String,String> map = createHashMap(equivalence); - - map.put("abc","a"); - map.put("axy","a"); - map.put("xyz","x"); - - assertEquals(2, map.size()); - assertTrue(map.containsKey("abc")); - assertTrue(map.containsKey("axy")); - assertTrue(map.containsKey("aef")); - - assertEquals("a", map.get("abc")); - assertEquals("a", map.get("aef")); - - assertTrue(map.containsValue("a")); - assertTrue(map.containsValue("x")); - } - - @Test - public void testKeySet() { - Map<String,String> map = createHashMap(equivalence); - - map.put("abc","a"); - map.put("axy","a"); - map.put("xyz","x"); - - assertThat(map.keySet(), contains(startsWith("a"), startsWith("x"))); - } - - @Test - public void testIteration() { - Map<String,String> map = createHashMap(equivalence); - - map.put("abc","a"); - map.put("axy","a"); - map.put("xyz","x"); - - int count = 0; - for(Map.Entry<String,String> e : map.entrySet()) { - assertThat(e.getKey(), anyOf(equalTo("abc"), equalTo("axy"), equalTo("xyz"))); - assertThat(e.getValue(), anyOf(equalTo("a"), equalTo("x"))); - count++; - } - assertEquals(2, count); - } - -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashSetTest.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashSetTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashSetTest.java deleted file mode 100644 index 95cba91..0000000 --- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/BaseEquivalenceHashSetTest.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; -import com.google.common.collect.Sets; -import org.junit.Test; - -import java.util.Set; - -import static org.hamcrest.Matchers.hasItemInArray; -import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assert.*; - -/** - * Add file description here! - * - * @author Sebastian Schaffert ([email protected]) - */ -public abstract class BaseEquivalenceHashSetTest { - - // a simple equivalence function on strings, saying they are equal if their first character is the same - Equivalence<String> equivalence = new Equivalence<String>() { - @Override - protected boolean doEquivalent(String a, String b) { - return a.charAt(0) == b.charAt(0); - } - - @Override - protected int doHash(String s) { - return s.charAt(0) * 31; - } - }; - - public abstract Set<String> createHashSet(Equivalence<String> equivalence); - - @Test - public void testEquivalence() { - assertTrue(equivalence.equivalent("abc", "axy")); - assertFalse(equivalence.equivalent("abc", "xyz")); - - assertTrue(equivalence.hash("abc") == equivalence.hash("axy")); - assertFalse(equivalence.hash("abc") == equivalence.hash("xyz")); - } - - @Test - public void testSetContains() { - String a = "abc"; - String b = "axy"; - String c = "xyz"; - - Set<String> set = createHashSet(equivalence); - set.add(a); - - // set should now also contain b (because first character the same) - assertTrue(set.contains(b)); - - set.add(b); - - // adding b should not change the set - assertEquals(1, set.size()); - - set.add(c); - - assertEquals(2, set.size()); - - assertTrue(set.containsAll(Sets.newHashSet(a, b, c))); - } - - - @Test - public void testSetEquals() { - String a1 = "abc"; - String a2 = "axy"; - String b1 = "bcd"; - String b2 = "bxy"; - String c1 = "cde"; - - Set<String> set1 = createHashSet(equivalence); - Set<String> set2 = createHashSet(equivalence); - - // test empty sets - assertEquals(set1, set2); - - set1.add(a1); - set1.add(b1); - - set2.add(b2); - set2.add(a2); - - - assertEquals(2, set1.size()); - assertEquals(2, set2.size()); - - - // test sets with elements, insertion order different - assertEquals(set1, set2); - assertEquals(set1.hashCode(), set2.hashCode()); - - set1.add(c1); - - assertNotEquals(set1, set2); - assertNotEquals(set1.hashCode(), set2.hashCode()); - - - } - - @Test - public void testIteration() { - String a = "abc"; - String b = "axy"; - String c = "xyz"; - - Set<String> set = createHashSet(equivalence); - set.add(a); - set.add(b); - set.add(c); - - int count = 0; - for(String x : set) { - count++; - } - assertEquals(2, count); - } - - - @Test - public void testEmpty() { - Set<String> set = createHashSet(equivalence); - - assertTrue(set.isEmpty()); - - set.add("abc"); - - assertFalse(set.isEmpty()); - } - - - @Test - public void testToArray() { - String a = "abc"; - String b = "axy"; - String c = "xyz"; - - Set<String> set = createHashSet(equivalence); - set.add(a); - set.add(b); - set.add(c); - - String[] arr = new String[4]; - - arr = set.toArray(arr); - - assertEquals(2, countNotNull(arr)); - assertThat(arr, hasItemInArray(startsWith("a"))); - assertThat(arr, hasItemInArray(startsWith("x"))); - } - - - @Test - public void testRemove() { - String a = "abc"; - String b = "axy"; - String c = "xyz"; - - Set<String> set = createHashSet(equivalence); - set.add(a); - set.add(b); - set.add(c); - - assertEquals(2, set.size()); - - set.remove(a); - - assertEquals(1, set.size()); - assertTrue(set.contains(c)); - assertFalse(set.contains(b)); - - set.remove(c); - - assertEquals(0, set.size()); - assertFalse(set.contains(c)); - assertFalse(set.contains(b)); - } - - - private static <T> int countNotNull(T[] arr) { - int count = 0; - for(int i=0; i<arr.length; i++) { - if(arr[i] != null) { - count++; - } - } - return count; - } -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/FastEquivalenceHashSetTest.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/FastEquivalenceHashSetTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/FastEquivalenceHashSetTest.java deleted file mode 100644 index 232615d..0000000 --- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/FastEquivalenceHashSetTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; -import javolution.util.FastSet; -import javolution.util.function.Equality; - -import java.util.Set; - -/** - * Tests for HashSet with custom equivalence function (FastSet implementation) - * - * @author Sebastian Schaffert ([email protected]) - */ -public class FastEquivalenceHashSetTest extends BaseEquivalenceHashSetTest { - - @Override - public Set<String> createHashSet(final Equivalence<String> equivalence) { - return new FastSet<>(new Equality<String>() { - @Override - public int hashCodeOf(String object) { - return equivalence.hash(object); - } - - @Override - public boolean areEqual(String left, String right) { - return equivalence.equivalent(left, right); - } - - @Override - public int compare(String left, String right) { - return equivalence.hash(left) - equivalence.hash(right); - } - - @Override - public int hashCode() { - return equivalence.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return obj.hashCode() == hashCode(); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashMapTest.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashMapTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashMapTest.java deleted file mode 100644 index ab52f3a..0000000 --- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashMapTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; - -import java.util.Map; - -/** - * Tests for HashSet with custom equivalence function (standard implementation) - * - * @author Sebastian Schaffert ([email protected]) - */ -public class StandardEquivalenceHashMapTest extends BaseEquivalenceHashMapTest { - - @Override - public Map<String, String> createHashMap(Equivalence<String> equivalence) { - return new EquivalenceHashMap<>(equivalence); - } -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashSetTest.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashSetTest.java b/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashSetTest.java deleted file mode 100644 index 04bf93b..0000000 --- a/commons/marmotta-commons/src/test/java/org/apache/marmotta/commons/collections/StandardEquivalenceHashSetTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.commons.collections; - -import com.google.common.base.Equivalence; - -import java.util.Set; - -/** - * Tests for HashSet with custom equivalence function (standard implementation) - * - * @author Sebastian Schaffert ([email protected]) - */ -public class StandardEquivalenceHashSetTest extends BaseEquivalenceHashSetTest { - - public Set<String> createHashSet(Equivalence<String> equivalence) { - return new EquivalenceHashSet<>(equivalence); - } - -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0556482f/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java ---------------------------------------------------------------------- diff --git a/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java b/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java index d149b87..98cb983 100644 --- a/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java +++ b/commons/marmotta-sesame-tools/marmotta-util-tripletable/src/main/java/org/apache/marmotta/commons/sesame/tripletable/TripleTable.java @@ -19,7 +19,6 @@ package org.apache.marmotta.commons.sesame.tripletable; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; -import org.apache.marmotta.commons.collections.EquivalenceHashSet; import org.apache.marmotta.commons.sesame.model.StatementCommons; import org.openrdf.model.Resource; import org.openrdf.model.Statement;
