Repository: jena Updated Branches: refs/heads/master c0c294da4 -> 2933d71f5
Removing types from jena-core that have been deprecated for more than two years Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/2933d71f Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/2933d71f Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/2933d71f Branch: refs/heads/master Commit: 2933d71f5e4f6c2602aa01e9879d9d5b6d450135 Parents: 0ef309d Author: ajs6f <[email protected]> Authored: Fri Jan 5 11:35:35 2018 -0500 Committer: ajs6f <[email protected]> Committed: Sat Jan 6 11:02:43 2018 -0500 ---------------------------------------------------------------------- .../jena/util/iterator/ArrayIterator.java | 63 ------- .../util/iterator/ConcatenatedIterator.java | 164 ------------------- .../org/apache/jena/util/iterator/Filter.java | 126 -------------- .../jena/util/iterator/IteratorIterator.java | 73 --------- .../org/apache/jena/util/iterator/Map1.java | 33 ---- 5 files changed, 459 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/2933d71f/jena-core/src/main/java/org/apache/jena/util/iterator/ArrayIterator.java ---------------------------------------------------------------------- diff --git a/jena-core/src/main/java/org/apache/jena/util/iterator/ArrayIterator.java b/jena-core/src/main/java/org/apache/jena/util/iterator/ArrayIterator.java deleted file mode 100644 index fae62c7..0000000 --- a/jena-core/src/main/java/org/apache/jena/util/iterator/ArrayIterator.java +++ /dev/null @@ -1,63 +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. - */ - -//ArrayIterator.java -package org.apache.jena.util.iterator; -import java.util.Iterator; -import java.lang.reflect.Array; -import java.util.NoSuchElementException ; - -/** An Iterator for arrays - * @deprecated Use <code> Arrays.asList( array ).iterator();</code> - */ -@Deprecated -public class ArrayIterator<T> implements Iterator<T> { - private int i; - private T[] a; - /** Constructs an iterator over the members of an array. - * All arrays are supported including primitive types. - * @param array Must be an array. - */ - public ArrayIterator(T[] array) { - i = 0; - a = array; - if (!a.getClass().isArray()) - throw new ArrayStoreException(); - } - @Override - public boolean hasNext() { - return i<Array.getLength(a); - } - @Override - public T next() throws NoSuchElementException { - try { - return a[i++]; // Array.get(a,i++); - } - catch (IndexOutOfBoundsException e) { - throw new NoSuchElementException(); - } - } -/** Not supported. - * @throws java.lang.UnsupportedOperationException Always. - */ - @Override - public void remove() { - - throw new UnsupportedOperationException(); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/2933d71f/jena-core/src/main/java/org/apache/jena/util/iterator/ConcatenatedIterator.java ---------------------------------------------------------------------- diff --git a/jena-core/src/main/java/org/apache/jena/util/iterator/ConcatenatedIterator.java b/jena-core/src/main/java/org/apache/jena/util/iterator/ConcatenatedIterator.java deleted file mode 100644 index 997250e..0000000 --- a/jena-core/src/main/java/org/apache/jena/util/iterator/ConcatenatedIterator.java +++ /dev/null @@ -1,164 +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 -/////////////// -package org.apache.jena.util.iterator; - - -// Imports -/////////////// -import java.util.*; - -/** - * An iterator that represents the concatenation of two individual iterators. - * The concatenated iterator will range over the elements of the first iterator, - * followed by the elements of the second. - * - * @deprecated Use <code>Iterator<T> iter = WrappedIterator.create( iter1 ).andThen( iter2 )</code> - * {@link org.apache.jena.util.iterator.WrappedIterator} - */ -@Deprecated -public class ConcatenatedIterator<T> implements Iterator<T> -{ - /** The first iterator */ - private Iterator<? extends T> m_iter0 = null; - - /** The second iterator */ - private Iterator<? extends T> m_iter1 = null; - - /** The default value for the iterator, or null if no default */ - protected T m_defaultValue = null; - - /** A flag to show that the default value has been returned */ - protected boolean m_defaultValueSeen = false; - - - - // Constructors - ////////////////////////////////// - - /** - * Construct an iterator that is the concatenation of the two - * given iterators. Either iterator may be a Java iterator, or a Jena - * node or resource iterator. - * - * @param iter0 The first iterator. Elements of this iterator will appear - * first in the elements read from the concatenation. - * @param iter1 The second iterator. Elements of this iterator will appear - * second in the elements read from the concatenation. - */ - public ConcatenatedIterator( Iterator<? extends T> iter0, Iterator<? extends T> iter1 ) { - m_iter0 = iter0; - m_iter1 = iter1; - } - - - // External signature methods - ////////////////////////////////// - - /** - * Returns true if the iteration has more elements. This will be - * true if either of the underlying iterators has more elements. - * - * @return true if the iterator has more elements. - */ - @Override - public boolean hasNext() { - return m_iter0.hasNext() || m_iter1.hasNext() || (hasDefaultValue() && !m_defaultValueSeen); - } - - - /** - * Returns the next element in the interation. - * - * @return The next object in the iteration, which will correspond to the next object in the - * underlying iteration, projected to the range of the projection function. - * @exception NoSuchElementException - iteration has no more elements. - */ - @Override - public T next() { - boolean next0 = m_iter0.hasNext(); - boolean next1 = m_iter1.hasNext(); - - // are there any more values from the encapsulted iterations? - if (next0 || next1) { - // Casts necessary : without, it does not compile with 1.6.0 update 11 (it does in Eclipse) - T next = (next0) ? (T)m_iter0.next() : (T)m_iter1.next(); - - // is this the default value? - if (hasDefaultValue() && m_defaultValue.equals( next )) { - m_defaultValueSeen = true; - } - - return next; - } - else if (hasDefaultValue() && !m_defaultValueSeen) { - // return the default value for this iterator - m_defaultValueSeen = true; - return m_defaultValue; - } - else { - // no more nodes, so this is an error - throw new NoSuchElementException( "Tried to access next() element from empty concatenated iterator" ); - } - } - - - /** - * Removes from the underlying collection the last element returned by - * the iterator (optional operation). Not supported on a concatenated - * iterator. - * - * @exception UnsupportedOperationException - if the remove operation is not - * supported by this Iterator. - * @exception IllegalStateException - if the next method has not yet been - * called, or the remove method has already been called after the - * last call to the next method. - */ - @Override - public void remove() { - throw new UnsupportedOperationException( "Cannot remove elements from concatenated iterator" ); - } - - - /** - * Set the default value for this iteration, which will be a value that - * is guaranteed to be returned as a member of the iteration. To guarantee - * that the default value is only returned if it has not already been - * returned by the iterator, setting the default value should occur before - * the first call to {@link #next}. - * - * @param defaultValue The default value for the iteration, or null for - * there to be no default value. The default default - * value is null. - */ - public <X extends T> void setDefaultValue( X defaultValue ) { - m_defaultValue = defaultValue; - } - - - /** - * Answer true if this iteration has a default value. - * - * @return true if there is a default value - */ - public boolean hasDefaultValue() { - return m_defaultValue != null; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/2933d71f/jena-core/src/main/java/org/apache/jena/util/iterator/Filter.java ---------------------------------------------------------------------- diff --git a/jena-core/src/main/java/org/apache/jena/util/iterator/Filter.java b/jena-core/src/main/java/org/apache/jena/util/iterator/Filter.java deleted file mode 100644 index 427a047..0000000 --- a/jena-core/src/main/java/org/apache/jena/util/iterator/Filter.java +++ /dev/null @@ -1,126 +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.jena.util.iterator; - -import java.util.Iterator; -import java.util.function.Predicate; - -/** - * boolean functions wrapped to be used in filtering iterators. - * - * Deprecated in favor of {@link Predicate}. - */ -@Deprecated -public abstract class Filter<T> implements Predicate<T> -{ - @Override - public boolean test(T o) { - return accept(o); - } - - @Deprecated - public abstract boolean accept(T o); - - @Deprecated - public ExtendedIterator<T> filterKeep(Iterator<T> it) { - return new FilterIterator<>(this, it); - } - - /** - * Use {@link #and(Predicate)} instead. - */ - @Deprecated - public Filter<T> and(final Filter<T> other) { - return other.isAny() ? this : new Filter<T>() { - @Override - public boolean accept(T x) { - return Filter.this.accept(x) && other.accept(x); - } - }; - } - - /** - * Answer true iff this filter will deliver true for any argument. Should - * never be overridden except by classes generated by any() below. - * - * No longer needed after Java 8: optimizations of this kind are now a compiler/JVM concern. - */ - @Deprecated - public boolean isAny() { - return false; - } - - /** - * A Filter that accepts everything it's offered. - * - * @deprecated use Filter.any() - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - // Knowingly suppressed - maximum backward compatibility. - @Deprecated - public static final Filter any = new Filter() { - @Override - public final boolean isAny() { - return true; - } - - @Override - public final boolean accept(Object o) { - return true; - } - - @Override - public Filter and(Filter other) { - return other; - } - - @Override - public ExtendedIterator filterKeep(Iterator it) { - return WrappedIterator.create(it); - } - }; - - /** - * Use Java 8's lambda syntax, e.g. x -> true. - */ - @Deprecated - public static <T> Filter<T> any() { - return new Filter<T>() { - @Override - public final boolean isAny() { - return true; - } - - @Override - public final boolean accept(T o) { - return true; - } - - @Override - public Filter<T> and(Filter<T> other) { - return other; - } - - @Override - public ExtendedIterator<T> filterKeep(Iterator<T> it) { - return WrappedIterator.create(it); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/2933d71f/jena-core/src/main/java/org/apache/jena/util/iterator/IteratorIterator.java ---------------------------------------------------------------------- diff --git a/jena-core/src/main/java/org/apache/jena/util/iterator/IteratorIterator.java b/jena-core/src/main/java/org/apache/jena/util/iterator/IteratorIterator.java deleted file mode 100644 index 4582a62..0000000 --- a/jena-core/src/main/java/org/apache/jena/util/iterator/IteratorIterator.java +++ /dev/null @@ -1,73 +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.jena.util.iterator; - -import java.util.Iterator; -import java.util.NoSuchElementException; - -/** Given an Iterator that returns Iterator's, this creates an - * Iterator over the next level values. - * Similar to list splicing in lisp. - * @deprecated use {@link org.apache.jena.util.iterator.WrappedIterator#create} - */ -@Deprecated -public class IteratorIterator<T> implements Iterator<T> -{ - private Iterator<Iterator<T>> top; - private Iterator<T> currentMember; - -/** The first element of this Iterator is the first element of the - * first non-empty element of <code>e</code>. - * @param e An Iterator all of whose members are themselves Iterator's. - */ - public IteratorIterator(Iterator<Iterator<T>> e) { - top = e; - currentMember = null; - } - -/** Is there another element in one of the Iterator's - * still to consider. - */ - @Override - public boolean hasNext() { - while ( currentMember == null || !currentMember.hasNext() ) { - if (!top.hasNext()) - return false; - currentMember = top.next(); - } - return true; - } - - @Override - public T next() { - hasNext(); - if (currentMember == null) - throw new NoSuchElementException(); - return currentMember.next(); - } -/** remove's the element from the underlying Iterator - * in which it is a member. - */ - @Override - public void remove() { - if (currentMember == null) - throw new IllegalStateException(); - currentMember.remove(); - } -} http://git-wip-us.apache.org/repos/asf/jena/blob/2933d71f/jena-core/src/main/java/org/apache/jena/util/iterator/Map1.java ---------------------------------------------------------------------- diff --git a/jena-core/src/main/java/org/apache/jena/util/iterator/Map1.java b/jena-core/src/main/java/org/apache/jena/util/iterator/Map1.java deleted file mode 100644 index bb2fb59..0000000 --- a/jena-core/src/main/java/org/apache/jena/util/iterator/Map1.java +++ /dev/null @@ -1,33 +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.jena.util.iterator; - -import java.util.function.Function; - -/** Converts an Object to another Object. - */ -@Deprecated -public interface Map1<From, To> extends Function<From, To> -{ - @Deprecated - default To map1(From input) { - return apply(input); - } - -}
