diff options
author | bvosburgh | 2011-07-08 15:54:23 +0000 |
---|---|---|
committer | bvosburgh | 2011-07-08 15:54:23 +0000 |
commit | a2c57da22b9d0c9a16843981e2ebc4ff7dcab26d (patch) | |
tree | 620629d1dc0345b1803ecf5f1e894d47d205cf4d /common | |
parent | 6cca752f07be246e26109e8f64817e472b3fc48d (diff) | |
download | webtools.dali-a2c57da22b9d0c9a16843981e2ebc4ff7dcab26d.tar.gz webtools.dali-a2c57da22b9d0c9a16843981e2ebc4ff7dcab26d.tar.xz webtools.dali-a2c57da22b9d0c9a16843981e2ebc4ff7dcab26d.zip |
add "lateral" iterators and iterables
Diffstat (limited to 'common')
12 files changed, 308 insertions, 107 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LateralIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LateralIterableWrapper.java new file mode 100644 index 0000000000..acb656d79e --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LateralIterableWrapper.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.common.utility.internal.iterables; + +import java.util.Iterator; +import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.iterators.LateralIteratorWrapper; + +/** + * Wrap an iterable of elements of type <code>E1</code>, converting it into an + * iterable of elements of type <code>E2</code>. <em>Assume</em> the wrapped + * iterable contains only elements of type <code>E2</code>. The result is a + * {@link ClassCastException} if this assumption is false. + * + * @param <E1> input: the type of elements contained by the wrapped iterable + * @param <E2> output: the type of elements returned by the iterable's iterators + * + * @see LateralIteratorWrapper + * @see SubIterableWrapper + */ +public class LateralIterableWrapper<E1, E2> + implements Iterable<E2> +{ + private final Iterable<E1> iterable; + + + public LateralIterableWrapper(Iterable<E1> iterable) { + super(); + this.iterable = iterable; + } + + public Iterator<E2> iterator() { + return new LateralIteratorWrapper<E1, E2>(this.iterable.iterator()); + } + + @Override + public String toString() { + return StringTools.buildToStringFor(this, this.iterable); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LateralListIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LateralListIterableWrapper.java new file mode 100644 index 0000000000..3847723a63 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LateralListIterableWrapper.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.common.utility.internal.iterables; + +import java.util.List; +import java.util.ListIterator; + +import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.iterators.LateralListIteratorWrapper; + +/** + * Wrap a list iterable of elements of type <code>E1</code>, converting it into + * a list iterable of elements of type <code>E2</code>. <em>Assume</em> the + * wrapped iterable contains only elements of type <code>E2</code>. + * The result is a {@link ClassCastException} if this assumption is false. + * + * @param <E1> input: the type of elements contained by the wrapped list iterable + * @param <E2> output: the type of elements returned by the iterable's list iterators + * + * @see LateralListIteratorWrapper + * @see SubListIterableWrapper + */ +public class LateralListIterableWrapper<E1, E2> + implements ListIterable<E2> +{ + private final ListIterable<E1> iterable; + + + public LateralListIterableWrapper(List<E1> list) { + this(new ListListIterable<E1>(list)); + } + + public LateralListIterableWrapper(ListIterable<E1> iterable) { + super(); + this.iterable = iterable; + } + + public ListIterator<E2> iterator() { + return new LateralListIteratorWrapper<E1, E2>(this.iterable.iterator()); + } + + @Override + public String toString() { + return StringTools.buildToStringFor(this, this.iterable); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java index b9e2acb574..13f5cb058c 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java @@ -17,12 +17,16 @@ import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; /** * Wrap an iterable of elements of type <code>E1</code>, converting it into an * iterable of elements of type <code>E2</code>. <em>Assume</em> the wrapped - * iterable contains only elements of type <code>E2</code>. + * iterable contains only elements of type <code>E2</code>. The result is a + * {@link ClassCastException} if this assumption is false. + * <p> + * This is like a {@link LateralIterableWrapper} but with more restrictive type + * parameters. * * @param <E1> input: the type of elements contained by the wrapped iterable - * @param <E2> output: the type of elements returned by the iterable's iterator + * @param <E2> output: the type of elements returned by the iterable's iterators * - * @see org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper + * @see SubIteratorWrapper */ public class SubIterableWrapper<E1, E2 extends E1> implements Iterable<E2> diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java index 2213ce0559..d565d1bd1b 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -11,21 +11,24 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.List; import java.util.ListIterator; - import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.SubListIteratorWrapper; /** * Wrap a list iterable of elements of type <code>E1</code>, converting it into - * a list iterable of elements of type <code>E2</code>. Assume the wrapped - * iterable contains only elements of type <code>E2</code>. + * a list iterable of elements of type <code>E2</code>. <em>Assume</em> the + * wrapped iterable contains only elements of type <code>E2</code>. + * The result is a {@link ClassCastException} if this assumption is false. + * <p> + * This is like a {@link LateralListIterableWrapper} but with more restrictive type + * parameters. * * @param <E1> input: the type of elements contained by the wrapped list iterable - * @param <E2> output: the type of elements returned by the iterable's list iterator + * @param <E2> output: the type of elements returned by the iterable's list iterators * - * @see org.eclipse.jpt.common.utility.internal.iterators.SubListIteratorWrapper + * @see SubListIteratorWrapper */ -public class SubListIterableWrapper<E1, E2> +public class SubListIterableWrapper<E1, E2 extends E1> implements ListIterable<E2> { private final ListIterable<E1> iterable; @@ -48,5 +51,4 @@ public class SubListIterableWrapper<E1, E2> public String toString() { return StringTools.buildToStringFor(this, this.iterable); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java index bae5e1e52a..0b3e83ea32 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -18,9 +18,7 @@ import org.eclipse.jpt.common.utility.internal.StringTools; * iterable of elements of type <code>E</code>. This shouldn't be a problem since there * is no way to add invalid elements to the iterable. * - * @param <E> the type of elements returned by the iterable's iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper + * @param <E> the type of elements returned by the iterable's iterators */ public class SuperIterableWrapper<E> implements Iterable<E> @@ -44,5 +42,4 @@ public class SuperIterableWrapper<E> public String toString() { return StringTools.buildToStringFor(this, this.iterable); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java index 2d5fa24f03..7abe433983 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -17,7 +17,8 @@ import org.eclipse.jpt.common.utility.internal.iterators.SuperListIteratorWrappe /** * Wrap a list iterable of elements of any sub-type of <code>E</code>, - * converting it into a list iterable of elements of type <code>E</code>. + * converting it into a <em>non-writable</em> list iterable of elements + * of type <code>E</code>. * This shouldn't be a problem since the resulting list iterable's list * iterator disables the methods that would put invalid elements in the list * iterator's backing list (i.e. {@link SuperListIteratorWrapper#set(Object)} @@ -25,7 +26,7 @@ import org.eclipse.jpt.common.utility.internal.iterators.SuperListIteratorWrappe * * @param <E> the type of elements returned by the iterable's iterators * - * @see org.eclipse.jpt.common.utility.internal.iterators.SuperListIteratorWrapper + * @see SuperListIteratorWrapper */ public class SuperListIterableWrapper<E> implements ListIterable<E> @@ -50,5 +51,4 @@ public class SuperListIterableWrapper<E> public String toString() { return StringTools.buildToStringFor(this, this.iterable); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/LateralIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/LateralIteratorWrapper.java new file mode 100644 index 0000000000..f5c67ceda2 --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/LateralIteratorWrapper.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.common.utility.internal.iterators; + +import java.util.Iterator; + +import org.eclipse.jpt.common.utility.internal.StringTools; + +/** + * Wrap an iterator on elements of type <code>E1</code>, converting it into an + * iterator on elements of type <code>E2</code>. <em>Assume</em> the wrapped + * iterator returns only elements of type <code>E2</code>. The result is a + * {@link ClassCastException} if this assumption is false. + * + * @param <E1> input: the type of elements returned by the wrapped iterator + * @param <E2> output: the type of elements returned by the iterator + * + * @see org.eclipse.jpt.common.utility.internal.iterables.LateralIterableWrapper + * @see SubIteratorWrapper + */ +public class LateralIteratorWrapper<E1, E2> + implements Iterator<E2> +{ + private final Iterator<E1> iterator; + + + public LateralIteratorWrapper(Iterable<E1> iterable) { + this(iterable.iterator()); + } + + public LateralIteratorWrapper(Iterator<E1> iterator) { + super(); + this.iterator = iterator; + } + + public boolean hasNext() { + return this.iterator.hasNext(); + } + + @SuppressWarnings("unchecked") + public E2 next() { + return (E2) this.iterator.next(); + } + + public void remove() { + this.iterator.remove(); + } + + @Override + public String toString() { + return StringTools.buildToStringFor(this, this.iterator); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/LateralListIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/LateralListIteratorWrapper.java new file mode 100644 index 0000000000..f34b8eff5d --- /dev/null +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/LateralListIteratorWrapper.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2011 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0, which accompanies this distribution + * and is available at http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.jpt.common.utility.internal.iterators; + +import java.util.List; +import java.util.ListIterator; + +import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; + +/** + * Wrap a list iterator on elements of type <code>E1</code>, converting it into + * a list iterator on elements of type <code>E2</code>. <em>Assume</em> the + * wrapped list iterator returns only elements of type <code>E2</code>. + * The result is a {@link ClassCastException} if this assumption is false. + * + * @param <E1> input: the type of elements returned by the wrapped list iterator + * @param <E2> output: the type of elements returned by the list iterator + * + * @see org.eclipse.jpt.common.utility.internal.iterables.LateralIterableWrapper + * @see SubListIteratorWrapper + */ +public class LateralListIteratorWrapper<E1, E2> + implements ListIterator<E2> +{ + final ListIterator<E1> listIterator; + + + public LateralListIteratorWrapper(List<E1> list) { + this(list.listIterator()); + } + + public LateralListIteratorWrapper(ListIterable<E1> listIterable) { + this(listIterable.iterator()); + } + + public LateralListIteratorWrapper(ListIterator<E1> iterator) { + super(); + this.listIterator = iterator; + } + + public boolean hasNext() { + return this.listIterator.hasNext(); + } + + @SuppressWarnings("unchecked") + public E2 next() { + return (E2) this.listIterator.next(); + } + + public int nextIndex() { + return this.listIterator.nextIndex(); + } + + public boolean hasPrevious() { + return this.listIterator.hasPrevious(); + } + + @SuppressWarnings("unchecked") + public E2 previous() { + return (E2) this.listIterator.previous(); + } + + public int previousIndex() { + return this.listIterator.previousIndex(); + } + + public void remove() { + this.listIterator.remove(); + } + + @SuppressWarnings("unchecked") + public void set(E2 e) { + this.listIterator.set((E1) e); + } + + @SuppressWarnings("unchecked") + public void add(E2 e) { + this.listIterator.add((E1) e); + } + + @Override + public String toString() { + return StringTools.buildToStringFor(this, this.listIterator); + } +} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java index bcdb328638..4faf788ad1 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java @@ -11,12 +11,14 @@ package org.eclipse.jpt.common.utility.internal.iterators; import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; - /** * Wrap an iterator on elements of type <code>E1</code>, converting it into an * iterator on elements of type <code>E2</code>. <em>Assume</em> the wrapped - * iterator returns only elements of type <code>E2</code>. + * iterator returns only elements of type <code>E2</code>. The result is a + * {@link ClassCastException} if this assumption is false. + * <p> + * This is a {@link LateralIteratorWrapper} with more restrictive type + * parameters. * * @param <E1> input: the type of elements returned by the wrapped iterator * @param <E2> output: the type of elements returned by the iterator @@ -24,35 +26,13 @@ import org.eclipse.jpt.common.utility.internal.StringTools; * @see org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper */ public class SubIteratorWrapper<E1, E2 extends E1> - implements Iterator<E2> + extends LateralIteratorWrapper<E1, E2> { - private final Iterator<E1> iterator; - - public SubIteratorWrapper(Iterable<E1> iterable) { - this(iterable.iterator()); + super(iterable); } public SubIteratorWrapper(Iterator<E1> iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - @SuppressWarnings("unchecked") - public E2 next() { - return (E2) this.iterator.next(); - } - - public void remove() { - this.iterator.remove(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); + super(iterator); } } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java index 534926384f..6225d851a0 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -11,80 +11,46 @@ package org.eclipse.jpt.common.utility.internal.iterators; import java.util.List; import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; /** * Wrap a list iterator on elements of type <code>E1</code>, converting it into - * a list iterator on elements of type <code>E2</code>. Assume the wrapped - * list iterator returns only elements of type <code>E2</code>. + * a list iterator on elements of type <code>E2</code>. <em>Assume</em> the + * wrapped list iterator returns only elements of type <code>E2</code>. + * The result is a {@link ClassCastException} if this assumption is false. + * <p> + * This is a {@link LateralListIteratorWrapper} with more restrictive type + * parameters. * * @param <E1> input: the type of elements returned by the wrapped list iterator * @param <E2> output: the type of elements returned by the list iterator * * @see org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper */ -public class SubListIteratorWrapper<E1, E2> - implements ListIterator<E2> +public class SubListIteratorWrapper<E1, E2 extends E1> + extends LateralListIteratorWrapper<E1, E2> { - private final ListIterator<E1> listIterator; - - public SubListIteratorWrapper(List<E1> list) { - this(list.listIterator()); + super(list); } public SubListIteratorWrapper(ListIterable<E1> listIterable) { - this(listIterable.iterator()); + super(listIterable); } public SubListIteratorWrapper(ListIterator<E1> iterator) { - super(); - this.listIterator = iterator; - } - - public boolean hasNext() { - return this.listIterator.hasNext(); - } - - @SuppressWarnings("unchecked") - public E2 next() { - return (E2) this.listIterator.next(); - } - - public int nextIndex() { - return this.listIterator.nextIndex(); - } - - public boolean hasPrevious() { - return this.listIterator.hasPrevious(); - } - - @SuppressWarnings("unchecked") - public E2 previous() { - return (E2) this.listIterator.previous(); - } - - public int previousIndex() { - return this.listIterator.previousIndex(); - } - - public void remove() { - this.listIterator.remove(); + super(iterator); } + @Override public void set(E2 e) { - throw new UnsupportedOperationException(); - } - - public void add(E2 e) { - throw new UnsupportedOperationException(); + // no explicit cast necessary + this.listIterator.set(e); } @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listIterator); + public void add(E2 e) { + // no explicit cast necessary + this.listIterator.add(e); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java index 2bd19a9d96..9e420fc57c 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. + * Copyright (c) 2008, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -14,7 +14,7 @@ import org.eclipse.jpt.common.utility.internal.StringTools; /** * Wrap an iterator on elements of any sub-type of <code>E</code>, converting - * it into an iterator on elements of type <code>E</code>. This shouldn't be a + * it into a iterator on elements of type <code>E</code>. This shouldn't be a * problem since there is no way to add invalid elements to the iterator's * backing collection. (Note the lack of compiler warnings, suppressed or * otherwise.) @@ -54,5 +54,4 @@ public class SuperIteratorWrapper<E> public String toString() { return StringTools.buildToStringFor(this, this.iterator); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java index d12773a57c..21bc8e5326 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. + * Copyright (c) 2010, 2011 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -16,8 +16,9 @@ import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; /** - * Wrap a list iterator on elements of any sub-type of <code>E</code>, converting it into a - * list iterator on elements of type <code>E</code>. This shouldn't be a problem since the + * Wrap a list iterator on elements of any sub-type of <code>E</code>, + * converting it into a <em>non-writable</em> list iterator on elements of type + * <code>E</code>. This shouldn't be a problem since the * resulting list iterator disables the methods that would put invalid elements * in the iterator's backing list (i.e. {@link #set(Object)} and {@link #add(Object)}). * @@ -84,5 +85,4 @@ public class SuperListIteratorWrapper<E> public String toString() { return StringTools.buildToStringFor(this, this.listIterator); } - } |