diff options
author | bvosburgh | 2012-07-20 21:13:59 +0000 |
---|---|---|
committer | bvosburgh | 2012-07-20 21:13:59 +0000 |
commit | d4f45c316ef80790b2b27287471f9104fa7f4928 (patch) | |
tree | 3c01488bd70b124db05d682b3af8b18d9371b293 /common/plugins | |
parent | f5b99d8a5399e71bf73b422fd53f2b970f5e25ad (diff) | |
download | webtools.dali-d4f45c316ef80790b2b27287471f9104fa7f4928.tar.gz webtools.dali-d4f45c316ef80790b2b27287471f9104fa7f4928.tar.xz webtools.dali-d4f45c316ef80790b2b27287471f9104fa7f4928.zip |
improve some toString() implementations
Diffstat (limited to 'common/plugins')
38 files changed, 186 insertions, 179 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java index 4f46bbb4c4..1b3a673f51 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -69,7 +69,7 @@ public interface Queue<E> { } @Override public String toString() { - return StringTools.buildSingletonToString(this); + return "[]"; //$NON-NLS-1$ } private static final long serialVersionUID = 1L; private Object readResolve() { diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java index 02e026c7db..5c0158d563 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -84,7 +84,6 @@ public class SimpleQueue<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.peek()); + return this.elements.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java index 3816b49a87..ec42d27abd 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * Copyright (c) 2007, 2012 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. @@ -92,9 +92,13 @@ public class SimpleStack<E> } } + /** + * Print the elements in the order in which they are "pushed" on to + * the stack (as opposed to the order in which they will be "popped" + * off of the stack). + */ @Override public String toString() { - return StringTools.buildToStringFor(this, this.peek()); + return this.elements.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java index bf9c34c88e..b735a1459c 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. + * Copyright (c) 2007, 2012 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. @@ -69,7 +69,7 @@ public interface Stack<E> { } @Override public String toString() { - return StringTools.buildSingletonToString(this); + return "[]"; //$NON-NLS-1$ } private static final long serialVersionUID = 1L; private Object readResolve() { diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java index e1aa3f97e4..607f438786 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java @@ -335,7 +335,7 @@ public class SynchronizedQueue<E> @Override public String toString() { synchronized (this.mutex) { - return '[' + this.queue.toString() + ']'; + return this.queue.toString(); } } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java index 21bb4ce347..53b3aa1b49 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java @@ -312,7 +312,7 @@ public class SynchronizedStack<E> @Override public String toString() { synchronized (this.mutex) { - return '[' + this.stack.toString() + ']'; + return this.stack.toString(); } } @@ -321,5 +321,4 @@ public class SynchronizedStack<E> s.defaultWriteObject(); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java index 5f67e72a49..284345b77d 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Arrays; import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; /** @@ -71,7 +69,6 @@ public class ArrayIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); + return Arrays.toString(this.array); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java index 12dcc76816..ea59a0df1e 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,7 @@ 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.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; /** @@ -20,8 +19,9 @@ import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; * should be null-terminated (i.e. a call to the {@link #nextLink(Object)} * method should return <code>null</code> when it is passed the last * link of the chain). - * To use, supply a starting link and supply a {@link ChainIterator.Linker} or - * subclass <code>ChainIterable</code> and override the + * To use, supply a starting link and supply a + * {@link org.eclipse.jpt.common.utility.internal.iterators.ChainIterator.Linker} + * or subclass <code>ChainIterable</code> and override the * {@link #nextLink(Object)} method. * The starting link will be the first object returned by the iterable's iterator. * If the starting link is <code>null</code>, the iterable will be empty. @@ -42,8 +42,8 @@ public class ChainIterable<E> * Construct an iterable with the specified starting link * and a default linker that calls back to the iterable. * Use this constructor if you want to override the - * {@link #nextLink(Object)} method instead of building - * a {@link ChainIterator.Linker}. + * {@link #nextLink(Object)} method instead of building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.ChainIterator.Linker}. */ public ChainIterable(E startLink) { super(); @@ -72,8 +72,8 @@ public class ChainIterable<E> /** * Return the next link in the chain; null if there are no more links. * <p> - * This method can be overridden by a subclass as an alternative to - * building a {@link ChainIterator.Linker}. + * This method can be overridden by a subclass as an alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.ChainIterator.Linker}. */ protected E nextLink(@SuppressWarnings("unused") E currentLink) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -81,7 +81,7 @@ public class ChainIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.startLink); + return CollectionTools.list(this).toString(); } @@ -92,5 +92,4 @@ public class ChainIterable<E> return ChainIterable.this.nextLink(currentLink); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java index 22a21a4979..44069c400e 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -34,6 +34,9 @@ public abstract class CloneIterable<E> protected CloneIterable(CloneIterator.Remover<E> remover) { super(); + if (remover == null) { + throw new NullPointerException(); + } this.remover = remover; } @@ -48,7 +51,8 @@ public abstract class CloneIterable<E> * Remove the specified element from the original collection. * <p> * This method can be overridden by a subclass as an - * alternative to building a {@link CloneIterator.Remover}. + * alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.CloneIterator.Remover}. */ protected void remove(@SuppressWarnings("unused") E element) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -62,5 +66,4 @@ public abstract class CloneIterable<E> CloneIterable.this.remove(element); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java index b98c42303a..a6a4dcd0eb 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -34,6 +34,9 @@ public abstract class CloneListIterable<E> protected CloneListIterable(CloneListIterator.Mutator<E> mutator) { super(); + if (mutator == null) { + throw new NullPointerException(); + } this.mutator = mutator; } @@ -48,7 +51,8 @@ public abstract class CloneListIterable<E> * At the specified index, add the specified element to the original list. * <p> * This method can be overridden by a subclass as an - * alternative to building a {@link CloneListIterator.Mutator}. + * alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator.Mutator}. */ protected void add(@SuppressWarnings("unused") int index, @SuppressWarnings("unused") E element) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -58,7 +62,8 @@ public abstract class CloneListIterable<E> * Remove the element at the specified index from the original list. * <p> * This method can be overridden by a subclass as an - * alternative to building a {@link CloneListIterator.Mutator}. + * alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator.Mutator}. */ protected void remove(@SuppressWarnings("unused") int index) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -68,7 +73,8 @@ public abstract class CloneListIterable<E> * At the specified index, set the specified element in the original list. * <p> * This method can be overridden by a subclass as an - * alternative to building a {@link CloneListIterator.Mutator}. + * alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator.Mutator}. */ protected void set(@SuppressWarnings("unused") int index, @SuppressWarnings("unused") E element) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -88,5 +94,4 @@ public abstract class CloneListIterable<E> CloneListIterable.this.set(index, element); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java index 442737ede9..62be1b2d87 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,7 @@ 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.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; @@ -92,7 +91,6 @@ public class CompositeIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterables); + return CollectionTools.list(this).toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java index 66f75626ef..8fcec40406 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,7 @@ 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.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.CompositeListIterator; import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; @@ -129,7 +128,6 @@ public class CompositeListIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterables); + return CollectionTools.list(this).toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java index c3ed1c49dc..d87cc02a19 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. + * Copyright (c) 2008, 2012 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,7 +11,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.io.Serializable; import java.util.Iterator; - import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; /** @@ -53,7 +52,7 @@ public final class EmptyIterable<E> @Override public String toString() { - return this.getClass().getSimpleName(); + return "[]"; //$NON-NLS-1$ } private static final long serialVersionUID = 1L; @@ -61,5 +60,4 @@ public final class EmptyIterable<E> // replace this object with the singleton return INSTANCE; } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java index 028f34f857..458550297e 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java @@ -11,7 +11,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.io.Serializable; import java.util.ListIterator; - import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; /** @@ -53,7 +52,7 @@ public final class EmptyListIterable<E> @Override public String toString() { - return this.getClass().getSimpleName(); + return "[]"; //$NON-NLS-1$ } private static final long serialVersionUID = 1L; @@ -61,5 +60,4 @@ public final class EmptyListIterable<E> // replace this object with the singleton return INSTANCE; } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java index 897f0d908e..04a07a05ef 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,9 +10,8 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Iterator; - import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; /** @@ -80,7 +79,7 @@ public class FilteringIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return CollectionTools.list(this).toString(); } @@ -91,5 +90,4 @@ public class FilteringIterable<E> return FilteringIterable.this.accept(o); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java index 01912a47b5..1e1ce74a7b 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,7 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Arrays; import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.GraphIterator; /** @@ -38,8 +37,9 @@ import org.eclipse.jpt.common.utility.internal.iterators.GraphIterator; * <p> * To use, supply:<ul> * <li> either the initial node of the graph or an {@link Iterable} - * of the initial collection of graph nodes - * <li> a {@link GraphIterator.MisterRogers} that tells who the neighbors are + * of the initial collection of graph nodes + * <li> a {@link org.eclipse.jpt.common.utility.internal.iterators.GraphIterator.MisterRogers} + * that tells who the neighbors are * of each node * (alternatively, subclass <code>GraphIterable</code> * and override the {@link #neighbors(Object)} method) @@ -63,7 +63,7 @@ public class GraphIterable<E> * and a default Mr. Rogers that calls back to the iterable. * Use this constructor if you want to override the * {@link #neighbors(Object)} method instead of building - * a {@link GraphIterator.MisterRogers}. + * a {@link org.eclipse.jpt.common.utility.internal.iterators.GraphIterator.MisterRogers}. */ public GraphIterable(E root) { this(new SingleElementIterable<E>(root)); @@ -83,7 +83,7 @@ public class GraphIterable<E> * and a default Mr. Rogers that calls back to the iterable. * Use this constructor if you want to override the * {@link #neighbors(Object)} method instead of building - * a {@link GraphIterator.MisterRogers}. + * a {@link org.eclipse.jpt.common.utility.internal.iterators.GraphIterator.MisterRogers}. */ public GraphIterable(E... roots) { this(Arrays.asList(roots)); @@ -103,7 +103,7 @@ public class GraphIterable<E> * and a default Mr. Rogers that calls back to the iterable. * Use this constructor if you want to override the * {@link #neighbors(Object)} method instead of building - * a {@link GraphIterator.MisterRogers}. + * a {@link org.eclipse.jpt.common.utility.internal.iterators.GraphIterator.MisterRogers}. */ public GraphIterable(Iterable<? extends E> roots) { super(); @@ -133,7 +133,8 @@ public class GraphIterable<E> * Return the immediate neighbors of the specified object. * <p> * This method can be overridden by a subclass as an - * alternative to building a {@link GraphIterator.MisterRogers}. + * alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.GraphIterator.MisterRogers}. */ protected Iterator<? extends E> neighbors(@SuppressWarnings("unused") E next) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -141,7 +142,7 @@ public class GraphIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.roots); + return CollectionTools.list(this).toString(); } @@ -152,5 +153,4 @@ public class GraphIterable<E> return GraphIterable.this.neighbors(node); } } - } 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 index acb656d79e..8a9c478819 100644 --- 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. + * Copyright (c) 2011, 2012 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. @@ -10,7 +10,6 @@ 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; /** @@ -42,6 +41,6 @@ public class LateralIterableWrapper<E1, E2> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } } 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 index 3847723a63..954ff6f9dd 100644 --- 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. + * Copyright (c) 2011, 2012 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,8 +11,6 @@ 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; /** @@ -48,6 +46,6 @@ public class LateralListIterableWrapper<E1, E2> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java index ad5a5d7926..0b80e673c1 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -32,4 +32,8 @@ public class ListListIterable<E> return this.list.listIterator(); } + @Override + public String toString() { + return this.list.toString(); + } } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java index e8aaccff06..cc6e2d6160 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Collection; import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; /** @@ -29,7 +27,8 @@ import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; * By default, the iterator returned by a <code>LiveCloneIterable</code> does not * support the {@link Iterator#remove()} operation; this is because it does not * have access to the original collection. But if the <code>LiveCloneIterable</code> - * is supplied with an {@link CloneIterator.Remover} it will delegate the + * is supplied with an {@link org.eclipse.jpt.common.utility.internal.iterators.CloneIterator.Remover} + * it will delegate the * {@link Iterator#remove()} operation to the <code>Remover</code>. * Alternatively, a subclass can override the iterable's {@link #remove(Object)} * method. @@ -57,6 +56,9 @@ public class LiveCloneIterable<E> */ public LiveCloneIterable(Collection<? extends E> collection) { super(); + if (collection == null) { + throw new NullPointerException(); + } this.collection = collection; } @@ -67,6 +69,9 @@ public class LiveCloneIterable<E> */ public LiveCloneIterable(Collection<? extends E> collection, CloneIterator.Remover<E> remover) { super(remover); + if (collection == null) { + throw new NullPointerException(); + } this.collection = collection; } @@ -79,7 +84,6 @@ public class LiveCloneIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.collection); + return this.collection.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java index 9d26554db1..5ce780dbba 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,6 @@ 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.CloneListIterator; /** @@ -29,7 +27,8 @@ import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; * By default, the list iterator returned by a <code>LiveCloneListIterable</code> * does not support the modify operations; this is because it does not * have access to the original list. But if the <code>LiveCloneListIterable</code> - * is supplied with an {@link CloneListIterator.Mutator} it will delegate the + * is supplied with an {@link org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator.Mutator} + * it will delegate the * modify operations to the <code>Mutator</code>. * Alternatively, a subclass can override the list iterable's mutation * methods. @@ -57,6 +56,9 @@ public class LiveCloneListIterable<E> */ public LiveCloneListIterable(List<? extends E> list) { super(); + if (list == null) { + throw new NullPointerException(); + } this.list = list; } @@ -67,6 +69,9 @@ public class LiveCloneListIterable<E> */ public LiveCloneListIterable(List<? extends E> list, CloneListIterator.Mutator<E> mutator) { super(mutator); + if (list == null) { + throw new NullPointerException(); + } this.list = list; } @@ -79,7 +84,6 @@ public class LiveCloneListIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.list); + return this.list.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java index ad381ee41c..6beee40bd2 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -9,22 +9,21 @@ ******************************************************************************/ package org.eclipse.jpt.common.utility.internal.iterables; -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.PeekableIterator; /** * A <code>PeekableIterable</code> wraps another {@link Iterable} * and returns an {@link PeekableIterator} that allows a * {@link PeekableIterator#peek() peek} at the next element to be - * returned by {@link Iterator#next()}. + * returned by {@link java.util.Iterator#next()}. * <p> * One, possibly undesirable, side-effect of using this iterator is that * the nested iterator's <code>next()</code> method will be invoked - * <em>before</em> the peekable iterator's {@link Iterator#next()} + * <em>before</em> the peekable iterator's {@link java.util.Iterator#next()} * method is invoked. This is because the "next" element must be * pre-loaded for the {@link PeekableIterator#peek()} method. * This also prevents a peekable iterator from supporting the optional - * {@link Iterator#remove()} method. + * {@link java.util.Iterator#remove()} method. * * @param <E> the type of elements returned by the iterable's iterator * @@ -50,7 +49,6 @@ public class PeekableIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java index 5b2aa6d0b4..a81bca2e19 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,9 +10,7 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Iterator; - import org.eclipse.jpt.common.utility.internal.Queue; -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.QueueIterator; /** @@ -36,6 +34,9 @@ public class QueueIterable<E> */ public QueueIterable(Queue<E> queue) { super(); + if (queue == null) { + throw new NullPointerException(); + } this.queue = queue; } @@ -45,7 +46,6 @@ public class QueueIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.queue); + return this.queue.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java index ff2810fdda..f153469844 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,7 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyCompositeListIterator; import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; @@ -38,6 +37,9 @@ public class ReadOnlyCompositeListIterable<E> */ public ReadOnlyCompositeListIterable(ListIterable<? extends ListIterable<? extends E>> iterables) { super(); + if (iterables == null) { + throw new NullPointerException(); + } this.iterables = iterables; } @@ -94,7 +96,6 @@ public class ReadOnlyCompositeListIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterables); + return CollectionTools.list(this).toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java index 0483928be6..60d55469c8 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,6 @@ 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.ReadOnlyIterator; /** @@ -35,6 +33,9 @@ public class ReadOnlyIterable<E> */ public ReadOnlyIterable(Iterable<? extends E> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } this.iterable = iterable; } @@ -44,7 +45,6 @@ public class ReadOnlyIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java index 1efde41a59..d4ab709554 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; /** @@ -35,6 +33,9 @@ public class ReadOnlyListIterable<E> */ public ReadOnlyListIterable(ListIterable<? extends E> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } this.listIterable = iterable; } @@ -44,7 +45,6 @@ public class ReadOnlyListIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.listIterable); + return this.listIterable.toString(); } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java index 34ea3a7e24..5e340f31d2 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,6 @@ 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.SingleElementIterator; /** @@ -49,7 +47,6 @@ public class SingleElementIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.element); + return "[" + this.element + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java index c6e2100367..0e2d51ea50 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.SingleElementListIterator; /** @@ -52,7 +50,6 @@ public class SingleElementListIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.element); + return "[" + this.element + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java index 72beebec70..ae13b2578e 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -12,9 +12,7 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; - import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; /** @@ -31,7 +29,8 @@ import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; * By default, the iterator returned by a <code>SnapshotCloneIterable</code> does not * support the {@link Iterator#remove()} operation; this is because it does not * have access to the original collection. But if the <code>SnapshotCloneIterable</code> - * is supplied with a {@link CloneIterator.Remover} it will delegate the + * is supplied with a {@link org.eclipse.jpt.common.utility.internal.iterators.CloneIterator.Remover} + * it will delegate the * {@link Iterator#remove()} operation to the <code>Remover</code>. * Alternatively, a subclass can override the iterable's {@link #remove(Object)} * method. @@ -106,7 +105,7 @@ public class SnapshotCloneIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); + return Arrays.toString(this.array); } @@ -120,5 +119,4 @@ public class SnapshotCloneIterable<E> super(remover, array); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java index f242ab70f5..79b78080fb 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -12,8 +12,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Arrays; import java.util.List; import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; /** @@ -31,7 +29,8 @@ import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; * By default, the list iterator returned by a <code>SnapshotCloneListIterable</code> does not * support the {@link ListIterator} mutation operations; this is because it does not * have access to the original list. But if the <code>SnapshotCloneListIterable</code> - * is supplied with a {@link CloneListIterator.Mutator} it will delegate the + * is supplied with a {@link org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator.Mutator} + * it will delegate the * {@link ListIterator} mutation operations to the <code>Mutator</code>. * Alternatively, a subclass can override the list iterable's mutation * methods. @@ -84,7 +83,7 @@ public class SnapshotCloneListIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); + return Arrays.toString(this.array); } @@ -98,5 +97,4 @@ public class SnapshotCloneListIterable<E> super(mutator, array); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java index 211fe3f61a..c1c057d9f7 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,9 +10,7 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Iterator; - import org.eclipse.jpt.common.utility.internal.Stack; -import org.eclipse.jpt.common.utility.internal.StringTools; import org.eclipse.jpt.common.utility.internal.iterators.StackIterator; /** @@ -36,6 +34,9 @@ public class StackIterable<E> */ public StackIterable(Stack<E> stack) { super(); + if (stack == null) { + throw new NullPointerException(); + } this.stack = stack; } @@ -45,7 +46,6 @@ public class StackIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.stack); + return this.stack.toString(); } - } 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 13f5cb058c..0b5129c391 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. + * Copyright (c) 2010, 2012 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. @@ -10,8 +10,6 @@ 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.SubIteratorWrapper; /** @@ -36,6 +34,9 @@ public class SubIterableWrapper<E1, E2 extends E1> public SubIterableWrapper(Iterable<E1> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } this.iterable = iterable; } @@ -45,6 +46,6 @@ public class SubIterableWrapper<E1, E2 extends E1> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } } 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 d565d1bd1b..21f4c9b0dc 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, 2011 Oracle. All rights reserved. + * Copyright (c) 2010, 2012 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,7 +11,6 @@ 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; /** @@ -40,6 +39,9 @@ public class SubListIterableWrapper<E1, E2 extends E1> public SubListIterableWrapper(ListIterable<E1> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } this.iterable = iterable; } @@ -49,6 +51,6 @@ public class SubListIterableWrapper<E1, E2 extends E1> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } } 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 0b3e83ea32..872b6a478d 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, 2011 Oracle. All rights reserved. + * Copyright (c) 2010, 2012 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,8 +11,6 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; - /** * Wrap an iterable of elements of any sub-type of <code>E</code>, converting it into an * iterable of elements of type <code>E</code>. This shouldn't be a problem since there @@ -29,6 +27,9 @@ public class SuperIterableWrapper<E> @SuppressWarnings("unchecked") public SuperIterableWrapper(Iterable<? extends E> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } // this should be a safe cast - the iterator will only ever // return E (or a sub-type) from #next() this.iterable = (Iterable<E>) iterable; @@ -40,6 +41,6 @@ public class SuperIterableWrapper<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } } 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 7abe433983..1d39fd9646 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, 2011 Oracle. All rights reserved. + * Copyright (c) 2010, 2012 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,8 +11,6 @@ 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.SuperListIteratorWrapper; /** @@ -40,6 +38,9 @@ public class SuperListIterableWrapper<E> public SuperListIterableWrapper(ListIterable<? extends E> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } this.iterable = iterable; } @@ -49,6 +50,6 @@ public class SuperListIterableWrapper<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return this.iterable.toString(); } } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java index 124c15d07d..8dddc0f559 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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. @@ -10,8 +10,7 @@ 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.CollectionTools; import org.eclipse.jpt.common.utility.internal.Transformer; import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; @@ -45,6 +44,9 @@ public class TransformationIterable<E1, E2> */ public TransformationIterable(Iterable<? extends E1> iterable) { super(); + if (iterable == null) { + throw new NullPointerException(); + } this.iterable = iterable; this.transformer = this.buildDefaultTransformer(); } @@ -55,6 +57,9 @@ public class TransformationIterable<E1, E2> */ public TransformationIterable(Iterable<? extends E1> iterable, Transformer<E1, ? extends E2> transformer) { super(); + if ((iterable == null) || (transformer == null)) { + throw new NullPointerException(); + } this.iterable = iterable; this.transformer = transformer; } @@ -76,7 +81,7 @@ public class TransformationIterable<E1, E2> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return CollectionTools.list(this).toString(); } @@ -87,5 +92,4 @@ public class TransformationIterable<E1, E2> return TransformationIterable.this.transform(o); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java index 0f2d058f57..9d0a4131e7 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,7 @@ 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.CollectionTools; import org.eclipse.jpt.common.utility.internal.Transformer; import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; @@ -96,7 +95,7 @@ public class TransformationListIterable<E1, E2> @Override public String toString() { - return StringTools.buildToStringFor(this, this.iterable); + return CollectionTools.list(this).toString(); } @@ -107,5 +106,4 @@ public class TransformationListIterable<E1, E2> return TransformationListIterable.this.transform(o); } } - } diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java index 8e3e1ff336..8b3c81bec6 100644 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java +++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 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,8 +11,7 @@ package org.eclipse.jpt.common.utility.internal.iterables; import java.util.Arrays; import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; +import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator; /** @@ -25,7 +24,8 @@ import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator; * To use, supply:<ul> * <li> either the root element of the tree or, if the tree has * multiple roots, an {@link Iterable} of the set of roots - * <li> a {@link TreeIterator.Midwife} that delivers the children of each child + * <li> a {@link org.eclipse.jpt.common.utility.internal.iterators.TreeIterator.Midwife} + * that delivers the children of each child * (alternatively, subclass <code>TreeIterable</code> * and override the {@link #children(Object)} method) * </ul> @@ -46,7 +46,7 @@ public class TreeIterable<E> * and a default midwife that calls back to the iterable. * Use this constructor if you want to override the * {@link #children(Object)} method instead of building - * a {@link TreeIterator.Midwife}. + * a {@link org.eclipse.jpt.common.utility.internal.iterators.TreeIterator.Midwife}. */ public TreeIterable(E root) { this(new SingleElementIterable<E>(root)); @@ -65,7 +65,7 @@ public class TreeIterable<E> * and a default midwife that calls back to the iterable. * Use this constructor if you want to override the * {@link #children(Object)} method instead of building - * a {@link TreeIterator.Midwife}. + * a {@link org.eclipse.jpt.common.utility.internal.iterators.TreeIterator.Midwife}. */ public TreeIterable(E... roots) { this(Arrays.asList(roots)); @@ -84,10 +84,13 @@ public class TreeIterable<E> * and a default midwife that calls back to the iterable. * Use this constructor if you want to override the * {@link #children(Object)} method instead of building - * a {@link TreeIterator.Midwife}. + * a {@link org.eclipse.jpt.common.utility.internal.iterators.TreeIterator.Midwife}. */ public TreeIterable(Iterable<? extends E> roots) { super(); + if (roots == null) { + throw new NullPointerException(); + } this.roots = roots; this.midwife = this.buildDefaultMidwife(); } @@ -98,6 +101,9 @@ public class TreeIterable<E> */ public TreeIterable(Iterable<? extends E> roots, TreeIterator.Midwife<E> midwife) { super(); + if ((roots == null) || (midwife == null)) { + throw new NullPointerException(); + } this.roots = roots; this.midwife = midwife; } @@ -114,7 +120,8 @@ public class TreeIterable<E> * Return the immediate children of the specified object. * <p> * This method can be overridden by a subclass as an - * alternative to building a {@link TreeIterator.Midwife}. + * alternative to building a + * {@link org.eclipse.jpt.common.utility.internal.iterators.TreeIterator.Midwife}. */ protected Iterator<? extends E> children(@SuppressWarnings("unused") E next) { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ @@ -122,7 +129,7 @@ public class TreeIterable<E> @Override public String toString() { - return StringTools.buildToStringFor(this, this.roots); + return CollectionTools.list(this).toString(); } @@ -133,5 +140,4 @@ public class TreeIterable<E> return TreeIterable.this.children(node); } } - } |