Removed GridTupleV.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e7f34887 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e7f34887 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e7f34887 Branch: refs/heads/ignite-4986 Commit: e7f348879781669625f861a7d58713a715b05f18 Parents: d66f27c Author: devozerov <[email protected]> Authored: Fri Apr 14 15:08:18 2017 +0300 Committer: devozerov <[email protected]> Committed: Fri Apr 14 15:08:18 2017 +0300 ---------------------------------------------------------------------- .../ignite/internal/util/lang/GridTupleV.java | 194 ------------------- .../resources/META-INF/classnames.properties | 1 - .../apache/ignite/lang/GridTupleSelfTest.java | 35 ---- 3 files changed, 230 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/e7f34887/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java deleted file mode 100644 index 9fcb69c..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java +++ /dev/null @@ -1,194 +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.ignite.internal.util.lang; - -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Arrays; -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.apache.ignite.internal.util.tostring.GridToStringInclude; -import org.apache.ignite.internal.util.typedef.internal.A; -import org.apache.ignite.internal.util.typedef.internal.S; -import org.apache.ignite.internal.util.typedef.internal.U; - -/** - * Constructs a tuple over a given array. - * <h2 class="header">Thread Safety</h2> - * This class doesn't provide any synchronization for multi-threaded access - * and it is responsibility of the user of this class to provide outside - * synchronization, if needed. - */ -@Deprecated -public class GridTupleV implements Iterable<Object>, Externalizable, Cloneable { - /** */ - private static final long serialVersionUID = 0L; - - /** Tuple values. */ - @GridToStringInclude - private Object[] vals; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public GridTupleV() { - // No-op. - } - - /** - * Initializes tuple with given object count. - * - * @param cnt Count of objects to be stored in the tuple. - */ - public GridTupleV(int cnt) { - A.ensure(cnt > 0, "cnt > 0"); - - vals = new Object[cnt]; - } - - /** - * Constructs tuple around passed in array. - * - * @param vals Values. - */ - public GridTupleV(Object... vals) { - this.vals = vals; - } - - /** - * Retrieves value at given index. - * - * @param i Index of the value to get. - * @param <V> Value type. - * @return Value at given index. - */ - @SuppressWarnings({"unchecked"}) - public <V> V get(int i) { - A.ensure(i < vals.length, "i < vals.length"); - - return (V)vals[i]; - } - - /** - * Sets value at given index. - * - * @param i Index to set. - * @param v Value to set. - * @param <V> Value type. - */ - public <V> void set(int i, V v) { - A.ensure(i < vals.length, "i < vals.length"); - - vals[i] = v; - } - - /** - * Sets given values starting at {@code 0} position. - * - * @param v Values to set. - */ - public void set(Object... v) { - A.ensure(v.length <= vals.length, "v.length <= vals.length"); - - if (v.length > 0) - System.arraycopy(v, 0, vals, 0, v.length); - } - - /** - * Sets given values starting at provided position in the tuple. - * - * @param pos Position to start from. - * @param v Values to set. - */ - public void set(int pos, Object... v) { - A.ensure(pos > 0, "pos > 0"); - A.ensure(v.length + pos <= vals.length, "v.length + pos <= vals.length"); - - if (v.length > 0) - System.arraycopy(v, 0, vals, pos, v.length); - } - - /** - * Gets internal array. Changes to this array will change this tuple. - * - * @return Internal array. - */ - public Object[] getAll() { - return vals; - } - - /** {@inheritDoc} */ - @Override public Iterator<Object> iterator() { - return new Iterator<Object>() { - private int nextIdx; - - @Override public boolean hasNext() { - return nextIdx < vals.length; - } - - @Override public Object next() { - if (!hasNext()) - throw new NoSuchElementException(); - - return vals[nextIdx++]; - } - - @Override public void remove() { - throw new UnsupportedOperationException(); - } - }; - } - - /** {@inheritDoc} */ - @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException"}) - @Override public Object clone() { - try { - return super.clone(); - } - catch (CloneNotSupportedException ignore) { - throw new InternalError(); - } - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - U.writeArray(out, vals); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - vals = U.readArray(in); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return Arrays.hashCode(vals); - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - return this == o || o instanceof GridTupleV && Arrays.equals(vals, ((GridTupleV)o).vals); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridTupleV.class, this); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e7f34887/modules/core/src/main/resources/META-INF/classnames.properties ---------------------------------------------------------------------- diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties index 7d00841..18584c5 100644 --- a/modules/core/src/main/resources/META-INF/classnames.properties +++ b/modules/core/src/main/resources/META-INF/classnames.properties @@ -1631,7 +1631,6 @@ org.apache.ignite.internal.util.lang.GridTuple3 org.apache.ignite.internal.util.lang.GridTuple4 org.apache.ignite.internal.util.lang.GridTuple5 org.apache.ignite.internal.util.lang.GridTuple6 -org.apache.ignite.internal.util.lang.GridTupleV org.apache.ignite.internal.util.lang.IgniteClosure2X org.apache.ignite.internal.util.lang.IgniteClosureX org.apache.ignite.internal.util.lang.IgniteInClosure2X http://git-wip-us.apache.org/repos/asf/ignite/blob/e7f34887/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java index 5865cad..77be70c 100644 --- a/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java @@ -24,7 +24,6 @@ import java.util.Map; import java.util.NoSuchElementException; import org.apache.ignite.internal.util.lang.GridTuple; import org.apache.ignite.internal.util.lang.GridTuple3; -import org.apache.ignite.internal.util.lang.GridTupleV; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.testframework.junits.common.GridCommonTest; @@ -172,38 +171,4 @@ public class GridTupleSelfTest extends GridCommonAbstractTest { info("Caught expected exception: " + e); } } - - /** - * JUnit. - */ - public void testGridTupleVAsIterable() { - String strVal = "A test string"; - Integer intVal = 1; - Double doubleVal = 2.5d; - - Iterable<Object> tpl = new GridTupleV(strVal, intVal, doubleVal); - - Iterator<Object> iter = tpl.iterator(); - - assert iter != null; - - List<Object> elems = new ArrayList<>(); - - while (iter.hasNext()) - elems.add(iter.next()); - - assert elems.size() == 3; - assert strVal.equals(elems.get(0)); - assert intVal.equals(elems.get(1)); - assert doubleVal.equals(elems.get(2)); - - try { - iter.next(); - - fail("NoSuchElementException must have been thrown."); - } - catch (NoSuchElementException e) { - info("Caught expected exception: " + e); - } - } }
