From 9be3d81c37533b0b244ac27a4abbecce915156bc Mon Sep 17 00:00:00 2001
From: nhauge
Date: Thu, 12 May 2011 21:34:30 +0000
Subject: This commit was manufactured by cvs2svn to create tag
'v201108092000'.
---
.../org/eclipse/jpt/common/utility/Command.java | 87 -
.../jpt/common/utility/CommandExecutor.java | 61 -
.../src/org/eclipse/jpt/common/utility/Filter.java | 125 -
.../jpt/common/utility/IndentingPrintWriter.java | 155 -
.../org/eclipse/jpt/common/utility/JavaType.java | 135 -
.../jpt/common/utility/MethodSignature.java | 73 -
.../jpt/common/utility/ObjectReference.java | 29 -
.../common/utility/ReadOnlyObjectReference.java | 43 -
.../utility/internal/AbstractAssociation.java | 69 -
.../jpt/common/utility/internal/ArrayTools.java | 3122 -------------
.../jpt/common/utility/internal/Association.java | 46 -
.../internal/AsynchronousCommandExecutor.java | 168 -
.../eclipse/jpt/common/utility/internal/Bag.java | 197 -
.../jpt/common/utility/internal/BidiFilter.java | 122 -
.../utility/internal/BidiStringConverter.java | 149 -
.../common/utility/internal/BidiTransformer.java | 93 -
.../jpt/common/utility/internal/BitTools.java | 214 -
.../common/utility/internal/BooleanReference.java | 48 -
.../jpt/common/utility/internal/BooleanTools.java | 105 -
.../jpt/common/utility/internal/ClassName.java | 431 --
.../jpt/common/utility/internal/Classpath.java | 939 ----
.../common/utility/internal/CollectionTools.java | 1977 --------
.../common/utility/internal/CommandRunnable.java | 37 -
.../common/utility/internal/CompositeCommand.java | 44 -
.../utility/internal/CompositeException.java | 96 -
.../internal/ConsumerThreadCoordinator.java | 253 --
.../common/utility/internal/ExceptionHandler.java | 87 -
.../jpt/common/utility/internal/FileTools.java | 1002 -----
.../utility/internal/FlaggedObjectReference.java | 69 -
.../jpt/common/utility/internal/HashBag.java | 877 ----
.../common/utility/internal/IdentityHashBag.java | 924 ----
.../jpt/common/utility/internal/IntReference.java | 40 -
.../jpt/common/utility/internal/JDBCTools.java | 349 --
.../jpt/common/utility/internal/JDBCType.java | 162 -
.../jpt/common/utility/internal/KeyedSet.java | 129 -
.../internal/LazyReadOnlyObjectReference.java | 107 -
.../jpt/common/utility/internal/ListenerList.java | 171 -
.../jpt/common/utility/internal/NameTools.java | 377 --
.../internal/NonNullBooleanTransformer.java | 79 -
.../utility/internal/NotBooleanTransformer.java | 56 -
.../jpt/common/utility/internal/NotNullFilter.java | 51 -
.../jpt/common/utility/internal/NullList.java | 151 -
.../eclipse/jpt/common/utility/internal/Queue.java | 75 -
.../eclipse/jpt/common/utility/internal/Range.java | 87 -
.../utility/internal/ReadOnlyBooleanReference.java | 46 -
.../utility/internal/ReadOnlyIntReference.java | 145 -
.../common/utility/internal/ReflectionTools.java | 1544 -------
.../common/utility/internal/ReverseComparator.java | 40 -
.../common/utility/internal/RunnableCommand.java | 37 -
.../common/utility/internal/SimpleAssociation.java | 69 -
.../utility/internal/SimpleBooleanReference.java | 107 -
.../utility/internal/SimpleCommandExecutor.java | 46 -
.../jpt/common/utility/internal/SimpleFilter.java | 107 -
.../utility/internal/SimpleIntReference.java | 186 -
.../common/utility/internal/SimpleJavaType.java | 213 -
.../utility/internal/SimpleMethodSignature.java | 240 -
.../utility/internal/SimpleObjectReference.java | 98 -
.../jpt/common/utility/internal/SimpleQueue.java | 90 -
.../jpt/common/utility/internal/SimpleStack.java | 100 -
.../utility/internal/SimpleStringMatcher.java | 259 --
.../utility/internal/SimpleThreadFactory.java | 53 -
.../eclipse/jpt/common/utility/internal/Stack.java | 75 -
.../utility/internal/StatefulCommandExecutor.java | 33 -
.../common/utility/internal/StringCollator.java | 62 -
.../common/utility/internal/StringConverter.java | 80 -
.../jpt/common/utility/internal/StringMatcher.java | 65 -
.../jpt/common/utility/internal/StringTools.java | 4708 --------------------
.../common/utility/internal/SynchronizedBag.java | 220 -
.../utility/internal/SynchronizedBoolean.java | 516 ---
.../common/utility/internal/SynchronizedInt.java | 914 ----
.../utility/internal/SynchronizedObject.java | 472 --
.../common/utility/internal/SynchronizedQueue.java | 348 --
.../common/utility/internal/SynchronizedStack.java | 325 --
.../utility/internal/ThreadLocalCommand.java | 63 -
.../internal/ThreadLocalCommandExecutor.java | 65 -
.../eclipse/jpt/common/utility/internal/Tools.java | 96 -
.../jpt/common/utility/internal/Transformer.java | 95 -
.../common/utility/internal/XMLStringEncoder.java | 182 -
.../internal/enumerations/EmptyEnumeration.java | 62 -
.../internal/enumerations/IteratorEnumeration.java | 57 -
.../utility/internal/iterables/ArrayIterable.java | 77 -
.../internal/iterables/ArrayListIterable.java | 59 -
.../utility/internal/iterables/ChainIterable.java | 96 -
.../utility/internal/iterables/CloneIterable.java | 66 -
.../internal/iterables/CloneListIterable.java | 92 -
.../internal/iterables/CompositeIterable.java | 98 -
.../internal/iterables/CompositeListIterable.java | 135 -
.../utility/internal/iterables/EmptyIterable.java | 65 -
.../internal/iterables/EmptyListIterable.java | 65 -
.../internal/iterables/FilteringIterable.java | 95 -
.../utility/internal/iterables/GraphIterable.java | 156 -
.../utility/internal/iterables/ListIterable.java | 27 -
.../internal/iterables/ListListIterable.java | 35 -
.../internal/iterables/LiveCloneIterable.java | 85 -
.../internal/iterables/LiveCloneListIterable.java | 85 -
.../internal/iterables/PeekableIterable.java | 56 -
.../utility/internal/iterables/QueueIterable.java | 51 -
.../iterables/ReadOnlyCompositeListIterable.java | 100 -
.../internal/iterables/ReadOnlyIterable.java | 50 -
.../internal/iterables/ReadOnlyListIterable.java | 50 -
.../internal/iterables/SingleElementIterable.java | 55 -
.../iterables/SingleElementListIterable.java | 58 -
.../internal/iterables/SnapshotCloneIterable.java | 124 -
.../iterables/SnapshotCloneListIterable.java | 102 -
.../utility/internal/iterables/StackIterable.java | 51 -
.../internal/iterables/SubIterableWrapper.java | 46 -
.../internal/iterables/SubListIterableWrapper.java | 52 -
.../internal/iterables/SuperIterableWrapper.java | 48 -
.../iterables/SuperListIterableWrapper.java | 54 -
.../internal/iterables/TransformationIterable.java | 91 -
.../iterables/TransformationListIterable.java | 111 -
.../utility/internal/iterables/TreeIterable.java | 137 -
.../utility/internal/iterators/ArrayIterator.java | 88 -
.../internal/iterators/ArrayListIterator.java | 93 -
.../utility/internal/iterators/ChainIterator.java | 159 -
.../utility/internal/iterators/CloneIterator.java | 191 -
.../internal/iterators/CloneListIterator.java | 291 --
.../internal/iterators/CompositeIterator.java | 162 -
.../internal/iterators/CompositeListIterator.java | 270 --
.../utility/internal/iterators/EmptyIterator.java | 69 -
.../internal/iterators/EmptyListIterator.java | 93 -
.../internal/iterators/EnumerationIterator.java | 52 -
.../internal/iterators/FilteringIterator.java | 148 -
.../utility/internal/iterators/GraphIterator.java | 283 --
.../internal/iterators/PeekableIterator.java | 112 -
.../utility/internal/iterators/QueueIterator.java | 59 -
.../iterators/ReadOnlyCompositeListIterator.java | 252 --
.../internal/iterators/ReadOnlyIterator.java | 65 -
.../internal/iterators/ReadOnlyListIterator.java | 108 -
.../internal/iterators/ResultSetIterator.java | 162 -
.../internal/iterators/ReverseIterator.java | 82 -
.../internal/iterators/SingleElementIterator.java | 67 -
.../iterators/SingleElementListIterator.java | 98 -
.../utility/internal/iterators/StackIterator.java | 59 -
.../internal/iterators/SubIteratorWrapper.java | 58 -
.../internal/iterators/SubListIteratorWrapper.java | 90 -
.../internal/iterators/SuperIteratorWrapper.java | 58 -
.../iterators/SuperListIteratorWrapper.java | 88 -
.../internal/iterators/SynchronizedIterator.java | 76 -
.../iterators/SynchronizedListIterator.java | 122 -
.../internal/iterators/TransformationIterator.java | 103 -
.../iterators/TransformationListIterator.java | 152 -
.../utility/internal/iterators/TreeIterator.java | 254 --
.../utility/internal/model/AbstractModel.java | 1007 -----
.../internal/model/AspectChangeSupport.java | 349 --
.../utility/internal/model/ChangeSupport.java | 2844 ------------
.../internal/model/SingleAspectChangeSupport.java | 380 --
.../listener/awt/AWTChangeListenerWrapper.java | 454 --
.../awt/AWTCollectionChangeListenerWrapper.java | 161 -
.../listener/awt/AWTListChangeListenerWrapper.java | 211 -
.../awt/AWTPropertyChangeListenerWrapper.java | 87 -
.../awt/AWTStateChangeListenerWrapper.java | 86 -
.../listener/awt/AWTTreeChangeListenerWrapper.java | 161 -
.../model/value/AbstractCollectionValueModel.java | 124 -
.../model/value/AbstractListValueModel.java | 124 -
.../model/value/AbstractPropertyValueModel.java | 124 -
.../value/AbstractPropertyValueModelAdapter.java | 117 -
.../model/value/AbstractTreeNodeValueModel.java | 194 -
.../internal/model/value/AspectAdapter.java | 266 --
.../value/AspectCollectionValueModelAdapter.java | 155 -
.../model/value/AspectListValueModelAdapter.java | 197 -
.../value/AspectPropertyValueModelAdapter.java | 178 -
.../model/value/AspectTreeValueModelAdapter.java | 119 -
.../value/BufferedWritablePropertyValueModel.java | 392 --
.../CachingTransformationPropertyValueModel.java | 112 -
...ngTransformationWritablePropertyValueModel.java | 107 -
.../value/ChangePropertyValueModelAdapter.java | 99 -
.../model/value/CollectionAspectAdapter.java | 158 -
.../value/CollectionListValueModelAdapter.java | 217 -
.../value/CollectionPropertyValueModelAdapter.java | 139 -
.../model/value/CollectionValueModelWrapper.java | 132 -
.../value/CompositeBooleanPropertyValueModel.java | 338 --
.../model/value/CompositeCollectionValueModel.java | 448 --
.../model/value/CompositeListValueModel.java | 683 ---
.../model/value/CompositePropertyValueModel.java | 198 -
.../model/value/ExtendedListValueModelWrapper.java | 211 -
.../model/value/FilteringCollectionValueModel.java | 179 -
.../model/value/FilteringPropertyValueModel.java | 142 -
.../value/FilteringWritablePropertyValueModel.java | 123 -
.../value/ItemAspectListValueModelAdapter.java | 274 --
.../value/ItemChangeListValueModelAdapter.java | 68 -
.../value/ItemCollectionListValueModelAdapter.java | 101 -
.../model/value/ItemListListValueModelAdapter.java | 109 -
.../value/ItemPropertyListValueModelAdapter.java | 84 -
.../value/ItemStateListValueModelAdapter.java | 74 -
.../model/value/ItemTreeListValueModelAdapter.java | 101 -
.../internal/model/value/ListAspectAdapter.java | 176 -
.../value/ListCollectionValueModelAdapter.java | 233 -
.../utility/internal/model/value/ListCurator.java | 226 -
.../model/value/ListPropertyValueModelAdapter.java | 167 -
.../model/value/ListValueModelWrapper.java | 164 -
.../model/value/NullCollectionValueModel.java | 58 -
.../internal/model/value/NullListValueModel.java | 71 -
.../model/value/NullPropertyValueModel.java | 49 -
.../internal/model/value/NullTreeValueModel.java | 52 -
.../model/value/PropertyAspectAdapter.java | 128 -
.../value/PropertyCollectionValueModelAdapter.java | 141 -
.../model/value/PropertyListValueModelAdapter.java | 157 -
.../model/value/PropertyValueModelWrapper.java | 92 -
.../ReadOnlyWritablePropertyValueModelWrapper.java | 49 -
.../model/value/SetCollectionValueModel.java | 134 -
.../model/value/SimpleCollectionValueModel.java | 188 -
.../internal/model/value/SimpleListValueModel.java | 322 --
.../model/value/SimplePropertyValueModel.java | 66 -
.../model/value/SortedListValueModelAdapter.java | 125 -
.../model/value/SortedListValueModelWrapper.java | 250 --
.../value/StatePropertyValueModelAdapter.java | 96 -
.../model/value/StaticCollectionValueModel.java | 73 -
.../internal/model/value/StaticListValueModel.java | 93 -
.../model/value/StaticPropertyValueModel.java | 53 -
.../internal/model/value/StaticTreeValueModel.java | 57 -
.../model/value/TransformationListValueModel.java | 309 --
.../value/TransformationPropertyValueModel.java | 144 -
.../TransformationWritablePropertyValueModel.java | 131 -
.../internal/model/value/TreeAspectAdapter.java | 155 -
.../model/value/TreePropertyValueModelAdapter.java | 144 -
.../internal/model/value/ValueAspectAdapter.java | 201 -
.../internal/model/value/ValueChangeAdapter.java | 75 -
.../model/value/ValueCollectionAdapter.java | 107 -
.../internal/model/value/ValueListAdapter.java | 123 -
.../internal/model/value/ValuePropertyAdapter.java | 82 -
.../internal/model/value/ValueStateAdapter.java | 73 -
.../internal/model/value/ValueTreeAdapter.java | 107 -
...ritablePropertyCollectionValueModelAdapter.java | 62 -
.../WritablePropertyListValueModelAdapter.java | 62 -
.../value/prefs/PreferencePropertyValueModel.java | 346 --
.../prefs/PreferencesCollectionValueModel.java | 203 -
.../model/value/swing/AbstractTreeModel.java | 216 -
.../model/value/swing/CheckBoxModelAdapter.java | 43 -
.../internal/model/value/swing/ColumnAdapter.java | 49 -
.../model/value/swing/ComboBoxModelAdapter.java | 140 -
.../model/value/swing/DateSpinnerModelAdapter.java | 198 -
.../model/value/swing/DocumentAdapter.java | 375 --
.../model/value/swing/ListModelAdapter.java | 292 --
.../model/value/swing/ListSpinnerModelAdapter.java | 218 -
.../value/swing/NumberSpinnerModelAdapter.java | 223 -
.../value/swing/ObjectListSelectionModel.java | 427 --
.../model/value/swing/PrimitiveListTreeModel.java | 239 -
.../model/value/swing/RadioButtonModelAdapter.java | 151 -
.../model/value/swing/SpinnerModelAdapter.java | 207 -
.../model/value/swing/TableModelAdapter.java | 420 --
.../value/swing/ToggleButtonModelAdapter.java | 224 -
.../model/value/swing/TreeModelAdapter.java | 914 ----
.../common/utility/internal/node/AbstractNode.java | 941 ----
.../internal/node/AsynchronousValidator.java | 50 -
.../utility/internal/node/DefaultProblem.java | 85 -
.../jpt/common/utility/internal/node/Node.java | 377 --
.../utility/internal/node/PluggableValidator.java | 121 -
.../jpt/common/utility/internal/node/Problem.java | 51 -
.../internal/node/SynchronousValidator.java | 44 -
.../internal/swing/CachingComboBoxModel.java | 42 -
.../internal/swing/CheckBoxTableCellRenderer.java | 206 -
.../internal/swing/ComboBoxTableCellRenderer.java | 328 --
.../common/utility/internal/swing/Displayable.java | 44 -
.../common/utility/internal/swing/EmptyIcon.java | 54 -
.../internal/swing/FilteringListBrowser.java | 140 -
.../utility/internal/swing/FilteringListPanel.java | 455 --
.../common/utility/internal/swing/ListChooser.java | 430 --
.../utility/internal/swing/NodeSelector.java | 32 -
.../internal/swing/NonCachingComboBoxModel.java | 73 -
.../utility/internal/swing/SimpleDisplayable.java | 170 -
.../utility/internal/swing/SimpleListBrowser.java | 86 -
.../internal/swing/SimpleListCellRenderer.java | 128 -
.../internal/swing/SpinnerTableCellRenderer.java | 186 -
.../internal/swing/TableCellEditorAdapter.java | 96 -
.../synchronizers/AsynchronousSynchronizer.java | 188 -
.../CallbackAsynchronousSynchronizer.java | 120 -
.../CallbackSynchronousSynchronizer.java | 83 -
.../synchronizers/SynchronousSynchronizer.java | 263 --
.../eclipse/jpt/common/utility/model/Model.java | 143 -
.../common/utility/model/event/ChangeEvent.java | 66 -
.../utility/model/event/CollectionAddEvent.java | 124 -
.../utility/model/event/CollectionChangeEvent.java | 105 -
.../utility/model/event/CollectionClearEvent.java | 61 -
.../utility/model/event/CollectionEvent.java | 63 -
.../utility/model/event/CollectionRemoveEvent.java | 112 -
.../common/utility/model/event/ListAddEvent.java | 134 -
.../utility/model/event/ListChangeEvent.java | 105 -
.../common/utility/model/event/ListClearEvent.java | 61 -
.../jpt/common/utility/model/event/ListEvent.java | 64 -
.../common/utility/model/event/ListMoveEvent.java | 120 -
.../utility/model/event/ListRemoveEvent.java | 134 -
.../utility/model/event/ListReplaceEvent.java | 150 -
.../utility/model/event/PropertyChangeEvent.java | 109 -
.../utility/model/event/StateChangeEvent.java | 51 -
.../common/utility/model/event/TreeAddEvent.java | 81 -
.../utility/model/event/TreeChangeEvent.java | 90 -
.../common/utility/model/event/TreeClearEvent.java | 61 -
.../jpt/common/utility/model/event/TreeEvent.java | 62 -
.../utility/model/event/TreeRemoveEvent.java | 81 -
.../utility/model/listener/ChangeAdapter.java | 109 -
.../utility/model/listener/ChangeListener.java | 25 -
.../model/listener/CollectionChangeAdapter.java | 51 -
.../model/listener/CollectionChangeListener.java | 65 -
.../model/listener/CommandChangeListener.java | 44 -
.../utility/model/listener/ListChangeAdapter.java | 61 -
.../utility/model/listener/ListChangeListener.java | 87 -
.../MultiMethodReflectiveChangeListener.java | 160 -
.../model/listener/PropertyChangeAdapter.java | 31 -
.../model/listener/PropertyChangeListener.java | 37 -
.../model/listener/ReflectiveChangeListener.java | 377 --
.../model/listener/SimpleChangeListener.java | 131 -
.../SingleMethodReflectiveChangeListener.java | 60 -
.../utility/model/listener/StateChangeAdapter.java | 31 -
.../model/listener/StateChangeListener.java | 37 -
.../utility/model/listener/TreeChangeAdapter.java | 51 -
.../utility/model/listener/TreeChangeListener.java | 67 -
.../utility/model/value/CollectionValueModel.java | 42 -
.../common/utility/model/value/ListValueModel.java | 57 -
.../utility/model/value/PropertyValueModel.java | 36 -
.../utility/model/value/TreeNodeValueModel.java | 74 -
.../common/utility/model/value/TreeValueModel.java | 36 -
.../model/value/WritableCollectionValueModel.java | 34 -
.../model/value/WritableListValueModel.java | 34 -
.../model/value/WritablePropertyValueModel.java | 33 -
.../synchronizers/CallbackSynchronizer.java | 92 -
.../common/utility/synchronizers/Synchronizer.java | 83 -
317 files changed, 62287 deletions(-)
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectionTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CommandRunnable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeCommand.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeException.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ConsumerThreadCoordinator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandler.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FileTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FlaggedObjectReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/HashBag.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IdentityHashBag.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IntReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCType.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/KeyedSet.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyReadOnlyObjectReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ListenerList.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NameTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NonNullBooleanTransformer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotBooleanTransformer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotNullFilter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Range.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyBooleanReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyIntReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableCommand.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleAssociation.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleBooleanReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleCommandExecutor.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleFilter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleIntReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleJavaType.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleMethodSignature.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleObjectReference.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStringMatcher.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleThreadFactory.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StatefulCommandExecutor.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringCollator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringConverter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringMatcher.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBag.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBoolean.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedInt.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedObject.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommand.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Transformer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/XMLStringEncoder.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/EmptyEnumeration.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/IteratorEnumeration.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ChainIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EnumerationIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/FilteringIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/GraphIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/PeekableIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/QueueIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyCompositeListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ResultSetIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReverseIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/StackIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationListIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TreeIterator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AbstractModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AspectChangeSupport.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/SingleAspectChangeSupport.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTChangeListenerWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractTreeNodeValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectCollectionValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectPropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectTreeValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationWritablePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ChangePropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionAspectAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionValueModelWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeBooleanPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ExtendedListValueModelWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemAspectListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemChangeListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemCollectionListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemListListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemStateListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemTreeListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListAspectAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCollectionValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCurator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListValueModelWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullTreeValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyCollectionValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SetCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimplePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelWrapper.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StatePropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticTreeValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreeAspectAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreePropertyValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueAspectAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueCollectionAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueListAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValuePropertyAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueStateAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueTreeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyCollectionValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyListValueModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/AbstractTreeModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/CheckBoxModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ColumnAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ComboBoxModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DateSpinnerModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DocumentAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListSpinnerModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/PrimitiveListTreeModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/SpinnerModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TableModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ToggleButtonModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TreeModelAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AsynchronousValidator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/DefaultProblem.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Node.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/PluggableValidator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Problem.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/SynchronousValidator.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CachingComboBoxModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CheckBoxTableCellRenderer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ComboBoxTableCellRenderer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/Displayable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/EmptyIcon.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListPanel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ListChooser.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NodeSelector.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NonCachingComboBoxModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleDisplayable.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListBrowser.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListCellRenderer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SpinnerTableCellRenderer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/TableCellEditorAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/AsynchronousSynchronizer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackAsynchronousSynchronizer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackSynchronousSynchronizer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/SynchronousSynchronizer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/Model.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ChangeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionAddEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionChangeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionClearEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionRemoveEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListAddEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListChangeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListClearEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListMoveEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListRemoveEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListReplaceEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/PropertyChangeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/StateChangeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeAddEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeChangeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeClearEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeRemoveEvent.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CommandChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SimpleChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeAdapter.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeListener.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/CollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/ListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/PropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeNodeValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableCollectionValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableListValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritablePropertyValueModel.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/CallbackSynchronizer.java
delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/Synchronizer.java
(limited to 'common/plugins/org.eclipse.jpt.common.utility/src')
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java
deleted file mode 100644
index f152ba5fa6..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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;
-
-import java.io.Serializable;
-
-/**
- * Simple interface for implementing the GOF Command design pattern,
- * and it doesn't carry the baggage of {@link java.lang.Runnable}.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface Command {
-
- /**
- * Execute the command. The semantics of the command
- * is determined by the contract between the client and server.
- */
- void execute();
-
- /**
- * Singleton implementation of the command interface that will do nothing
- * when executed.
- */
- final class Null implements Command, Serializable {
- public static final Command INSTANCE = new Null();
- public static Command instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- public void execute() {
- // do nothing
- }
- @Override
- public String toString() {
- return "Command.Null"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- /**
- * Singleton implementation of the command interface that will throw an
- * exception when executed.
- */
- final class Disabled implements Command, Serializable {
- public static final Command INSTANCE = new Disabled();
- public static Command instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Disabled() {
- super();
- }
- // throw an exception
- public void execute() {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return "Command.Disabled"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java
deleted file mode 100644
index 461ab8615d..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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;
-
-import java.io.Serializable;
-
-/**
- * This interface allows clients to control how a command is executed.
- * This is useful when the server provides the command but the client provides
- * the context (e.g. the client would like to dispatch the command to the UI
- * thread).
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- */
-public interface CommandExecutor {
-
- /**
- * Execute the specified command.
- */
- void execute(Command command);
-
-
- /**
- * Singleton implementation of the command executor interface
- * that simply executes the command without any sort of enhancement.
- */
- final class Default implements CommandExecutor, Serializable {
- public static final CommandExecutor INSTANCE = new Default();
- public static CommandExecutor instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Default() {
- super();
- }
- public void execute(Command command) {
- command.execute();
- }
- @Override
- public String toString() {
- return "CommandExecutor.Default"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java
deleted file mode 100644
index 222185940e..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 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;
-
-import java.io.Serializable;
-
-/**
- * Used by various "pluggable" classes to filter objects.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * @param the type of objects to be filtered
- */
-public interface Filter {
-
- /**
- * Return whether the specified object is "accepted" by the
- * filter. The semantics of "accept" is determined by the
- * contract between the client and the server.
- */
- boolean accept(T o);
-
-
- /**
- * Singleton implemetation of the filter interface that accepts all the
- * objects (i.e. it does no filtering).
- */
- final class Null implements Filter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final Filter INSTANCE = new Null();
- @SuppressWarnings("unchecked")
- public static Filter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- // nothing is filtered - everything is accepted
- public boolean accept(S o) {
- return true;
- }
- @Override
- public String toString() {
- return "Filter.Null"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- /**
- * Singleton implemetation of the filter interface that accepts none of the
- * objects (i.e. it filters out all the objects).
- */
- final class Opaque implements Filter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final Filter INSTANCE = new Opaque();
- @SuppressWarnings("unchecked")
- public static Filter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Opaque() {
- super();
- }
- // everything is filtered - nothing is accepted
- public boolean accept(S o) {
- return false;
- }
- @Override
- public String toString() {
- return "Filter.Opaque"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- /**
- * Singleton implemetation of the filter interface that throws an exception
- * if called.
- */
- final class Disabled implements Filter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final Filter INSTANCE = new Disabled();
- @SuppressWarnings("unchecked")
- public static Filter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Disabled() {
- super();
- }
- // throw an exception
- public boolean accept(S o) {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return "Filter.Disabled"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java
deleted file mode 100644
index 11641aa132..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 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;
-
-import java.io.PrintWriter;
-import java.io.Writer;
-
-/**
- * Extend {@link PrintWriter} to automatically indent new lines.
- */
-public class IndentingPrintWriter
- extends PrintWriter
-{
- private final String indent;
- private int indentLevel;
- private boolean needsIndent;
-
- public static String DEFAULT_INDENT = "\t"; //$NON-NLS-1$
-
-
- /**
- * Construct a writer that indents with tabs.
- */
- public IndentingPrintWriter(Writer out) {
- this(out, DEFAULT_INDENT);
- }
-
- /**
- * Construct a writer that indents with the specified string.
- */
- public IndentingPrintWriter(Writer out, String indent) {
- super(out);
- this.indent = indent;
- this.indentLevel = 0;
- this.needsIndent = true;
- }
-
- /**
- * Set flag so following line is indented.
- */
- @Override
- public void println() {
- synchronized (this.lock) {
- super.println();
- this.needsIndent = true;
- }
- }
-
- /**
- * Print the appropriate indent.
- * Pre-condition: synchronized
- */
- private void printIndent() {
- if (this.needsIndent) {
- this.needsIndent = false;
- for (int i = this.indentLevel; i-- > 0; ) {
- this.print(this.indent);
- }
- }
- }
-
- /**
- * Write a portion of an array of characters.
- */
- @Override
- public void write(char buf[], int off, int len) {
- synchronized (this.lock) {
- this.printIndent();
- super.write(buf, off, len);
- }
- }
-
- /**
- * Write a single character.
- */
- @Override
- public void write(int c) {
- synchronized (this.lock) {
- this.printIndent();
- super.write(c);
- }
- }
-
- /**
- * Write a portion of a string.
- */
- @Override
- public void write(String s, int off, int len) {
- synchronized (this.lock) {
- this.printIndent();
- super.write(s, off, len);
- }
- }
-
- /**
- * Bump the indent level.
- */
- public void indent() {
- this.incrementIndentLevel();
- }
-
- /**
- * Decrement the indent level.
- */
- public void undent() {
- this.decrementIndentLevel();
- }
-
- /**
- * Bump the indent level.
- */
- public void incrementIndentLevel() {
- synchronized (this.lock) {
- this.indentLevel++;
- }
- }
-
- /**
- * Decrement the indent level.
- */
- public void decrementIndentLevel() {
- synchronized (this.lock) {
- this.indentLevel--;
- }
- }
-
- /**
- * Return the current indent level.
- */
- public int getIndentLevel() {
- synchronized (this.lock) {
- return this.indentLevel;
- }
- }
-
- /**
- * Allow the indent level to be set directly.
- * Return the previous indent level.
- */
- public int setIndentLevel(int indentLevel) {
- synchronized (this.lock) {
- int old = this.indentLevel;
- this.indentLevel = indentLevel;
- return old;
- }
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java
deleted file mode 100644
index fb019d5ebe..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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;
-
-import java.io.PrintWriter;
-
-/**
- * This interface describes a Java type; i.e. its "element type"
- * and its "array depth". The element type is referenced by name,
- * allowing us to reference classes that are not (or cannot be) loaded.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface JavaType {
-
- /**
- * Return the name of the type's "element type".
- * A member type will have one or more '$'
characters in its name.
- */
- String getElementTypeName();
-
- /**
- * Return the type's "array depth".
- */
- int getArrayDepth();
-
- /**
- * Return whether the type is an array (i.e. its "array depth" is greater
- * than zero).
- */
- boolean isArray();
-
- /**
- * Return whether the type is a "primitive" (e.g. int
, float
).
- *
- * NB: void.class.isPrimitive() == true
- */
- boolean isPrimitive();
-
- /**
- * Return whether the type is a "primitive wrapper" (e.g. {@link java.lang.Integer},
- * {@link java.lang.Float}).
- *
- * NB: void.class.isPrimitive() == true
- */
- boolean isPrimitiveWrapper();
-
- /**
- * Return whether the type is a "variable primitive" (e.g. int
, float
,
- * but not void
).
- *
- * NB: variables cannot be declared void
- */
- boolean isVariablePrimitive();
-
- /**
- * Return whether the type is a "variable primitive wrapper" (e.g.
- * {@link java.lang.Integer}, {@link java.lang.Float},
- * but not {@link java.lang.Void}).
- *
- * NB: variables cannot be declared void
- */
- boolean isVariablePrimitiveWrapper();
-
- /**
- * Return the class corresponding to the type's element type and array depth.
- */
- Class> getJavaClass() throws ClassNotFoundException;
-
- /**
- * Return the version of the type's name that matches that
- * returned by {@link java.lang.Class#getName()}
- * (e.g. "[[J"
, "[Ljava.lang.Object;"
,
- * "java.util.Map$Entry"
).
- */
- String getJavaClassName();
-
- /**
- * Return whether the type is equal to the specified type.
- */
- boolean equals(String otherElementTypeName, int otherArrayDepth);
-
- /**
- * Return whether the type describes to the specified type.
- */
- boolean describes(String className);
-
- /**
- * Return whether the type describes to the specified type.
- */
- boolean describes(Class> javaClass);
-
- /**
- * Return whether the type is equal to the specified type.
- */
- boolean equals(JavaType other);
-
- /**
- * Return the version of the type's name that can be used in source code:
- * "[[J"
=> "long[][]"
- * "java.util.Map$Entry"
=> "java.util.Map.Entry"
- *
- */
- String declaration();
-
- /**
- * Append the version of the type's name that can be used in source code:
- * "[[J"
=> "long[][]"
- * "java.util.Map$Entry"
=> "java.util.Map.Entry"
- *
- */
- void appendDeclarationTo(StringBuilder sb);
-
- /**
- * Print the version of the type's name that can be used in source code:
- * "[[J"
=> "long[][]"
- * "java.util.Map$Entry"
=> "java.util.Map.Entry"
- *
- */
- void printDeclarationOn(PrintWriter pw);
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java
deleted file mode 100644
index 32e793a071..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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;
-
-import java.io.PrintWriter;
-import java.lang.reflect.Method;
-
-/**
- * This interface describes a Java method signature; i.e. its "name"
- * and its "parameter types". The parameter types are referenced by name,
- * allowing us to reference classes that are not (or cannot be) loaded.
- *
- * Provisional API: This interface is part of an interim API that is still
- * under development and expected to change significantly before reaching
- * stability. It is available at this early stage to solicit feedback from
- * pioneering adopters on the understanding that any code that uses this API
- * will almost certainly be broken (repeatedly) as the API evolves.
- *
- * This interface is not intended to be implemented by clients.
- */
-public interface MethodSignature {
-
- /**
- * Return the method's name.
- */
- String getName();
-
- /**
- * Return the method's parameter types.
- */
- JavaType[] getParameterTypes();
-
- /**
- * Return whether the method signature describes the specified method.
- */
- boolean describes(Method method);
-
- /**
- * Return whether the method signature equals the specified signature.
- */
- boolean equals(String otherName, JavaType[] otherParameterTypes);
-
- /**
- * Return whether the method signature equals the specified signature.
- */
- boolean equals(MethodSignature other);
-
- /**
- * Return a string representation of the method's signature:
- * "foo(int, java.lang.String)"
- */
- String getSignature();
-
- /**
- * Append a string representation of the method's signature:
- * "foo(int, java.lang.String)"
- */
- void appendSignatureTo(StringBuilder sb);
-
- /**
- * Print a string representation of the method's signature:
- * "foo(int, java.lang.String)"
- */
- void printSignatureOn(PrintWriter pw);
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java
deleted file mode 100644
index 991c2c97d2..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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;
-
-/**
- * Provide a container for passing an object that can be changed by the recipient.
- */
-public interface ObjectReference
- extends ReadOnlyObjectReference
-{
- /**
- * Set the value.
- * Return the previous value.
- */
- V setValue(V value);
-
- /**
- * Set the value to null
.
- * Return the previous value.
- */
- V setNull();
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java
deleted file mode 100644
index 02c4ff6a24..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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;
-
-/**
- * Provide a container for holding an object that cannot be changed.
- *
- * @see ObjectReference
- */
-public interface ReadOnlyObjectReference
-{
- /**
- * Return the current value.
- */
- V getValue();
-
- /**
- * Return whether the current value is equal to the specified value.
- */
- boolean valueEquals(Object object);
-
- /**
- * Return whether the current value is not equal to the specified value.
- */
- boolean valueNotEqual(Object object);
-
- /**
- * Return whether the current value is null
.
- */
- boolean isNull();
-
- /**
- * Return whether the current value is not null
.
- */
- boolean isNotNull();
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java
deleted file mode 100644
index 744d95c727..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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;
-
-/**
- * Implement some of the methods in {@link Association} that can
- * be defined in terms of the other methods.
- */
-public abstract class AbstractAssociation
- implements Association
-{
- /**
- * Default constructor.
- */
- protected AbstractAssociation() {
- super();
- }
-
- @Override
- public synchronized boolean equals(Object o) {
- if ( ! (o instanceof Association, ?>)) {
- return false;
- }
- Association, ?> other = (Association, ?>) o;
- return this.keyEquals(other) && this.valueEquals(other);
- }
-
- protected boolean keyEquals(Association, ?> other) {
- Object key = this.getKey();
- return (key == null) ?
- (other.getKey() == null) :
- key.equals(other.getKey());
- }
-
- protected boolean valueEquals(Association, ?> other) {
- Object value = this.getValue();
- return (value == null) ?
- (other.getValue() == null) :
- value.equals(other.getValue());
- }
-
- @Override
- public synchronized int hashCode() {
- return this.keyHashCode() ^ this.valueHashCode();
- }
-
- protected int keyHashCode() {
- Object key = this.getKey();
- return (key == null) ? 0 : key.hashCode();
- }
-
- protected int valueHashCode() {
- Object value = this.getValue();
- return (value == null) ? 0 : value.hashCode();
- }
-
- @Override
- public synchronized String toString() {
- return this.getKey() + " => " + this.getValue(); //$NON-NLS-1$
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java
deleted file mode 100644
index 4f152023e7..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java
+++ /dev/null
@@ -1,3122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 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;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Random;
-
-/**
- * Array-related utility methods.
- */
-public final class ArrayTools {
- public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
- public static final char[] EMPTY_CHAR_ARRAY = new char[0];
- public static final int[] EMPTY_INT_ARRAY = new int[0];
-
- // ********** instantiation **********
-
- /**
- * Return a new array with the same length
- * and the same component type as the specified array.
- *
- * Arrays.newArray(Object[] array)
- */
- public static E[] newArray(E[] array) {
- return newArray(array, array.length);
- }
-
- /**
- * Return a new array with the specified length
- * and the same component type as the specified array.
- *
- * Arrays.newArray(Object[] array, int length)
- */
- public static E[] newArray(E[] array, int length) {
- return newArray(componentType(array), length);
- }
-
- /**
- * Return the specified array's component type, with appropriate support
- * for generics.
- */
- public static Class extends E> componentType(E[] array) {
- Class> rawComponentType = array.getClass().getComponentType();
- @SuppressWarnings("unchecked")
- Class extends E> componentType = (Class extends E>) rawComponentType;
- return componentType;
- }
-
- /**
- * Return a new array with the specified component type and length,
- * with appropriate support for generics. The component type cannot be a
- * primitive type.
- */
- public static E[] newArray(Class extends E> componentType, int length) {
- if (componentType.isPrimitive()) {
- throw new IllegalArgumentException("Array class cannot be primitive: " + componentType); //$NON-NLS-1$
- }
- return newArray_(componentType, length);
- }
-
- /**
- * assume the component type is not a primitive class
- */
- @SuppressWarnings("unchecked")
- private static E[] newArray_(Class extends E> componentType, int length) {
- return (E[]) ((componentType == OBJECT_CLASS) ?
- new Object[length] :
- Array.newInstance(componentType, length));
- }
- private static final Class OBJECT_CLASS = Object.class;
-
-
- // ********** conversion **********
-
- /**
- * Return an array corresponding to the specified iterable.
- *
- * Iterable.toArray()
- * @see Collection#toArray()
- */
- public static Object[] array(Iterable> iterable) {
- return array(iterable.iterator());
- }
-
- /**
- * Return an array corresponding to the specified iterable.
- * The specified iterable size is a performance hint.
- *
- * Iterable.toArray()
- * @see Collection#toArray()
- */
- public static Object[] array(Iterable> iterable, int iterableSize) {
- return array(iterable.iterator(), iterableSize);
- }
-
- /**
- * Return an array corresponding to the specified iterable;
- * the runtime type of the returned array is that of the specified array.
- * If the iterable fits in the specified array, it is returned therein.
- * Otherwise, a new array is allocated with the runtime type of the
- * specified array and the size of the iterable.
- *
- * Iterable.toArray(Object[])
- * @see Collection#toArray(Object[])
- */
- public static E[] array(Iterable extends E> iterable, E[] array) {
- return array(iterable.iterator(), array);
- }
-
- /**
- * Return an array corresponding to the specified iterable;
- * the runtime type of the returned array is that of the specified array.
- * If the iterable fits in the specified array, it is returned therein.
- * Otherwise, a new array is allocated with the runtime type of the
- * specified array and the size of the iterable.
- * The specified iterable size is a performance hint.
- *
- * Iterable.toArray(Object[])
- * @see Collection#toArray(Object[])
- */
- public static E[] array(Iterable extends E> iterable, int iterableSize, E[] array) {
- return array(iterable.iterator(), iterableSize, array);
- }
-
- /**
- * Return an array corresponding to the specified iterator.
- *
- * Iterator.toArray()
- * @see Collection#toArray()
- */
- public static Object[] array(Iterator> iterator) {
- return iterator.hasNext() ?
- CollectionTools.list(iterator).toArray() :
- EMPTY_OBJECT_ARRAY;
- }
-
- /**
- * Return an array corresponding to the specified iterator.
- * The specified iterator size is a performance hint.
- *
- * Iterator.toArray()
- * @see Collection#toArray()
- */
- public static Object[] array(Iterator> iterator, int iteratorSize) {
- return iterator.hasNext() ?
- CollectionTools.list(iterator, iteratorSize).toArray() :
- EMPTY_OBJECT_ARRAY;
- }
-
- /**
- * Return an array corresponding to the specified iterator;
- * the runtime type of the returned array is that of the specified array.
- * If the iterator fits in the specified array, it is returned therein.
- * Otherwise, a new array is allocated with the runtime type of the
- * specified array and the size of the iterator.
- *
- * Iterator.toArray(Object[])
- * @see Collection#toArray(Object[])
- */
- public static E[] array(Iterator extends E> iterator, E[] array) {
- return iterator.hasNext() ?
- CollectionTools.list(iterator).toArray(array) :
- emptyArray(array);
- }
-
- /**
- * Return an array corresponding to the specified iterator;
- * the runtime type of the returned array is that of the specified array.
- * If the iterator fits in the specified array, it is returned therein.
- * Otherwise, a new array is allocated with the runtime type of the
- * specified array and the size of the iterator.
- * The specified iterator size is a performance hint.
- *
- * Iterator.toArray(Object[])
- * @see Collection#toArray(Object[])
- */
- public static E[] array(Iterator extends E> iterator, int iteratorSize, E[] array) {
- return iterator.hasNext() ?
- CollectionTools.list(iterator, iteratorSize).toArray(array) :
- emptyArray(array);
- }
-
- /**
- * If the specified array is empty, return it;
- * otherwise, set its first element to null.
- * @see Collection#toArray(Object[])
- */
- private static E[] emptyArray(E[] array) {
- return (array.length == 0) ? array : clearFirst(array);
- }
-
- /**
- * Set the specified array's first element to null and and return the array.
- * Assume the array length > 0.
- */
- private static E[] clearFirst(E[] array) {
- array[0] = null;
- return array;
- }
-
-
- // ********** add **********
-
- /**
- * Return a new array containing the elements in the
- * specified array followed by the specified object to be added.
- *
- * Arrays.add(Object[] array, Object o)
- */
- public static E[] add(E[] array, E value) {
- int len = array.length;
- E[] result = newArray(array, len + 1);
- if (len > 0) {
- System.arraycopy(array, 0, result, 0, len);
- }
- result[len] = value;
- return result;
- }
-
- /**
- * Return a new array containing the elements in the
- * specified array with the specified object added at the specified index.
- *
- * Arrays.add(Object[] array, int index, Object o)
- */
- public static E[] add(E[] array, int index, E value) {
- int len = array.length;
- E[] result = newArray(array, len + 1);
- if (index > 0) {
- System.arraycopy(array, 0, result, 0, index);
- }
- result[index] = value;
- if (index < len) {
- System.arraycopy(array, index, result, index + 1, len - index);
- }
- return result;
- }
-
- /**
- * Return a new array containing the elements in the
- * specified array followed by the specified value to be added.
- *
- * Arrays.add(char[] array, char value)
- */
- public static char[] add(char[] array, char value) {
- int len = array.length;
- char[] result = new char[len + 1];
- if (len > 0) {
- System.arraycopy(array, 0, result, 0, len);
- }
- result[len] = value;
- return result;
- }
-
- /**
- * Return a new array containing the elements in the
- * specified array with the specified value added at the specified index.
- *
- * Arrays.add(char[] array, int index, char value)
- */
- public static char[] add(char[] array, int index, char value) {
- int len = array.length;
- char[] result = new char[len + 1];
- if (index > 0) {
- System.arraycopy(array, 0, result, 0, index);
- }
- result[index] = value;
- if (index < len) {
- System.arraycopy(array, index, result, index + 1, len - index);
- }
- return result;
- }
-
- /**
- * Return a new array containing the elements in the
- * specified array followed by the specified value to be added.
- *
- * Arrays.add(int[] array, int value)
- */
- public static int[] add(int[] array, int value) {
- int len = array.length;
- int[] result = new int[len + 1];
- if (len > 0) {
- System.arraycopy(array, 0, result, 0, len);
- }
- result[len] = value;
- return result;
- }
-
- /**
- * Return a new array containing the elements in the
- * specified array with the specified value added at the specified index.
- *
- * Arrays.add(int[] array, int index, int value)
- */
- public static int[] add(int[] array, int index, int value) {
- int len = array.length;
- int[] result = new int[len + 1];
- if (index > 0) {
- System.arraycopy(array, 0, result, 0, index);
- }
- result[index] = value;
- if (index < len) {
- System.arraycopy(array, index, result, index + 1, len - index);
- }
- return result;
- }
-
-
- // ********** add all **********
-
- /**
- * Return an array containing the elements in the
- * specified array followed by the elements
- * in the specified collection.
- *
- * Arrays.addAll(Object[] array, Collection collection)
- */
- public static E[] addAll(E[] array, Collection extends E> collection) {
- return addAll(array, collection, collection.size());
- }
-
- /**
- * check collection size
- */
- private static E[] addAll(E[] array, Collection extends E> collection, int collectionSize) {
- return (collectionSize == 0) ? array : addAll_(array, collection, collectionSize);
- }
-
- /**
- * assume the collection is non-empty
- */
- private static E[] addAll_(E[] array, Collection extends E> collection) {
- return addAll_(array, collection, collection.size());
- }
-
- /**
- * assume collection size > zero
- */
- private static E[] addAll_(E[] array, Collection extends E> collection, int collectionSize) {
- return addAll(array, collection, array.length, collectionSize);
- }
-
- /**
- * assume collection size > zero; check array length
- */
- private static E[] addAll(E[] array, Collection extends E> collection, int arrayLength, int collectionSize) {
- return (arrayLength == 0) ?
- collection.toArray(newArray(array, collectionSize)) :
- addAll_(array, collection, arrayLength, collectionSize);
- }
-
- /**
- * assume array length and collection size > zero
- */
- private static E[] addAll_(E[] array, Collection extends E> collection, int arrayLength, int collectionSize) {
- E[] result = newArray(array, arrayLength + collectionSize);
- System.arraycopy(array, 0, result, 0, arrayLength);
- int i = arrayLength;
- for (E element : collection) {
- result[i++] = element;
- }
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array followed by the elements
- * in the specified iterable.
- *
- * Arrays.addAll(Object[] array, Iterable iterable)
- */
- public static E[] addAll(E[] array, Iterable extends E> iterable) {
- return addAll(array, iterable.iterator());
- }
-
- /**
- * Return an array containing the elements in the
- * specified array followed by the elements
- * in the specified iterable.
- * The specified iterable size is a performance hint.
- *
- * Arrays.addAll(Object[] array, Iterable iterable)
- */
- public static E[] addAll(E[] array, Iterable extends E> iterable, int iterableSize) {
- return addAll(array, iterable.iterator(), iterableSize);
- }
-
- /**
- * Return an array containing the elements in the
- * specified array followed by the elements
- * in the specified iterator.
- *
- * Arrays.addAll(Object[] array, Iterator iterator)
- */
- public static E[] addAll(E[] array, Iterator extends E> iterator) {
- return iterator.hasNext() ? addAll_(array, CollectionTools.list(iterator)) : array;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array followed by the elements
- * in the specified iterator.
- * The specified iterator size is a performance hint.
- *
- * Arrays.addAll(Object[] array, Iterator iterator)
- */
- public static E[] addAll(E[] array, Iterator extends E> iterator, int iteratorSize) {
- return iterator.hasNext() ? addAll_(array, CollectionTools.list(iterator, iteratorSize)) : array;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array 1 followed by the elements
- * in the specified array 2.
- *
- * Arrays.addAll(Object[] array1, Object[] array2)
- */
- public static E[] addAll(E[] array1, E... array2) {
- return addAll(array1, array2, array2.length);
- }
-
- /**
- * check array 2 length
- */
- private static E[] addAll(E[] array1, E[] array2, int array2Length) {
- return (array2Length == 0) ? array1 : addAll_(array1, array2, array2Length);
- }
-
- /**
- * assume array 2 length > 0
- */
- private static E[] addAll_(E[] array1, E[] array2, int array2Length) {
- return addAll(array1, array2, array1.length, array2Length);
- }
-
- /**
- * assume array 2 length > 0; check array 1 length
- */
- private static E[] addAll(E[] array1, E[] array2, int array1Length, int array2Length) {
- return (array1Length == 0) ? array2 : addAll_(array1, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0
- */
- private static E[] addAll_(E[] array1, E[] array2, int array1Length, int array2Length) {
- E[] result = newArray(array1, array1Length + array2Length);
- System.arraycopy(array1, 0, result, 0, array1Length);
- System.arraycopy(array2, 0, result, array1Length, array2Length);
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * first specified array with the objects in the second
- * specified array added at the specified index.
- *
- * Arrays.addAll(Object[] array1, int index, Object[] array2)
- */
- public static E[] addAll(E[] array1, int index, E... array2) {
- return addAll(array1, index, array2, array2.length);
- }
-
- /**
- * check array 2 length
- */
- private static E[] addAll(E[] array1, int index, E[] array2, int array2Length) {
- return (array2Length == 0) ? array1 : addAll_(array1, index, array2, array2Length);
- }
-
- /**
- * assume array 2 length > 0
- */
- private static E[] addAll_(E[] array1, int index, E[] array2, int array2Length) {
- return addAll(array1, index, array2, array1.length, array2Length);
- }
-
- /**
- * assume array 2 length > 0; check array 1 length
- */
- private static E[] addAll(E[] array1, int index, E[] array2, int array1Length, int array2Length) {
- return (array1Length == 0) ?
- array2 :
- (index == array1Length) ? // 'array2' added to end of 'array1'
- addAll_(array1, array2, array1Length, array2Length) :
- addAll_(array1, index, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0 and index != array 1 length
- */
- private static E[] addAll_(E[] array1, int index, E[] array2, int array1Length, int array2Length) {
- E[] result = newArray(array1, array1Length + array2Length);
- System.arraycopy(array1, 0, result, 0, index);
- System.arraycopy(array2, 0, result, index, array2Length);
- System.arraycopy(array1, index, result, index + array2Length, array1Length - index);
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array with the elements
- * in the specified collection inserted at the specified index.
- *
- * Arrays.addAll(Object[] array, int index, Collection c)
- */
- public static E[] addAll(E[] array, int index, Collection extends E> collection) {
- return addAll(array, index, collection, collection.size());
- }
-
- /**
- * check collection size
- */
- private static E[] addAll(E[] array, int index, Collection extends E> collection, int collectionSize) {
- return (collectionSize == 0) ? array : addAll_(array, index, collection, collectionSize);
- }
-
- /**
- * assume collection size > 0
- */
- private static E[] addAll_(E[] array, int index, Collection extends E> collection, int collectionSize) {
- return addAll(array, index, collection, array.length, collectionSize);
- }
-
- /**
- * assume collection size > 0; check array length
- */
- private static E[] addAll(E[] array, int index, Collection extends E> collection, int arrayLength, int collectionSize) {
- if (arrayLength == 0) {
- if (index == 0) {
- return collection.toArray(newArray(array, collectionSize));
- }
- throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return (index == arrayLength) ? // 'collection' added to end of 'array'
- addAll_(array, collection, arrayLength, collectionSize) :
- addAll_(array, index, collection, arrayLength, collectionSize);
- }
-
- /**
- * assume array length and collection size > 0 and index != array length
- */
- private static E[] addAll_(E[] array, int index, Collection extends E> collection, int arrayLength, int collectionSize) {
- E[] result = newArray(array, arrayLength + collectionSize);
- System.arraycopy(array, 0, result, 0, index);
- int i = index;
- for (E item : collection) {
- result[i++] = item;
- }
- System.arraycopy(array, index, result, index + collectionSize, arrayLength - index);
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array with the elements
- * in the specified iterable inserted at the specified index.
- *
- * Arrays.addAll(Object[] array, int index, Iterable iterable)
- */
- public static E[] addAll(E[] array, int index, Iterable extends E> iterable) {
- return addAll(array, index, iterable.iterator());
- }
-
- /**
- * Return an array containing the elements in the
- * specified array with the elements
- * in the specified iterable inserted at the specified index.
- *
- * Arrays.addAll(Object[] array, int index, Iterable iterable)
- */
- public static E[] addAll(E[] array, int index, Iterable extends E> iterable, int iterableSize) {
- return addAll(array, index, iterable.iterator(), iterableSize);
- }
-
- /**
- * Return an array containing the elements in the
- * specified array with the elements
- * in the specified iterator inserted at the specified index.
- *
- * Arrays.addAll(Object[] array, int index, Iterator iterator)
- */
- public static E[] addAll(E[] array, int index, Iterator extends E> iterator) {
- return iterator.hasNext() ? addAll_(array, index, CollectionTools.list(iterator)) : array;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array with the elements
- * in the specified iterator inserted at the specified index.
- * The specified iterator size is a performance hint.
- *
- * Arrays.addAll(Object[] array, int index, Iterator iterator)
- */
- public static E[] addAll(E[] array, int index, Iterator extends E> iterator, int iteratorSize) {
- return iterator.hasNext() ? addAll_(array, index, CollectionTools.list(iterator, iteratorSize)) : array;
- }
-
- /**
- * assume collection is non-empty
- */
- private static E[] addAll_(E[] array, int index, Collection extends E> collection) {
- return addAll_(array, index, collection, collection.size());
- }
-
- /**
- * Return an array containing the elements in the
- * specified array 1 followed by the elements
- * in the specified array 2.
- *
- * Arrays.addAll(char[] array1, char[] array2)
- */
- public static char[] addAll(char[] array1, char... array2) {
- return addAll(array1, array2, array2.length);
- }
-
- /**
- * check array 2 length
- */
- private static char[] addAll(char[] array1, char[] array2, int array2Length) {
- return (array2Length == 0) ? array1 : addAll_(array1, array2, array2Length);
- }
-
- /**
- * assume array 2 length > 0
- */
- private static char[] addAll_(char[] array1, char[] array2, int array2Length) {
- return addAll(array1, array2, array1.length, array2Length);
- }
-
- /**
- * assume array 2 length > 0; check array 1 length
- */
- private static char[] addAll(char[] array1, char[] array2, int array1Length, int array2Length) {
- return (array1Length == 0) ? array2 : addAll_(array1, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0
- */
- private static char[] addAll_(char[] array1, char[] array2, int array1Length, int array2Length) {
- char[] result = new char[array1Length + array2Length];
- System.arraycopy(array1, 0, result, 0, array1Length);
- System.arraycopy(array2, 0, result, array1Length, array2Length);
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * first specified array with the objects in the second
- * specified array added at the specified index.
- *
- * Arrays.add(char[] array1, int index, char[] array2)
- */
- public static char[] addAll(char[] array1, int index, char... array2) {
- return addAll(array1, index, array2, array2.length);
- }
-
- /**
- * check array 2 length
- */
- private static char[] addAll(char[] array1, int index, char[] array2, int array2Length) {
- return (array2Length == 0) ? array1 : addAll_(array1, index, array2, array2Length);
- }
-
- /**
- * assume array 2 length > 0
- */
- private static char[] addAll_(char[] array1, int index, char[] array2, int array2Length) {
- return addAll(array1, index, array2, array1.length, array2Length);
- }
-
- /**
- * assume array 2 length > 0; check array 1 length
- */
- private static char[] addAll(char[] array1, int index, char[] array2, int array1Length, int array2Length) {
- return (array1Length == 0) ?
- array2 :
- (index == array1Length) ? // 'array2' added to end of 'array1'
- addAll_(array1, array2, array1Length, array2Length) :
- addAll_(array1, index, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0 and index != array 1 length
- */
- private static char[] addAll_(char[] array1, int index, char[] array2, int array1Length, int array2Length) {
- char[] result = new char[array1Length + array2Length];
- System.arraycopy(array1, 0, result, 0, index);
- System.arraycopy(array2, 0, result, index, array2Length);
- System.arraycopy(array1, index, result, index + array2Length, array1Length - index);
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * specified array 1 followed by the elements
- * in the specified array 2.
- *
- * Arrays.addAll(int[] array1, int[] array2)
- */
- public static int[] addAll(int[] array1, int... array2) {
- return addAll(array1, array2, array2.length);
- }
-
- /**
- * check array 2 length
- */
- private static int[] addAll(int[] array1, int[] array2, int array2Length) {
- return (array2Length == 0) ? array1 : addAll_(array1, array2, array2Length);
- }
-
- /**
- * assume array 2 length > 0
- */
- private static int[] addAll_(int[] array1, int[] array2, int array2Length) {
- return addAll(array1, array2, array1.length, array2Length);
- }
-
- /**
- * assume array 2 length > 0; check array 1 length
- */
- private static int[] addAll(int[] array1, int[] array2, int array1Length, int array2Length) {
- return (array1Length == 0) ? array2 : addAll_(array1, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0
- */
- private static int[] addAll_(int[] array1, int[] array2, int array1Length, int array2Length) {
- int[] result = new int[array1Length + array2Length];
- System.arraycopy(array1, 0, result, 0, array1Length);
- System.arraycopy(array2, 0, result, array1Length, array2Length);
- return result;
- }
-
- /**
- * Return an array containing the elements in the
- * first specified array with the objects in the second
- * specified array added at the specified index.
- *
- * Arrays.add(int[] array1, int index, int[] array2)
- */
- public static int[] addAll(int[] array1, int index, int... array2) {
- return addAll(array1, index, array2, array2.length);
- }
-
- /**
- * check array 2 length
- */
- private static int[] addAll(int[] array1, int index, int[] array2, int array2Length) {
- return (array2Length == 0) ? array1 : addAll_(array1, index, array2, array2Length);
- }
-
- /**
- * assume array 2 length > 0
- */
- private static int[] addAll_(int[] array1, int index, int[] array2, int array2Length) {
- return addAll(array1, index, array2, array1.length, array2Length);
- }
-
- /**
- * assume array 2 length > 0; check array 1 length
- */
- private static int[] addAll(int[] array1, int index, int[] array2, int array1Length, int array2Length) {
- return (array1Length == 0) ?
- array2 :
- (index == array1Length) ? // 'array2' added to end of 'array1'
- addAll_(array1, array2, array1Length, array2Length) :
- addAll_(array1, index, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0 and index != array 1 length
- */
- private static int[] addAll_(int[] array1, int index, int[] array2, int array1Length, int array2Length) {
- int[] result = new int[array1Length + array2Length];
- System.arraycopy(array1, 0, result, 0, index);
- System.arraycopy(array2, 0, result, index, array2Length);
- System.arraycopy(array1, index, result, index + array2Length, array1Length - index);
- return result;
- }
-
-
- // ********** clear **********
-
- /**
- * Return an empty array with the same component type as the specified array.
- *
- * Arrays.clear(Object[] array)
- */
- public static E[] clear(E[] array) {
- return (array.length == 0) ? array : newArray(array, 0);
- }
-
-
- // ********** concatenate **********
-
- /**
- * Return an array containing all the elements in all the
- * specified arrays, concatenated in the specified order.
- * This is useful for building constant arrays out of other constant arrays.
- *
- * Arrays.concatenate(Object[]... arrays)
- */
- public static E[] concatenate(E[]... arrays) {
- int len = 0;
- for (E[] array : arrays) {
- len += array.length;
- }
- E[] result = newArray(arrays[0], len);
- if (len == 0) {
- return result;
- }
- int current = 0;
- for (E[] array : arrays) {
- int arrayLength = array.length;
- if (arrayLength > 0) {
- System.arraycopy(array, 0, result, current, arrayLength);
- current += arrayLength;
- }
- }
- return result;
- }
-
- /**
- * Return an array containing all the elements in all the
- * specified arrays, concatenated in the specified order.
- * This is useful for building constant arrays out other constant arrays.
- *
- * Arrays.concatenate(char[]... arrays)
- */
- public static char[] concatenate(char[]... arrays) {
- int len = 0;
- for (char[] array : arrays) {
- len += array.length;
- }
- if (len == 0) {
- return EMPTY_CHAR_ARRAY;
- }
- char[] result = new char[len];
- int current = 0;
- for (char[] array : arrays) {
- int arrayLength = array.length;
- if (arrayLength != 0) {
- System.arraycopy(array, 0, result, current, arrayLength);
- current += arrayLength;
- }
- }
- return result;
- }
-
- /**
- * Return an array containing all the elements in all the
- * specified arrays, concatenated in the specified order.
- * This is useful for building constant arrays out other constant arrays.
- *
- * Arrays.concatenate(int[]... arrays)
- */
- public static int[] concatenate(int[]... arrays) {
- int len = 0;
- for (int[] array : arrays) {
- len += array.length;
- }
- if (len == 0) {
- return EMPTY_INT_ARRAY;
- }
- int[] result = new int[len];
- int current = 0;
- for (int[] array : arrays) {
- int arrayLength = array.length;
- if (arrayLength != 0) {
- System.arraycopy(array, 0, result, current, arrayLength);
- current += arrayLength;
- }
- }
- return result;
- }
-
-
- // ********** contains **********
-
- /**
- * Return whether the specified array contains the
- * specified element.
- *
- * Arrays.contains(Object[] array, Object o)
- */
- public static boolean contains(Object[] array, Object value) {
- return contains(array, value, array.length);
- }
-
- /**
- * check array length
- */
- private static boolean contains(Object[] array, Object value, int arrayLength) {
- return (arrayLength == 0) ? false : contains_(array, value, arrayLength);
- }
-
- /**
- * assume array length > 0
- */
- public static boolean contains_(Object[] array, Object value, int arrayLength) {
- if (value == null) {
- for (int i = arrayLength; i-- > 0; ) {
- if (array[i] == null) {
- return true;
- }
- }
- } else {
- for (int i = arrayLength; i-- > 0; ) {
- if (value.equals(array[i])) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Return whether the specified array contains the
- * specified element.
- *
- * Arrays.contains(char[] array, char value)
- */
- public static boolean contains(char[] array, char value) {
- return contains(array, value, array.length);
- }
-
- /**
- * check array length
- */
- private static boolean contains(char[] array, char value, int arrayLength) {
- return (arrayLength == 0) ? false : contains_(array, value, arrayLength);
- }
-
- /**
- * assume array length > 0
- */
- private static boolean contains_(char[] array, char value, int arrayLength) {
- for (int i = arrayLength; i-- > 0; ) {
- if (array[i] == value) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return whether the specified array contains the
- * specified element.
- *
- * Arrays.contains(int[] array, int value)
- */
- public static boolean contains(int[] array, int value) {
- return contains(array, value, array.length);
- }
-
- /**
- * check array length
- */
- private static boolean contains(int[] array, int value, int arrayLength) {
- return (arrayLength == 0) ? false : contains_(array, value, arrayLength);
- }
-
- /**
- * assume array length > 0
- */
- private static boolean contains_(int[] array, int value, int arrayLength) {
- for (int i = arrayLength; i-- > 0; ) {
- if (array[i] == value) {
- return true;
- }
- }
- return false;
- }
-
-
- // ********** contains all **********
-
- /**
- * Return whether the specified array contains all of the
- * elements in the specified collection.
- *
- * Arrays.containsAll(Object[] array, Collection collection)
- */
- public static boolean containsAll(Object[] array, Collection> collection) {
- return containsAll(array, collection.iterator());
- }
-
- /**
- * Return whether the specified array contains all of the
- * elements in the specified iterable.
- *
- * Arrays.containsAll(Object[] array, Iterable iterable)
- */
- public static boolean containsAll(Object[] array, Iterable> iterable) {
- return containsAll(array, iterable.iterator());
- }
-
- /**
- * Return whether the specified array contains all of the
- * elements in the specified iterator.
- *
- * Arrays.containsAll(Object[] array, Iterator iterator)
- */
- public static boolean containsAll(Object[] array, Iterator> iterator) {
- // use hashed lookup
- HashSet set = CollectionTools.set(array);
- while (iterator.hasNext()) {
- if ( ! set.contains(iterator.next())) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return whether the specified array 1 contains all of the
- * elements in the specified array 2.
- *
- * Arrays.containsAll(Object[] array1, Object[] array2)
- */
- public static boolean containsAll(Object[] array1, Object... array2) {
- // use hashed lookup
- HashSet set = CollectionTools.set(array1);
- for (int i = array2.length; i-- > 0; ) {
- if ( ! set.contains(array2[i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return whether the specified array 1 contains all of the
- * elements in the specified array 2.
- *
- * Arrays.containsAll(char[] array1, char[] array2)
- */
- public static boolean containsAll(char[] array1, char... array2) {
- for (int i = array2.length; i-- > 0; ) {
- if ( ! contains(array1, array2[i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return whether the specified array 1 contains all of the
- * elements in the specified array 2.
- *
- * Arrays.containsAll(int[] array1, int[] array2)
- */
- public static boolean containsAll(int[] array1, int... array2) {
- for (int i = array2.length; i-- > 0; ) {
- if ( ! contains(array1, array2[i])) {
- return false;
- }
- }
- return true;
- }
-
-
- // ********** diff **********
-
- /**
- * Return the index of the first elements in the specified
- * arrays that are different, beginning at the end.
- * If the arrays are identical, return -1.
- * If the arrays are different sizes, return the index of the
- * last element in the longer array.
- * Use the elements' {@link Object#equals(Object)} method to compare the
- * elements.
- */
- public static int diffEnd(Object[] array1, Object[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- if (len1 != len2) {
- return Math.max(len1, len2) - 1;
- }
- for (int i = len1 - 1; i > -1; i--) {
- Object o = array1[i];
- if (o == null) {
- if (array2[i] != null) {
- return i;
- }
- } else {
- if ( ! o.equals(array2[i])) {
- return i;
- }
- }
- }
- return -1;
- }
-
- /**
- * Return the range of elements in the specified
- * arrays that are different.
- * If the arrays are identical, return [size, -1].
- * Use the elements' {@link Object#equals(Object)} method to compare the
- * elements.
- * @see #diffStart(Object[], Object[])
- * @see #diffEnd(Object[], Object[])
- */
- public static Range diffRange(Object[] array1, Object[] array2) {
- int end = diffEnd(array1, array2);
- if (end == -1) {
- // the lists are identical, the start is the size of the two lists
- return new Range(array1.length, end);
- }
- // the lists are different, calculate the start of the range
- return new Range(diffStart(array1, array2), end);
- }
-
- /**
- * Return the index of the first elements in the specified
- * arrays that are different. If the arrays are identical, return
- * the size of the two arrays (i.e. one past the last index).
- * If the arrays are different sizes and all the elements in
- * the shorter array match their corresponding elements in
- * the longer array, return the size of the shorter array
- * (i.e. one past the last index of the shorter array).
- * Use the elements' {@link Object#equals(Object)} method to compare the
- * elements.
- */
- public static int diffStart(Object[] array1, Object[] array2) {
- int end = Math.min(array1.length, array2.length);
- for (int i = 0; i < end; i++) {
- Object o = array1[i];
- if (o == null) {
- if (array2[i] != null) {
- return i;
- }
- } else {
- if ( ! o.equals(array2[i])) {
- return i;
- }
- }
- }
- return end;
- }
-
-
- // ********** identity diff **********
-
- /**
- * Return the index of the first elements in the specified
- * arrays that are different, beginning at the end.
- * If the arrays are identical, return -1.
- * If the arrays are different sizes, return the index of the
- * last element in the longer array.
- * Use object identity to compare the elements.
- */
- public static int identityDiffEnd(Object[] array1, Object[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- if (len1 != len2) {
- return Math.max(len1, len2) - 1;
- }
- for (int i = len1 - 1; i > -1; i--) {
- if (array1[i] != array2[i]) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Return the range of elements in the specified
- * arrays that are different.
- * If the arrays are identical, return [size, -1].
- * Use object identity to compare the elements.
- * @see #identityDiffStart(Object[], Object[])
- * @see #identityDiffEnd(Object[], Object[])
- */
- public static Range identityDiffRange(Object[] array1, Object[] array2) {
- int end = identityDiffEnd(array1, array2);
- if (end == -1) {
- // the lists are identical, the start is the size of the two lists
- return new Range(array1.length, end);
- }
- // the lists are different, calculate the start of the range
- return new Range(identityDiffStart(array1, array2), end);
- }
-
- /**
- * Return the index of the first elements in the specified
- * arrays that are different. If the arrays are identical, return
- * the size of the two arrays (i.e. one past the last index).
- * If the arrays are different sizes and all the elements in
- * the shorter array match their corresponding elements in
- * the longer array, return the size of the shorter array
- * (i.e. one past the last index of the shorter array).
- * Use object identity to compare the elements.
- */
- public static int identityDiffStart(Object[] array1, Object[] array2) {
- int end = Math.min(array1.length, array2.length);
- for (int i = 0; i < end; i++) {
- if (array1[i] != array2[i]) {
- return i;
- }
- }
- return end;
- }
-
-
- // ********** elements are identical **********
-
- /**
- * Return whether the specified arrays contain the same elements.
- *
- * Arrays.identical(Object[] array1, Object[] array2)
- */
- public static boolean elementsAreIdentical(Object[] array1, Object[] array2) {
- if (array1 == array2) {
- return true;
- }
- if (array1 == null || array2 == null) {
- return false;
- }
- int length = array1.length;
- if (array2.length != length) {
- return false;
- }
- for (int i = length; i-- > 0; ) {
- if (array1[i] != array2[i]) {
- return false;
- }
- }
- return true;
- }
-
-
- // ********** index of **********
-
- /**
- * Return the index of the first occurrence of the
- * specified element in the specified array,
- * or return -1 if there is no such index.
- *
- * Arrays.indexOf(Object[] array, Object o)
- */
- public static int indexOf(Object[] array, Object value) {
- int len = array.length;
- if (value == null) {
- for (int i = 0; i < len; i++) {
- if (array[i] == null) {
- return i;
- }
- }
- } else {
- for (int i = 0; i < len; i++) {
- if (value.equals(array[i])) {
- return i;
- }
- }
- }
- return -1;
- }
-
- /**
- * Return the index of the first occurrence of the
- * specified element in the specified array,
- * or return -1 if there is no such index.
- *
- * Arrays.identityIndexOf(Object[] array, Object o)
- */
- public static int identityIndexOf(Object[] array, Object value) {
- int len = array.length;
- for (int i = 0; i < len; i++) {
- if (array[i] == value) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Return the index of the first occurrence of the
- * specified element in the specified array,
- * or return -1 if there is no such index.
- *
- * Arrays.indexOf(char[] array, char value)
- */
- public static int indexOf(char[] array, char value) {
- int len = array.length;
- for (int i = 0; i < len; i++) {
- if (array[i] == value) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Return the index of the first occurrence of the
- * specified element in the specified array,
- * or return -1 if there is no such index.
- *
- * Arrays.indexOf(int[] array, int value)
- */
- public static int indexOf(int[] array, int value) {
- int len = array.length;
- for (int i = 0; i < len; i++) {
- if (array[i] == value) {
- return i;
- }
- }
- return -1;
- }
-
-
- // ********** insertion index of **********
-
- /**
- * Return the maximum index of where the specified comparable object
- * should be inserted into the specified sorted array and still keep
- * the array sorted.
- */
- public static > int insertionIndexOf(E[] sortedArray, Comparable value) {
- int len = sortedArray.length;
- for (int i = 0; i < len; i++) {
- if (value.compareTo(sortedArray[i]) < 0) {
- return i;
- }
- }
- return len;
- }
-
- /**
- * Return the maximum index of where the specified comparable object
- * should be inserted into the specified sorted array and still keep
- * the array sorted.
- */
- public static int insertionIndexOf(E[] sortedArray, E value, Comparator super E> comparator) {
- int len = sortedArray.length;
- for (int i = 0; i < len; i++) {
- if (comparator.compare(value, sortedArray[i]) < 0) {
- return i;
- }
- }
- return len;
- }
-
-
- // ********** last index of **********
-
- /**
- * Return the index of the last occurrence of the
- * specified element in the specified array;
- * return -1 if there is no such index.
- *
- * Arrays.lastIndexOf(Object[] array, Object o)
- */
- public static int lastIndexOf(Object[] array, Object value) {
- int len = array.length;
- if (value == null) {
- for (int i = len; i-- > 0; ) {
- if (array[i] == null) {
- return i;
- }
- }
- } else {
- for (int i = len; i-- > 0; ) {
- if (value.equals(array[i])) {
- return i;
- }
- }
- }
- return -1;
- }
-
- /**
- * Return the index of the last occurrence of the
- * specified element in the specified array,
- * or return -1 if there is no such index.
- *
- * Arrays.lastIndexOf(char[] array, char value)
- */
- public static int lastIndexOf(char[] array, char value) {
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == value) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Return the index of the last occurrence of the
- * specified element in the specified array,
- * or return -1 if there is no such index.
- *
- * Arrays.lastIndexOf(int[] array, int value)
- */
- public static int lastIndexOf(int[] array, int value) {
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == value) {
- return i;
- }
- }
- return -1;
- }
-
-
- // ********** min/max **********
-
- /**
- * Return the character from the specified array with the minimum value.
- *
- * Arrays.min(char[] array)
- */
- public static char min(char... array) {
- int len = array.length;
- if (len == 0) {
- throw new IndexOutOfBoundsException();
- }
- int last = len - 1;
- char min = array[last];
- for (int i = last; i-- > 0; ) {
- char c = array[i];
- if (c < min) {
- min = c;
- }
- }
- return min;
- }
-
- /**
- * Return the integer from the specified array with the minimum value.
- *
- * Arrays.min(int[] array)
- */
- public static int min(int... array) {
- int len = array.length;
- if (len == 0) {
- throw new IndexOutOfBoundsException();
- }
- int last = len - 1;
- int min = array[last];
- for (int i = last; i-- > 0; ) {
- int x = array[i];
- if (x < min) {
- min = x;
- }
- }
- return min;
- }
-
- /**
- * Return the character from the specified array with the maximum value.
- *
- * Arrays.max(char[] array)
- */
- public static char max(char... array) {
- int len = array.length;
- if (len == 0) {
- throw new IndexOutOfBoundsException();
- }
- int last = len - 1;
- char max = array[last];
- for (int i = last; i-- > 0; ) {
- char c = array[i];
- if (c > max) {
- max = c;
- }
- }
- return max;
- }
-
- /**
- * Return the integer from the specified array with the maximum value.
- *
- * Arrays.max(int[] array)
- */
- public static int max(int... array) {
- int len = array.length;
- if (len == 0) {
- throw new IndexOutOfBoundsException();
- }
- int last = len - 1;
- int max = array[last];
- for (int i = last; i-- > 0; ) {
- int x = array[i];
- if (x > max) {
- max = x;
- }
- }
- return max;
- }
-
-
- // ********** move **********
-
- /**
- * Move an element from the specified source index to the specified target
- * index. Return the altered array.
- *
- * Arrays.move(Object[] array, int targetIndex, int sourceIndex)
- */
- public static E[] move(E[] array, int targetIndex, int sourceIndex) {
- return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex);
- }
-
- /**
- * assume target index != source index
- */
- private static E[] move_(E[] array, int targetIndex, int sourceIndex) {
- E temp = array[sourceIndex];
- if (targetIndex < sourceIndex) {
- System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex);
- } else {
- System.arraycopy(array, sourceIndex + 1, array, sourceIndex, targetIndex - sourceIndex);
- }
- array[targetIndex] = temp;
- return array;
- }
-
- /**
- * Move elements from the specified source index to the specified target
- * index. Return the altered array.
- *
- * Arrays.move(Object[] array, int targetIndex, int sourceIndex, int length)
- */
- public static E[] move(E[] array, int targetIndex, int sourceIndex, int length) {
- if ((targetIndex == sourceIndex) || (length == 0)) {
- return array;
- }
- if (length == 1) {
- return move_(array, targetIndex, sourceIndex);
- }
- E[] temp = newArray(array, length);
- System.arraycopy(array, sourceIndex, temp, 0, length);
- if (targetIndex < sourceIndex) {
- System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex);
- } else {
- System.arraycopy(array, sourceIndex + length, array, sourceIndex, targetIndex - sourceIndex);
- }
- System.arraycopy(temp, 0, array, targetIndex, length);
- return array;
- }
-
- /**
- * Move an element from the specified source index to the specified target
- * index. Return the altered array.
- *
- * Arrays.move(int[] array, int targetIndex, int sourceIndex)
- */
- public static int[] move(int[] array, int targetIndex, int sourceIndex) {
- return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex);
- }
-
- /**
- * assume targetIndex != sourceIndex
- */
- private static int[] move_(int[] array, int targetIndex, int sourceIndex) {
- int temp = array[sourceIndex];
- if (targetIndex < sourceIndex) {
- System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex);
- } else {
- System.arraycopy(array, sourceIndex + 1, array, sourceIndex, targetIndex - sourceIndex);
- }
- array[targetIndex] = temp;
- return array;
- }
-
- /**
- * Move elements from the specified source index to the specified target
- * index. Return the altered array.
- *
- * Arrays.move(int[] array, int targetIndex, int sourceIndex, int length)
- */
- public static int[] move(int[] array, int targetIndex, int sourceIndex, int length) {
- if ((targetIndex == sourceIndex) || (length == 0)) {
- return array;
- }
- if (length == 1) {
- return move_(array, targetIndex, sourceIndex);
- }
- int[] temp = new int[length];
- System.arraycopy(array, sourceIndex, temp, 0, length);
- if (targetIndex < sourceIndex) {
- System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex);
- } else {
- System.arraycopy(array, sourceIndex + length, array, sourceIndex, targetIndex - sourceIndex);
- }
- System.arraycopy(temp, 0, array, targetIndex, length);
- return array;
- }
-
- /**
- * Move an element from the specified source index to the specified target
- * index. Return the altered array.
- *
- * Arrays.move(char[] array, int targetIndex, int sourceIndex)
- */
- public static char[] move(char[] array, int targetIndex, int sourceIndex) {
- return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex);
- }
-
- /**
- * assume targetIndex != sourceIndex
- */
- private static char[] move_(char[] array, int targetIndex, int sourceIndex) {
- char temp = array[sourceIndex];
- if (targetIndex < sourceIndex) {
- System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex);
- } else {
- System.arraycopy(array, sourceIndex + 1, array, sourceIndex, targetIndex - sourceIndex);
- }
- array[targetIndex] = temp;
- return array;
- }
-
- /**
- * Move elements from the specified source index to the specified target
- * index. Return the altered array.
- *
- * Arrays.move(char[] array, int targetIndex, int sourceIndex, int length)
- */
- public static char[] move(char[] array, int targetIndex, int sourceIndex, int length) {
- if ((targetIndex == sourceIndex) || (length == 0)) {
- return array;
- }
- if (length == 1) {
- return move_(array, targetIndex, sourceIndex);
- }
- char[] temp = new char[length];
- System.arraycopy(array, sourceIndex, temp, 0, length);
- if (targetIndex < sourceIndex) {
- System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex);
- } else {
- System.arraycopy(array, sourceIndex + length, array, sourceIndex, targetIndex - sourceIndex);
- }
- System.arraycopy(temp, 0, array, targetIndex, length);
- return array;
- }
-
-
- // ********** remove **********
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified element removed.
- *
- * Arrays.remove(Object[] array, Object value)
- */
- public static E[] remove(E[] array, Object value) {
- return removeElementAtIndex(array, indexOf(array, value));
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified element removed.
- *
- * Arrays.remove(char[] array, char value)
- */
- public static char[] remove(char[] array, char value) {
- return removeElementAtIndex(array, indexOf(array, value));
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified element removed.
- *
- * Arrays.remove(int[] array, int value)
- */
- public static int[] remove(int[] array, int value) {
- return removeElementAtIndex(array, indexOf(array, value));
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the first element removed.
- *
- * Arrays.removeFirst(Object[] array)
- */
- public static E[] removeFirst(E[] array) {
- return removeElementAtIndex(array, 0);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the first element removed.
- *
- * Arrays.removeFirst(char[] array)
- */
- public static char[] removeFirst(char[] array) {
- return removeElementAtIndex(array, 0);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the first element removed.
- *
- * Arrays.removeFirst(int[] array)
- */
- public static int[] removeFirst(int[] array) {
- return removeElementAtIndex(array, 0);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the last element removed.
- *
- * Arrays.removeLast(Object[] array)
- */
- public static E[] removeLast(E[] array) {
- return removeElementAtIndex(array, array.length - 1);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the last element removed.
- *
- * Arrays.removeLast(char[] array)
- */
- public static char[] removeLast(char[] array) {
- return removeElementAtIndex(array, array.length - 1);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the last element removed.
- *
- * Arrays.removeLast(int[] array)
- */
- public static int[] removeLast(int[] array) {
- return removeElementAtIndex(array, array.length - 1);
- }
-
-
- // ********** remove all **********
-
- /**
- * Remove from the specified array all the elements in
- * the specified iterable and return the result.
- *
- * Arrays.removeAll(Object[] array, Iterable iterable)
- */
- public static E[] removeAll(E[] array, Iterable> iterable) {
- return removeAll(array, iterable.iterator());
- }
-
- /**
- * Remove from the specified array all the elements in
- * the specified iterable and return the result.
- * The specified iterable size is a performance hint.
- *
- * Arrays.removeAll(Object[] array, Iterable iterable)
- */
- public static E[] removeAll(E[] array, Iterable> iterable, int iterableSize) {
- return removeAll(array, iterable.iterator(), iterableSize);
- }
-
- /**
- * Remove from the specified array all the elements in
- * the specified iterator and return the result.
- *
- * Arrays.removeAll(Object[] array, Iterator iterator)
- */
- public static E[] removeAll(E[] array, Iterator> iterator) {
- // convert to a set to take advantage of hashed look-up
- return iterator.hasNext() ? removeAll_(array, CollectionTools.set(iterator)) : array;
- }
-
- /**
- * Remove from the specified array all the elements in
- * the specified iterator and return the result.
- * The specified iterator size is a performance hint.
- *
- * Arrays.removeAll(Object[] array, Iterator iterator)
- */
- public static E[] removeAll(E[] array, Iterator> iterator, int iteratorSize) {
- // convert to a set to take advantage of hashed look-up
- return iterator.hasNext() ? removeAll_(array, CollectionTools.set(iterator, iteratorSize)) : array;
- }
-
- /**
- * Remove from the specified array all the elements in
- * the specified collection and return the result.
- *
- * Arrays.removeAll(Object[] array, Collection collection)
- */
- public static E[] removeAll(E[] array, Collection> collection) {
- return collection.isEmpty() ? array : removeAll_(array, collection);
- }
-
- /**
- * assume collection is non-empty
- */
- private static E[] removeAll_(E[] array, Collection> collection) {
- return removeAll(array, collection, array.length);
- }
-
- /**
- * assume collection is non-empty; check array length
- */
- private static E[] removeAll(E[] array, Collection> collection, int arrayLength) {
- return (arrayLength == 0) ? array : removeAll_(array, collection, arrayLength);
- }
-
- /**
- * assume collection is non-empty and array length > 0
- */
- private static E[] removeAll_(E[] array, Collection> collection, int arrayLength) {
- // build the indices of the elements that are to remain
- int[] indices = new int[arrayLength];
- int j = 0;
- for (int i = 0; i < arrayLength; i++) {
- if ( ! collection.contains(array[i])) {
- indices[j++] = i;
- }
- }
- if (j == arrayLength) {
- return array; // nothing was removed
- }
- E[] result = newArray(array, j);
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array[indices[i]];
- }
- return result;
- }
-
- /**
- * Remove from the first specified array all the elements in
- * the second specified array and return the result.
- *
- * Arrays.removeAll(Object[] array1, Object[] array2)
- */
- public static E[] removeAll(E[] array1, Object... array2) {
- // convert to a set to take advantage of hashed look-up
- return (array2.length == 0) ? array1 : removeAll_(array1, CollectionTools.set(array2));
- }
-
- /**
- * Remove from the first specified array all the elements in
- * the second specified array and return the result.
- *
- * Arrays#removeAll(char[] array1, char[] array2)
- */
- public static char[] removeAll(char[] array1, char... array2) {
- if (array2.length == 0) {
- return array1;
- }
- int array1Length = array1.length;
- if (array1Length == 0) {
- return array1;
- }
- int[] indices = new int[array1Length];
- int j = 0;
- for (int i = 0; i < array1Length; i++) {
- if ( ! contains(array2, array1[i])) {
- indices[j++] = i;
- }
- }
- if (j == array1Length) {
- return array1; // nothing was removed
- }
- char[] result = new char[j];
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array1[indices[i]];
- }
- return result;
- }
-
- /**
- * Remove from the first specified array all the elements in
- * the second specified array and return the result.
- *
- * Arrays#removeAll(int[] array1, int[] array2)
- */
- public static int[] removeAll(int[] array1, int... array2) {
- if (array2.length == 0) {
- return array1;
- }
- int array1Length = array1.length;
- if (array1Length == 0) {
- return array1;
- }
- int[] indices = new int[array1Length];
- int j = 0;
- for (int i = 0; i < array1Length; i++) {
- if ( ! contains(array2, array1[i])) {
- indices[j++] = i;
- }
- }
- if (j == array1Length) {
- return array1; // nothing was removed
- }
- int[] result = new int[j];
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array1[indices[i]];
- }
- return result;
- }
-
-
- // ********** remove all occurrences **********
-
- /**
- * Remove from the specified array all occurrences of
- * the specified element and return the result.
- *
- * Arrays.removeAllOccurrences(Object[] array, Object value)
- */
- public static E[] removeAllOccurrences(E[] array, Object value) {
- int arrayLength = array.length;
- if (arrayLength == 0) {
- return array;
- }
- int[] indices = new int[arrayLength];
- int j = 0;
- if (value == null) {
- for (int i = arrayLength; i-- > 0; ) {
- if (array[i] != null) {
- indices[j++] = i;
- }
- }
- } else {
- for (int i = array.length; i-- > 0; ) {
- if ( ! value.equals(array[i])) {
- indices[j++] = i;
- }
- }
- }
- if (j == arrayLength) {
- return array; // nothing was removed
- }
- E[] result = newArray(array, j);
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array[indices[i]];
- }
- return result;
- }
-
- /**
- * Remove from the specified array all occurrences of
- * the specified element and return the result.
- *
- * Arrays.removeAllOccurrences(char[] array, char value)
- */
- public static char[] removeAllOccurrences(char[] array, char value) {
- int arrayLength = array.length;
- if (arrayLength == 0) {
- return array;
- }
- int[] indices = new int[arrayLength];
- int j = 0;
- for (int i = arrayLength; i-- > 0; ) {
- if (array[i] != value) {
- indices[j++] = i;
- }
- }
- if (j == arrayLength) {
- return array; // nothing was removed
- }
- char[] result = new char[j];
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array[indices[i]];
- }
- return result;
- }
-
- /**
- * Remove from the specified array all occurrences of
- * the specified element and return the result.
- *
- * Arrays.removeAllOccurrences(int[] array, int value)
- */
- public static int[] removeAllOccurrences(int[] array, int value) {
- int arrayLength = array.length;
- if (arrayLength == 0) {
- return array;
- }
- int[] indices = new int[arrayLength];
- int j = 0;
- for (int i = arrayLength; i-- > 0; ) {
- if (array[i] != value) {
- indices[j++] = i;
- }
- }
- if (j == arrayLength) {
- return array; // nothing was removed
- }
- int[] result = new int[j];
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array[indices[i]];
- }
- return result;
- }
-
-
- // ********** remove duplicate elements **********
-
- /**
- * Remove any duplicate elements from the specified array,
- * while maintaining the order.
- */
- public static E[] removeDuplicateElements(E... array) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- ArrayList temp = CollectionTools.list(array);
- return CollectionTools.removeDuplicateElements(temp, len) ?
- temp.toArray(newArray(array, temp.size())) :
- array;
- }
-
-
- // ********** remove element at index **********
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified element removed.
- *
- * Arrays.removeElementAtIndex(Object[] array, int index)
- */
- public static E[] removeElementAtIndex(E[] array, int index) {
- return removeElementsAtIndex(array, index, 1);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified element removed.
- *
- * Arrays.removeElementAtIndex(char[] array, int index)
- */
- public static char[] removeElementAtIndex(char[] array, int index) {
- return removeElementsAtIndex(array, index, 1);
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified element removed.
- *
- * Arrays.removeElementAtIndex(int[] array, int index)
- */
- public static int[] removeElementAtIndex(int[] array, int index) {
- return removeElementsAtIndex(array, index, 1);
- }
-
-
- // ********** remove elements at index **********
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified elements removed.
- *
- * Arrays.removeElementsAtIndex(Object[] array, int index, int length)
- */
- public static E[] removeElementsAtIndex(E[] array, int index, int length) {
- if (length == 0) {
- return array;
- }
- int arrayLength = array.length;
- int newLength = arrayLength - length;
- E[] result = newArray(array, newLength);
- if ((newLength == 0) && (index == 0)) {
- return result; // performance tweak
- }
- if (index != 0) {
- System.arraycopy(array, 0, result, 0, index);
- }
- int length2 = newLength - index;
- if (length2 != 0) {
- System.arraycopy(array, index + length, result, index, length2);
- }
- return result;
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified elements removed.
- *
- * Arrays.removeElementsAtIndex(char[] array, int index, int length)
- */
- public static char[] removeElementsAtIndex(char[] array, int index, int length) {
- if (length == 0) {
- return array;
- }
- int arrayLength = array.length;
- int newLength = arrayLength - length;
- if ((newLength == 0) && (index == 0)) {
- return EMPTY_CHAR_ARRAY; // performance tweak
- }
- char[] result = new char[newLength];
- if (index != 0) {
- System.arraycopy(array, 0, result, 0, index);
- }
- int length2 = newLength - index;
- if (length2 != 0) {
- System.arraycopy(array, index + length, result, index, length2);
- }
- return result;
- }
-
- /**
- * Return a new array that contains the elements in the
- * specified array with the specified elements removed.
- *
- * Arrays.removeElementsAtIndex(int[] array, int index, int length)
- */
- public static int[] removeElementsAtIndex(int[] array, int index, int length) {
- if (length == 0) {
- return array;
- }
- int arrayLength = array.length;
- int newLength = arrayLength - length;
- if ((newLength == 0) && (index == 0)) {
- return EMPTY_INT_ARRAY; // performance tweak
- }
- int[] result = new int[newLength];
- if (index != 0) {
- System.arraycopy(array, 0, result, 0, index);
- }
- int length2 = newLength - index;
- if (length2 != 0) {
- System.arraycopy(array, index + length, result, index, length2);
- }
- return result;
- }
-
-
- // ********** replace all **********
-
- /**
- * Replace all occurrences of the specified old value with
- * the specified new value. Return the altered array.
- *
- * Arrays.replaceAll(Object[] array, Object oldValue, Object newValue)
- */
- public static E[] replaceAll(E[] array, Object oldValue, E newValue) {
- if (oldValue == null) {
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == null) {
- array[i] = newValue;
- }
- }
- } else {
- for (int i = array.length; i-- > 0; ) {
- if (oldValue.equals(array[i])) {
- array[i] = newValue;
- }
- }
- }
- return array;
- }
-
- /**
- * Replace all occurrences of the specified old value with
- * the specified new value. Return the altered array.
- *
- * Arrays.replaceAll(int[] array, int oldValue, int newValue)
- */
- public static int[] replaceAll(int[] array, int oldValue, int newValue) {
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == oldValue) {
- array[i] = newValue;
- }
- }
- return array;
- }
-
- /**
- * Replace all occurrences of the specified old value with
- * the specified new value. Return the altered array.
- *
- * Arrays.replaceAll(char[] array, char oldValue, char newValue)
- */
- public static char[] replaceAll(char[] array, char oldValue, char newValue) {
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == oldValue) {
- array[i] = newValue;
- }
- }
- return array;
- }
-
-
- // ********** retain all **********
-
- /**
- * Retain in the specified array all the elements in
- * the specified iterable and return the result.
- *
- * Arrays.retainAll(Object[] array, Iterable iterable)
- */
- public static E[] retainAll(E[] array, Iterable> iterable) {
- int arrayLength = array.length;
- return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterable.iterator());
- }
-
- /**
- * Retain in the specified array all the elements in
- * the specified iterable and return the result.
- * The specified iterable size is a performance hint.
- *
- * Arrays.retainAll(Object[] array, Iterable iterable)
- */
- public static E[] retainAll(E[] array, Iterable> iterable, int iterableSize) {
- int arrayLength = array.length;
- return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterable.iterator(), iterableSize);
- }
-
- /**
- * Retain in the specified array all the elements in
- * the specified iterator and return the result.
- *
- * Arrays.retainAll(Object[] array, Iterator iterator)
- */
- public static E[] retainAll(E[] array, Iterator> iterator) {
- int arrayLength = array.length;
- return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterator);
- }
-
- /**
- * Retain in the specified array all the elements in
- * the specified iterator and return the result.
- * The specified iterator size is a performance hint.
- *
- * Arrays.retainAll(Object[] array, Iterator iterator)
- */
- public static E[] retainAll(E[] array, Iterator> iterator, int iteratorSize) {
- int arrayLength = array.length;
- return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterator, iteratorSize);
- }
-
- /**
- * assume array length > 0
- */
- private static E[] retainAll(E[] array, int arrayLength, Iterator> iterator) {
- return iterator.hasNext() ?
- retainAll_(array, CollectionTools.set(iterator), arrayLength) :
- newArray(array, 0);
- }
-
- /**
- * assume array length > 0
- */
- private static E[] retainAll(E[] array, int arrayLength, Iterator> iterator, int iteratorSize) {
- return iterator.hasNext() ?
- retainAll_(array, CollectionTools.set(iterator, iteratorSize), arrayLength) :
- newArray(array, 0);
- }
-
- /**
- * Retain in the specified array all the elements in
- * the specified collection and return the result.
- *
- * Arrays.retainAll(Object[] array, Collection collection)
- */
- public static E[] retainAll(E[] array, Collection> collection) {
- int arrayLength = array.length;
- return (arrayLength == 0) ? array : retainAll(array, collection, arrayLength);
- }
-
- /**
- * assume array length > 0
- */
- private static E[] retainAll(E[] array, Collection> collection, int arrayLength) {
- return collection.isEmpty() ?
- newArray(array, 0) :
- retainAll_(array, collection, arrayLength);
- }
-
- /**
- * assume collection is non-empty and array length > 0
- */
- private static E[] retainAll_(E[] array, Collection> collection, int arrayLength) {
- int[] indices = new int[arrayLength];
- int j = 0;
- for (int i = 0; i < arrayLength; i++) {
- if (collection.contains(array[i])) {
- indices[j++] = i;
- }
- }
- if (j == arrayLength) {
- return array; // everything was retained
- }
- E[] result = newArray(array, j);
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array[indices[i]];
- }
- return result;
- }
-
- /**
- * Remove from the first specified array all the elements in
- * the second specified array and return the result.
- *
- * Arrays.retainAll(Object[] array1, Object[] array2)
- */
- public static E[] retainAll(E[] array1, Object[] array2) {
- int array1Length = array1.length;
- return (array1Length == 0) ?
- array1 :
- (array2.length == 0) ?
- newArray(array1, 0) :
- retainAll(array1, CollectionTools.set(array2), array1Length);
- }
-
- /**
- * Remove from the first specified array all the elements in
- * the second specified array and return the result.
- *
- * Arrays.retainAll(char[] array1, char[] array2)
- */
- public static char[] retainAll(char[] array1, char... array2) {
- int array1Length = array1.length;
- return (array1Length == 0) ? array1 : retainAll(array1, array2, array1Length);
- }
-
- /**
- * assume array 1 length > 0
- */
- private static char[] retainAll(char[] array1, char[] array2, int array1Length) {
- int array2Length = array2.length;
- return (array2Length == 0) ? EMPTY_CHAR_ARRAY : retainAll(array1, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0
- */
- private static char[] retainAll(char[] array1, char[] array2, int array1Length, int array2Length) {
- int[] indices = new int[array1Length];
- int j = 0;
- for (int i = 0; i < array1Length; i++) {
- if (contains_(array2, array1[i], array2Length)) {
- indices[j++] = i;
- }
- }
- if (j == array1Length) {
- return array1; // everything was retained
- }
- char[] result = new char[j];
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array1[indices[i]];
- }
- return result;
- }
-
- /**
- * Remove from the first specified array all the elements in
- * the second specified array and return the result.
- *
- * Arrays.retainAll(int[] array1, int[] array2)
- */
- public static int[] retainAll(int[] array1, int... array2) {
- int array1Length = array1.length;
- return (array1Length == 0) ? array1 : retainAll(array1, array2, array1Length);
- }
-
- /**
- * assume array 1 length > 0
- */
- private static int[] retainAll(int[] array1, int[] array2, int array1Length) {
- int array2Length = array2.length;
- return (array2Length == 0) ? EMPTY_INT_ARRAY : retainAll(array1, array2, array1Length, array2Length);
- }
-
- /**
- * assume both array lengths > 0
- */
- private static int[] retainAll(int[] array1, int[] array2, int array1Length, int array2Length) {
- int[] indices = new int[array1Length];
- int j = 0;
- for (int i = 0; i < array1Length; i++) {
- if (contains_(array2, array1[i], array2Length)) {
- indices[j++] = i;
- }
- }
- if (j == array1Length) {
- return array1; // everything was retained
- }
- int[] result = new int[j];
- int resultLength = result.length;
- for (int i = 0; i < resultLength; i++) {
- result[i] = array1[indices[i]];
- }
- return result;
- }
-
-
- // ********** reverse **********
-
- /**
- * Return the array, reversed.
- *
- * Arrays.reverse(Object... array)
- */
- public static E[] reverse(E... array) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- for (int i = 0, mid = len >> 1, j = len - 1; i < mid; i++, j--) {
- swap(array, i, j);
- }
- return array;
- }
-
- /**
- * Return the array, reversed.
- *
- * Arrays.reverse(char... array)
- */
- public static char[] reverse(char... array) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- for (int i = 0, mid = len >> 1, j = len - 1; i < mid; i++, j--) {
- swap(array, i, j);
- }
- return array;
- }
-
- /**
- * Return the array, reversed.
- *
- * Arrays.reverse(int... array)
- */
- public static int[] reverse(int... array) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- for (int i = 0, mid = len >> 1, j = len - 1; i < mid; i++, j--) {
- swap(array, i, j);
- }
- return array;
- }
-
-
- // ********** rotate **********
-
- /**
- * Return the rotated array after rotating it one position.
- *
- * Arrays.rotate(Object[] array)
- */
- public static E[] rotate(E... array) {
- return rotate(array, 1);
- }
-
- /**
- * Return the rotated array after rotating it the specified distance.
- *
- * Arrays.rotate(Object[] array, int distance)
- */
- public static E[] rotate(E[] array, int distance) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- distance = distance % len;
- if (distance < 0) {
- distance += len;
- }
- if (distance == 0) {
- return array;
- }
- for (int cycleStart = 0, nMoved = 0; nMoved != len; cycleStart++) {
- E displaced = array[cycleStart];
- int i = cycleStart;
- do {
- i += distance;
- if (i >= len) {
- i -= len;
- }
- E temp = array[i];
- array[i] = displaced;
- displaced = temp;
- nMoved ++;
- } while (i != cycleStart);
- }
- return array;
- }
-
- /**
- * Return the rotated array after rotating it one position.
- *
- * Arrays.rotate(char[] array)
- */
- public static char[] rotate(char... array) {
- return rotate(array, 1);
- }
-
- /**
- * Return the rotated array after rotating it the specified distance.
- *
- * Arrays.rotate(char[] array, int distance)
- */
- public static char[] rotate(char[] array, int distance) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- distance = distance % len;
- if (distance < 0) {
- distance += len;
- }
- if (distance == 0) {
- return array;
- }
- for (int cycleStart = 0, nMoved = 0; nMoved != len; cycleStart++) {
- char displaced = array[cycleStart];
- int i = cycleStart;
- do {
- i += distance;
- if (i >= len) {
- i -= len;
- }
- char temp = array[i];
- array[i] = displaced;
- displaced = temp;
- nMoved ++;
- } while (i != cycleStart);
- }
- return array;
- }
-
- /**
- * Return the rotated array after rotating it one position.
- *
- * Arrays.rotate(int[] array)
- */
- public static int[] rotate(int... array) {
- return rotate(array, 1);
- }
-
- /**
- * Return the rotated array after rotating it the specified distance.
- *
- * Arrays.rotate(int[] array, int distance)
- */
- public static int[] rotate(int[] array, int distance) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- distance = distance % len;
- if (distance < 0) {
- distance += len;
- }
- if (distance == 0) {
- return array;
- }
- for (int cycleStart = 0, nMoved = 0; nMoved != len; cycleStart++) {
- int displaced = array[cycleStart];
- int i = cycleStart;
- do {
- i += distance;
- if (i >= len) {
- i -= len;
- }
- int temp = array[i];
- array[i] = displaced;
- displaced = temp;
- nMoved ++;
- } while (i != cycleStart);
- }
- return array;
- }
-
-
- // ********** shuffle **********
-
- private static final Random RANDOM = new Random();
-
- /**
- * Return the array after "shuffling" it.
- *
- * Arrays.shuffle(Object... array)
- */
- public static E[] shuffle(E... array) {
- return shuffle(array, RANDOM);
- }
-
- /**
- * Return the array after "shuffling" it.
- *
- * Arrays.shuffle(Object[] array, Random r)
- */
- public static E[] shuffle(E[] array, Random random) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- for (int i = len; i-- > 0; ) {
- swap(array, i, random.nextInt(len));
- }
- return array;
- }
-
- /**
- * Return the array after "shuffling" it.
- *
- * Arrays.shuffle(char... array)
- */
- public static char[] shuffle(char... array) {
- return shuffle(array, RANDOM);
- }
-
- /**
- * Return the array after "shuffling" it.
- *
- * Arrays.shuffle(char[] array, Random r)
- */
- public static char[] shuffle(char[] array, Random random) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- for (int i = len; i-- > 0; ) {
- swap(array, i, random.nextInt(len));
- }
- return array;
- }
-
- /**
- * Return the array after "shuffling" it.
- *
- * Arrays.shuffle(int... array)
- */
- public static int[] shuffle(int... array) {
- return shuffle(array, RANDOM);
- }
-
- /**
- * Return the array after "shuffling" it.
- *
- * Arrays.shuffle(int[] array, Random r)
- */
- public static int[] shuffle(int[] array, Random random) {
- int len = array.length;
- if ((len == 0) || (len == 1)) {
- return array;
- }
- for (int i = len; i-- > 0; ) {
- swap(array, i, random.nextInt(len));
- }
- return array;
- }
-
-
- // ********** sub-array **********
-
- /**
- * Return a sub-array of the specified array with elements copied from
- * the specified range. The "from" index is inclusive; the "to" index is exclusive.
- *
- * Arrays.subArray(E[] array, int fromIndex, int toIndex)
- */
- public static E[] subArray(E[] array, int fromIndex, int toIndex) {
- int len = toIndex - fromIndex;
- E[] result = newArray(array, len);
- if (len > 0) {
- System.arraycopy(array, fromIndex, result, 0, len);
- }
- return result;
- }
-
- /**
- * Return a sub-array of the specified array with elements copied from
- * the specified range. The "from" index is inclusive; the "to" index is exclusive.
- *
- * Arrays.subArray(int[] array, int fromIndex, int toIndex)
- */
- public static int[] subArray(int[] array, int fromIndex, int toIndex) {
- int len = toIndex - fromIndex;
- if (len == 0) {
- return EMPTY_INT_ARRAY;
- }
- int[] result = new int[len];
- System.arraycopy(array, fromIndex, result, 0, len);
- return result;
- }
-
- /**
- * Return a sub-array of the specified array with elements copied from
- * the specified range. The "from" index is inclusive; the "to" index is exclusive.
- *
- *
- * Arrays.subArray(char[] array, int fromIndex, int toIndex)
- *
- */
- public static char[] subArray(char[] array, int fromIndex, int toIndex) {
- int len = toIndex - fromIndex;
- if (len == 0) {
- return EMPTY_CHAR_ARRAY;
- }
- char[] result = new char[len];
- System.arraycopy(array, fromIndex, result, 0, len);
- return result;
- }
-
-
- // ********** swap **********
-
- /**
- * Return the array after the specified elements have been "swapped".
- *
- * Arrays.swap(Object[] array, int i, int j)
- */
- public static E[] swap(E[] array, int i, int j) {
- return (i == j) ? array : swap_(array, i, j);
- }
-
- /**
- * assume the indices are different
- */
- private static E[] swap_(E[] array, int i, int j) {
- E temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- return array;
- }
-
- /**
- * Return the array after the specified elements have been "swapped".
- *
- * Arrays.swap(char[] array, int i, int j)
- */
- public static char[] swap(char[] array, int i, int j) {
- return (i == j) ? array : swap_(array, i, j);
- }
-
- /**
- * assume the indices are different
- */
- private static char[] swap_(char[] array, int i, int j) {
- char temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- return array;
- }
-
- /**
- * Return the array after the specified elements have been "swapped".
- *
- * Arrays.swap(int[] array, int i, int j)
- */
- public static int[] swap(int[] array, int i, int j) {
- return (i == j) ? array : swap_(array, i, j);
- }
-
- /**
- * assume the indices are different
- */
- private static int[] swap_(int[] array, int i, int j) {
- int temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- return array;
- }
-
-
- // ********** Arrays enhancements **********
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(boolean[], boolean)
- */
- public static boolean[] fill(boolean[] array, boolean value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(boolean[], int, int, boolean)
- */
- public static boolean[] fill(boolean[] array, int fromIndex, int toIndex, boolean value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(byte[], byte)
- */
- public static byte[] fill(byte[] array, byte value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(byte[], int, int, byte)
- */
- public static byte[] fill(byte[] array, int fromIndex, int toIndex, byte value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(char[], char)
- */
- public static char[] fill(char[] array, char value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(char[], int, int, char)
- */
- public static char[] fill(char[] array, int fromIndex, int toIndex, char value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(double[], double)
- */
- public static double[] fill(double[] array, double value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(double[], int, int, double)
- */
- public static double[] fill(double[] array, int fromIndex, int toIndex, double value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(float[], float)
- */
- public static float[] fill(float[] array, float value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(float[], int, int, float)
- */
- public static float[] fill(float[] array, int fromIndex, int toIndex, float value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(int[], int)
- */
- public static int[] fill(int[] array, int value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(int[], int, int, int)
- */
- public static int[] fill(int[] array, int fromIndex, int toIndex, int value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(Object[], Object)
- */
- public static E[] fill(E[] array, E value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(Object[], int, int, Object)
- */
- public static E[] fill(E[] array, int fromIndex, int toIndex, E value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(long[], long)
- */
- public static long[] fill(long[] array, long value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(long[], int, int, long)
- */
- public static long[] fill(long[] array, int fromIndex, int toIndex, long value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(short[], short)
- */
- public static short[] fill(short[] array, short value) {
- Arrays.fill(array, value);
- return array;
- }
-
- /**
- * Return the array after it has been "filled".
- * @see Arrays#fill(short[], int, int, short)
- */
- public static short[] fill(short[] array, int fromIndex, int toIndex, short value) {
- Arrays.fill(array, fromIndex, toIndex, value);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(byte[])
- */
- public static byte[] sort(byte... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(byte[], int, int)
- */
- public static byte[] sort(byte[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(char[])
- */
- public static char[] sort(char... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(char[], int, int)
- */
- public static char[] sort(char[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(double[])
- */
- public static double[] sort(double... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(double[], int, int)
- */
- public static double[] sort(double[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(float[])
- */
- public static float[] sort(float... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(float[], int, int)
- */
- public static float[] sort(float[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(int[])
- */
- public static int[] sort(int... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(int[], int, int)
- */
- public static int[] sort(int[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(Object[])
- */
- public static E[] sort(E... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(Object[], Comparator)
- */
- public static E[] sort(E[] array, Comparator super E> comparator) {
- Arrays.sort(array, comparator);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(Object[], int, int)
- */
- public static E[] sort(E[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(Object[], int, int, Comparator)
- */
- public static E[] sort(E[] array, int fromIndex, int toIndex, Comparator super E> comparator) {
- Arrays.sort(array, fromIndex, toIndex, comparator);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(long[])
- */
- public static long[] sort(long... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(long[], int, int)
- */
- public static long[] sort(long[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(short[])
- */
- public static short[] sort(short... array) {
- Arrays.sort(array);
- return array;
- }
-
- /**
- * Return the array after it has been "sorted".
- * @see Arrays#sort(short[], int, int)
- */
- public static short[] sort(short[] array, int fromIndex, int toIndex) {
- Arrays.sort(array, fromIndex, toIndex);
- return array;
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private ArrayTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java
deleted file mode 100644
index 02226b4333..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 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;
-
-/**
- * Straightforward definition of an object pairing.
- * The key is immutable.
- */
-public interface Association {
-
- /**
- * Return the association's key.
- */
- K getKey();
-
- /**
- * Return the association's value.
- */
- V getValue();
-
- /**
- * Set the association's value.
- * Return the previous value.
- */
- V setValue(V value);
-
- /**
- * Return true if the associations' keys and values
- * are equal.
- */
- boolean equals(Object o);
-
- /**
- * Return a hash code based on the association's
- * key and value.
- */
- int hashCode();
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java
deleted file mode 100644
index 62b2e70653..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 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;
-
-import java.util.concurrent.ThreadFactory;
-
-import org.eclipse.jpt.common.utility.Command;
-
-/**
- * This command executor will dispatch commands to be executed in a separate
- * thread, allowing calls to {@link CommandExecutor#execute(Command)} to return
- * immediately.
- *
- * NB: The client-supplied commands should handle any
- * exception appropriately (e.g. log the exception and return gracefully) so
- * the command execution thread can continue executing.
- */
-public class AsynchronousCommandExecutor
- implements StatefulCommandExecutor
-{
- /**
- * This command queue is shared with the command execution/consumer thread.
- * Adding a command to it will trigger the command to be executed by the
- * command execution thread or, if another command is currently executing,
- * to execute the new command once the currently executing command has
- * finished executing.
- */
- final SynchronizedQueue commands = new SynchronizedQueue();
-
- /**
- * Most of the thread-related behavior is delegated to this coordinator.
- */
- private final ConsumerThreadCoordinator consumerThreadCoordinator;
-
-
- // ********** construction **********
-
- /**
- * Construct an asynchronous command executor.
- * Use simple JDK thread(s) for the command execution thread(s).
- * Allow the command execution thread(s) to be assigned JDK-generated names.
- */
- public AsynchronousCommandExecutor() {
- this(SimpleThreadFactory.instance(), null);
- }
-
- /**
- * Construct an asynchronous command executor.
- * Use the specified thread factory to construct the command execution thread(s).
- * Allow the command execution thread(s) to be assigned JDK-generated names.
- */
- public AsynchronousCommandExecutor(ThreadFactory threadFactory) {
- this(threadFactory, null);
- }
-
- /**
- * Construct an asynchronous command executor.
- * Use simple JDK thread(s) for the command execution thread(s).
- * Assign the command execution thread(s) the specified name.
- */
- public AsynchronousCommandExecutor(String threadName) {
- this(SimpleThreadFactory.instance(), threadName);
- }
-
- /**
- * Construct an asynchronous command executor.
- * Assign the command execution thread(s) the specified name.
- */
- public AsynchronousCommandExecutor(ThreadFactory threadFactory, String threadName) {
- super();
- this.consumerThreadCoordinator = this.buildConsumerThreadCoordinator(threadFactory, threadName);
- }
-
- private ConsumerThreadCoordinator buildConsumerThreadCoordinator(ThreadFactory threadFactory, String threadName) {
- return new ConsumerThreadCoordinator(this.buildConsumer(), threadFactory, threadName);
- }
-
- private ConsumerThreadCoordinator.Consumer buildConsumer() {
- return new Consumer();
- }
-
-
- // ********** CallbackStatefulCommandExecutor implementation **********
-
- /**
- * Build and start the command execution/consumer thread.
- *
- * Note: We don't clear the command queue here; so if a command has been
- * added to the queue before getting here, the first command will
- * be executed promptly (albeit, asynchronously).
- * The command queue will be non-empty if:
- * {@link #execute(Command)} was called after the command executor was
- * constructed but before {@link #start()} was called; or
- * {@link #execute(Command)} was called after {@link #stop()} was called
- * but before {@link #start()} was called (to restart the command executor); or
- * {@link #stop()} was called when there were still outstanding commands
- * remaining in the command queue
- *
- */
- public void start() {
- this.consumerThreadCoordinator.start();
- }
-
- /**
- * Put the specified command on the command queue, to be consumed by the
- * command execution thread.
- */
- public void execute(Command command) {
- this.commands.enqueue(command);
- }
-
- /**
- * Interrupt the command execution thread so that it stops executing at the
- * end of the current command. Suspend the current thread until
- * the command execution thread is finished executing. If any uncaught
- * exceptions were thrown while the execution thread was executing,
- * wrap them in a composite exception and throw the composite exception.
- */
- public void stop() {
- this.consumerThreadCoordinator.stop();
- }
-
-
- // ********** consumer **********
-
- /**
- * This implementation of {@link ConsumerThreadCoordinator.Consumer}
- * will execute the commands enqueued by the asynchronous command executor.
- * It will wait until the shared command queue is non-empty to begin executing the
- * commands in the queue. Once a comand is executed, the thread will quiesce until
- * another command is placed in the command queue. If a new command is
- * enqueued during the execution of another command (either recursively by
- * the command itself or by another thread),
- * the new command will be executed immediately after the currently
- * executing command is finished.
- * Stop the thread by calling {@link Thread#interrupt()}.
- */
- class Consumer
- implements ConsumerThreadCoordinator.Consumer
- {
- Consumer() {
- super();
- }
-
- /**
- * Wait until a command has been placed in the queue.
- */
- public void waitForProducer() throws InterruptedException {
- AsynchronousCommandExecutor.this.commands.waitUntilNotEmpty();
- }
-
- /**
- * Execute the first command in the queue and notify our listeners.
- */
- public void execute() {
- AsynchronousCommandExecutor.this.commands.dequeue().execute();
- }
-
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java
deleted file mode 100644
index 0cecf9718c..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 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;
-
-import java.io.Serializable;
-import java.util.AbstractCollection;
-import java.util.Iterator;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-
-/**
- * A collection that allows duplicate elements.
- *
- * The Bag
interface places additional stipulations,
- * beyond those inherited from the {@link java.util.Collection} interface,
- * on the contracts of the {@link #equals(Object)} and {@link #hashCode()} methods.
- *
- * @see HashBag
- */
-
-public interface Bag extends java.util.Collection {
-
- /**
- * Compares the specified object with this bag for equality. Returns
- * true
if the specified object is also a bag, the two bags
- * have the same size, and every member of the specified bag is
- * contained in this bag with the same number of occurrences (or equivalently,
- * every member of this bag is contained in the specified bag with the same
- * number of occurrences). This definition ensures that the
- * equals method works properly across different implementations of the
- * bag interface.
- */
- boolean equals(Object o);
-
- /**
- * Returns the hash code value for this bag. The hash code of a bag is
- * defined to be the sum of the hash codes of the elements in the bag,
- * where the hashcode of a null
element is defined to be zero.
- * This ensures that b1.equals(b2)
implies that
- * b1.hashCode() == b2.hashCode()
for any two bags
- * b1
and b2
, as required by the general
- * contract of the {@link Object#hashCode()} method.
- */
- int hashCode();
-
- /**
- * Return the number of times the specified object occurs in the bag.
- */
- int count(Object o);
-
- /**
- * Add the specified object the specified number of times to the bag.
- * Return whether the bag changed.
- */
- boolean add(E o, int count);
-
- /**
- * Remove the specified number of occurrences of the specified object
- * from the bag. Return whether the bag changed.
- */
- boolean remove(Object o, int count);
-
- /**
- * Return an iterator that returns each item in the bag
- * once and only once, irrespective of how many times
- * the item was added to the bag.
- */
- java.util.Iterator uniqueIterator();
-
- /**
- * Return the number of unique items in the bag.
- */
- int uniqueCount();
-
- /**
- * Return an iterator that returns an entry for each item in the bag
- * once and only once, irrespective of how many times
- * the item was added to the bag. The entry will indicate the item's
- * count.
- */
- java.util.Iterator> entries();
-
-
- /**
- * A bag entry (element-count pair).
- * The {@link Bag#entries()} method returns an iterator whose
- * elements are of this class. The only way to obtain a reference
- * to a bag entry is from the iterator returned by this method. These
- * Bag.Entry
objects are valid only for the duration
- * of the iteration; more formally, the behavior of a bag entry is
- * undefined if the backing bag has been modified after the entry was
- * returned by the iterator, except through the {@link #setCount(int)}
- * operation on the bag entry.
- */
- interface Entry {
-
- /**
- * Return the entry's element.
- */
- E getElement();
-
- /**
- * Return entry's count; i.e. the number of times the entry's element
- * occurs in the bag.
- * @see Bag#count(Object)
- */
- int getCount();
-
- /**
- * Set the entry's count; i.e. the number of times the entry's element
- * occurs in the bag. The new count must be a positive number.
- * Return the previous count of the entry's element.
- * NB: Use {@link Iterator#remove()} to set the
- * count to zero.
- */
- int setCount(int count);
-
- /**
- * Return whether the entry is equal to the specified object;
- * i.e. the specified object is a Bag.Entry
and its
- * element and count are the same as the entry's.
- */
- boolean equals(Object obj);
-
- /**
- * Return the entry's hash code.
- */
- int hashCode();
-
- }
-
-
- final class Empty extends AbstractCollection implements Bag, Serializable {
- @SuppressWarnings("rawtypes")
- public static final Bag INSTANCE = new Empty();
- @SuppressWarnings("unchecked")
- public static Bag instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Empty() {
- super();
- }
- @Override
- public Iterator iterator() {
- return EmptyIterator.instance();
- }
- @Override
- public int size() {
- return 0;
- }
- public Iterator uniqueIterator() {
- return EmptyIterator.instance();
- }
- public int uniqueCount() {
- return 0;
- }
- public int count(Object o) {
- return 0;
- }
- public Iterator> entries() {
- return EmptyIterator.instance();
- }
- public boolean remove(Object o, int count) {
- return false;
- }
- public boolean add(E o, int count) {
- throw new UnsupportedOperationException();
- }
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if ( ! (o instanceof Bag>)) {
- return false;
- }
- return ((Bag>) o).size() == 0;
- }
- @Override
- public int hashCode() {
- return 0;
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // 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/BidiFilter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java
deleted file mode 100644
index 2894793ffd..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 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;
-
-import java.io.Serializable;
-
-import org.eclipse.jpt.common.utility.Filter;
-
-/**
- * Used by various "pluggable" classes to filter objects
- * in both directions.
- *
- * If anyone can come up with a better class name
- * and/or method name, I would love to hear it. ~bjv
- */
-public interface BidiFilter extends Filter {
-
- /**
- * Return whether the specified object is "accepted" by the
- * "reverse" filter. What that means is determined by the client.
- */
- boolean reverseAccept(T o);
-
-
- final class Null implements BidiFilter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiFilter INSTANCE = new Null();
- @SuppressWarnings("unchecked")
- public static BidiFilter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- // nothing is filtered - everything is accepted
- public boolean accept(S o) {
- return true;
- }
- // nothing is "reverse-filtered" - everything is accepted
- public boolean reverseAccept(S o) {
- return true;
- }
- @Override
- public String toString() {
- return "BidiFilter.Null"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- final class Opaque implements BidiFilter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiFilter INSTANCE = new Opaque();
- @SuppressWarnings("unchecked")
- public static BidiFilter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Opaque() {
- super();
- }
- // everything is filtered - nothing is accepted
- public boolean accept(S o) {
- return false;
- }
- // everything is "reverse-filtered" - nothing is accepted
- public boolean reverseAccept(S o) {
- return false;
- }
- @Override
- public String toString() {
- return "BidiFilter.Opaque"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- final class Disabled implements BidiFilter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiFilter INSTANCE = new Disabled();
- @SuppressWarnings("unchecked")
- public static BidiFilter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Disabled() {
- super();
- }
- // throw an exception
- public boolean accept(S o) {
- throw new UnsupportedOperationException();
- }
- // throw an exception
- public boolean reverseAccept(S o) {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return "BidiFilter.Disabled"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // 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/BidiStringConverter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java
deleted file mode 100644
index 056b29ae9f..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 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;
-
-import java.io.Serializable;
-
-/**
- * Used by various "pluggable" classes to transform objects
- * into strings and vice versa.
- *
- * If anyone can come up with a better class name
- * and/or method name, I would love to hear it. ~bjv
- */
-public interface BidiStringConverter extends StringConverter {
-
- /**
- * Convert the specified string into an object.
- * The semantics of "convert to object" is determined by the
- * contract between the client and the server.
- * Typically, if the string is null, null is returned.
- */
- T convertToObject(String s);
-
-
- final class Default implements BidiStringConverter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiStringConverter INSTANCE = new Default();
- @SuppressWarnings("unchecked")
- public static BidiStringConverter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Default() {
- super();
- }
- // simply return the object's #toString() result
- public String convertToString(S o) {
- return (o == null) ? null : o.toString();
- }
- // simply return the string
- @SuppressWarnings("unchecked")
- public S convertToObject(String s) {
- return (S) s;
- }
- @Override
- public String toString() {
- return "BidiStringConverter.Default"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- final class Disabled implements BidiStringConverter, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiStringConverter INSTANCE = new Disabled();
- @SuppressWarnings("unchecked")
- public static BidiStringConverter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Disabled() {
- super();
- }
- // throw an exception
- public String convertToString(S o) {
- throw new UnsupportedOperationException();
- }
- // throw an exception
- public S convertToObject(String s) {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return "BidiStringConverter.Disabled"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- final class BooleanConverter implements BidiStringConverter, Serializable {
- public static final BidiStringConverter INSTANCE = new BooleanConverter();
- public static BidiStringConverter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private BooleanConverter() {
- super();
- }
- /** Return "true" if the Boolean is true, otherwise return "false". */
- public String convertToString(Boolean b) {
- return (b == null) ? null : b.toString();
- }
- /** Return Boolean.TRUE if the string is "true" (case-insensitive), otherwise return Boolean.FALSE. */
- public Boolean convertToObject(String s) {
- return (s == null) ? null : Boolean.valueOf(s);
- }
- @Override
- public String toString() {
- return "BidiStringConverter.BooleanConverter"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- final class IntegerConverter implements BidiStringConverter, Serializable {
- public static final BidiStringConverter INSTANCE = new IntegerConverter();
- public static BidiStringConverter instance() {
- return INSTANCE;
- }
- // ensure single instance
- private IntegerConverter() {
- super();
- }
- /** Integer's #toString() works well. */
- public String convertToString(Integer integer) {
- return (integer == null) ? null : integer.toString();
- }
- /** Convert the string to an Integer, if possible. */
- public Integer convertToObject(String s) {
- return (s == null) ? null : Integer.valueOf(s);
- }
- @Override
- public String toString() {
- return "BidiStringConverter.IntegerConverter"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // 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/BidiTransformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java
deleted file mode 100644
index c105d9d50a..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 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;
-
-import java.io.Serializable;
-
-/**
- * Used by various "pluggable" classes to transform objects
- * in both directions.
- *
- * If anyone can come up with a better class name
- * and/or method name, I would love to hear it. ~bjv
- */
-public interface BidiTransformer extends Transformer {
-
- /**
- * Return the "reverse-transformed" object.
- * The semantics of "reverse-transform" is determined by the
- * contract between the client and the server.
- */
- T1 reverseTransform(T2 o);
-
-
- final class Null implements BidiTransformer, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiTransformer INSTANCE = new Null();
- @SuppressWarnings("unchecked")
- public static BidiTransformer instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- // simply return the object, unchanged
- @SuppressWarnings("unchecked")
- public S2 transform(S1 o) {
- return (S2) o;
- }
- // simply return the object, unchanged
- @SuppressWarnings("unchecked")
- public S1 reverseTransform(S2 o) {
- return (S1) o;
- }
- @Override
- public String toString() {
- return "BidiTransformer.Null"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // replace this object with the singleton
- return INSTANCE;
- }
- }
-
- final class Disabled implements BidiTransformer, Serializable {
- @SuppressWarnings("rawtypes")
- public static final BidiTransformer INSTANCE = new Disabled();
- @SuppressWarnings("unchecked")
- public static BidiTransformer instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Disabled() {
- super();
- }
- // throw an exception
- public S2 transform(S1 o) {
- throw new UnsupportedOperationException();
- }
- // throw an exception
- public S1 reverseTransform(S2 o) {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return "BidiTransformer.Disabled"; //$NON-NLS-1$
- }
- private static final long serialVersionUID = 1L;
- private Object readResolve() {
- // 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/BitTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java
deleted file mode 100644
index 20cbf7c9f0..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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;
-
-/**
- * Assorted bit tools
- */
-public final class BitTools {
-
- /**
- * Return whether the specified 'flags' has the specified
- * 'flagToCheck' set.
- */
- public static boolean flagIsSet(int flags, int flagToCheck) {
- return allFlagsAreSet(flags, flagToCheck);
- }
-
- /**
- * Return whether the specified 'flags' has the specified
- * 'flagToCheck' turned off.
- */
- public static boolean flagIsOff(int flags, int flagToCheck) {
- return allFlagsAreOff(flags, flagToCheck);
- }
-
- /**
- * Return whether the specified 'flags' has ONLY the specified
- * 'flagToCheck' set.
- */
- public static boolean onlyFlagIsSet(int flags, int flagToCheck) {
- return onlyFlagsAreSet(flags, flagToCheck);
- }
-
- /**
- * Return whether the specified 'flags' has ONLY the specified
- * 'flagToCheck' turned off.
- */
- public static boolean onlyFlagIsOff(int flags, int flagToCheck) {
- return onlyFlagsAreOff(flags, flagToCheck);
- }
-
- /**
- * Return whether the specified 'flags' has all the specified
- * 'flagsToCheck' set.
- */
- public static boolean allFlagsAreSet(int flags, int flagsToCheck) {
- return (flags & flagsToCheck) == flagsToCheck;
- }
-
- /**
- * Return whether the specified 'flags' has all the specified
- * 'flagsToCheck' turned off.
- */
- public static boolean allFlagsAreOff(int flags, int flagsToCheck) {
- return (flags & flagsToCheck) == 0;
- }
-
- /**
- * Return whether the specified 'flags' has ONLY the specified
- * 'flagsToCheck' set.
- */
- public static boolean onlyFlagsAreSet(int flags, int flagsToCheck) {
- return allFlagsAreSet(flags, flagsToCheck) && allFlagsAreOff(flags, ~flagsToCheck);
- }
-
- /**
- * Return whether the specified 'flags' has ONLY the specified
- * 'flagsToCheck' turned off.
- */
- public static boolean onlyFlagsAreOff(int flags, int flagsToCheck) {
- return allFlagsAreOff(flags, flagsToCheck) && allFlagsAreSet(flags, ~flagsToCheck);
- }
-
- /**
- * Return whether the specified 'flags' has any one of the specified
- * 'flagsToCheck' set.
- */
- public static boolean anyFlagsAreSet(int flags, int flagsToCheck) {
- return (flags & flagsToCheck) != 0;
- }
-
- /**
- * Return whether the specified 'flags' has any one of the specified
- * 'flagsToCheck' turned off.
- */
- public static boolean anyFlagsAreOff(int flags, int flagsToCheck) {
- return (flags & flagsToCheck) != flagsToCheck;
- }
-
- /**
- * Return whether the specified 'flags' has all the specified
- * 'flagsToCheck' set.
- */
- public static boolean allFlagsAreSet(int flags, int... flagsToCheck) {
- for (int i = flagsToCheck.length; i-- > 0; ) {
- if ( ! allFlagsAreSet(flags, flagsToCheck[i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return whether the specified 'flags' has all the specified
- * 'flagsToCheck' turned off.
- */
- public static boolean allFlagsAreOff(int flags, int... flagsToCheck) {
- for (int i = flagsToCheck.length; i-- > 0; ) {
- if ( ! allFlagsAreOff(flags, flagsToCheck[i])) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return whether the specified 'flags' has ONLY the specified
- * 'flagsToCheck' set.
- */
- public static boolean onlyFlagsAreSet(int flags, int... flagsToCheck) {
- int combinedFlags = orFlags(flagsToCheck);
- return allFlagsAreSet(flags, combinedFlags) && allFlagsAreOff(flags, ~combinedFlags);
- }
-
- /**
- * Return whether the specified 'flags' has ONLY the specified
- * 'flagsToCheck' turned off.
- */
- public static boolean onlyFlagsAreOff(int flags, int... flagsToCheck) {
- int combinedFlags = orFlags(flagsToCheck);
- return allFlagsAreOff(flags, combinedFlags) && allFlagsAreSet(flags, ~combinedFlags);
- }
-
- /**
- * Return whether the specified 'flags' has any one of the specified
- * 'flagsToCheck' set.
- */
- public static boolean anyFlagsAreSet(int flags, int... flagsToCheck) {
- for (int i = flagsToCheck.length; i-- > 0; ) {
- if (anyFlagsAreSet(flags, flagsToCheck[i])) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return whether the specified 'flags' has any one of the specified
- * 'flagsToCheck' turned off.
- */
- public static boolean anyFlagsAreOff(int flags, int... flagsToCheck) {
- for (int i = flagsToCheck.length; i-- > 0; ) {
- if (anyFlagsAreOff(flags, flagsToCheck[i])) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * OR all the specified 'flags' together and return the result.
- */
- public static int orFlags(int... flags) {
- int last = flags.length - 1;
- int result = flags[last];
- for (int i = last; i-- > 0; ) {
- result |= flags[i];
- }
- return result;
- }
-
- /**
- * AND all the specified 'flags' together and return the result.
- */
- public static int andFlags(int... flags) {
- int last = flags.length - 1;
- int result = flags[last];
- for (int i = last; i-- > 0; ) {
- result &= flags[i];
- }
- return result;
- }
-
- /**
- * XOR all the specified 'flags' together and return the result.
- */
- public static int xorFlags(int... flags) {
- int last = flags.length - 1;
- int result = flags[last];
- for (int i = last; i-- > 0; ) {
- result ^= flags[i];
- }
- return result;
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private BitTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java
deleted file mode 100644
index 9d114257d1..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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;
-
-/**
- * Interface for a container for passing a flag that can be changed by
- * the recipient.
- */
-public interface BooleanReference
- extends ReadOnlyBooleanReference
-{
- /**
- * Set the boolean
value.
- * Return the previous value.
- */
- boolean setValue(boolean value);
-
- /**
- * Set the boolean
value to the NOT of its current value.
- * Return the new value.
- */
- boolean flip();
-
- /**
- * Set the boolean
value to the NOT of the specified value.
- * Return the previous value.
- */
- boolean setNot(boolean v);
-
- /**
- * Set the boolean
value to true
.
- * Return the previous value.
- */
- boolean setTrue();
-
- /**
- * Set the boolean
value to false
.
- * Return the previous value.
- */
- boolean setFalse();
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java
deleted file mode 100644
index 783c0f1299..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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;
-
-/**
- * Assorted "Capital-B Boolean" operations.
- */
- // commented code is just playing around with building *everything* from NAND
-public final class BooleanTools {
-
- /**
- * Return the NOT of the specified Boolean.
- * Boolean#not()
- */
- public static Boolean not(Boolean b) {
- return Boolean.valueOf( ! b.booleanValue());
-// return nand(b, b);
- }
-
- /**
- * Return the AND of the specified Booleans.
- * Boolean#and(Boolean)
- */
- public static Boolean and(Boolean b1, Boolean b2) {
- return Boolean.valueOf(b1.booleanValue() && b2.booleanValue());
-// Boolean nand = nand(b1, b2);
-// return nand(nand, nand);
- }
-
- /**
- * Return the OR of the specified Booleans.
- * Boolean#or(Boolean)
- */
- public static Boolean or(Boolean b1, Boolean b2) {
- return Boolean.valueOf(b1.booleanValue() || b2.booleanValue());
-// Boolean nand = nand(b1, b2);
-// Boolean xor = nand(nand(b1, nand), nand(b2, nand));
-// Boolean and = nand(nand, nand);
-// Boolean nand2 = nand(xor, and);
-// return nand(nand(xor, nand2), nand(and, nand2));
- }
-
- /**
- * Return the XOR of the specified Booleans.
- * Boolean#xor(Boolean)
- */
- public static Boolean xor(Boolean b1, Boolean b2) {
- return and(or(b1, b2), nand(b1, b2));
-// Boolean nand = nand(b1, b2);
-// return nand(nand(b1, nand), nand(b2, nand));
- }
-
- /**
- * Return the NAND of the specified Booleans.
- * Boolean#nand(Boolean)
- */
- public static Boolean nand(Boolean b1, Boolean b2) {
- return not(and(b1, b2));
-// return Boolean.valueOf( ! (b1.booleanValue() && b2.booleanValue()));
- }
-
- /**
- * Return the NOR of the specified Booleans.
- * Boolean#nor(Boolean)
- */
- public static Boolean nor(Boolean b1, Boolean b2) {
- return not(or(b1, b2));
-// Boolean nand = nand(b1, b2);
-// Boolean xor = nand(nand(b1, nand), nand(b2, nand));
-// Boolean and = nand(nand, nand);
-// Boolean nand2 = nand(xor, and);
-// Boolean nand3 = nand(nand(xor, nand2), nand(and, nand2));
-// return nand(nand3, nand3);
- }
-
- /**
- * Return the XNOR of the specified Booleans.
- * Boolean#xnor(Boolean)
- */
- public static Boolean xnor(Boolean b1, Boolean b2) {
- return not(xor(b1, b2));
-// Boolean nand = nand(b1, b2);
-// Boolean xor = nand(nand(b1, nand), nand(b2, nand));
-// return nand(xor, xor);
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private BooleanTools() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java
deleted file mode 100644
index aaf4be351c..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 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;
-
-/**
- * Convenience methods related to Java class names as returned by
- * {@link java.lang.Class#getName()}.
- */
-public final class ClassName {
-
- public static final String VOID_CLASS_NAME = ReflectionTools.VOID_CLASS.getName();
- public static final String VOID_WRAPPER_CLASS_NAME = ReflectionTools.VOID_WRAPPER_CLASS.getName();
-
- public static final char REFERENCE_CLASS_CODE = 'L';
- public static final char REFERENCE_CLASS_NAME_DELIMITER = ';';
-
- /**
- * Return whether the specified class is an array type.
- * @see java.lang.Class#getName()
- */
- public static boolean isArray(String className) {
- return className.charAt(0) == '[';
- }
-
- /**
- * Return the "element type" of the specified class.
- * The element type is the base type held by an array type.
- * Non-array types simply return themselves.
- * @see java.lang.Class#getName()
- */
- public static String getElementTypeName(String className) {
- int depth = getArrayDepth(className);
- if (depth == 0) {
- // the name is in the form: "java.lang.Object" or "int"
- return className;
- }
- return getElementTypeName_(className, depth);
- }
-
- /**
- * pre-condition: array depth is not zero
- */
- private static String getElementTypeName_(String className, int arrayDepth) {
- int last = className.length() - 1;
- if (className.charAt(arrayDepth) == REFERENCE_CLASS_CODE) {
- // the name is in the form: "[[[Ljava.lang.Object;"
- return className.substring(arrayDepth + 1, last); // drop the trailing ';'
- }
- // the name is in the form: "[[[I"
- return forCode(className.charAt(last));
- }
-
- /**
- * Return the "array depth" of the specified class.
- * The depth is the number of dimensions for an array type.
- * Non-array types have a depth of zero.
- * @see java.lang.Class#getName()
- */
- public static int getArrayDepth(String className) {
- int depth = 0;
- while (className.charAt(depth) == '[') {
- depth++;
- }
- return depth;
- }
-
- /**
- * Return the specified class's component type.
- * Return null
if the specified class is not an array type.
- * @see java.lang.Class#getName()
- */
- public static String getComponentTypeName(String className) {
- switch (getArrayDepth(className)) {
- case 0:
- return null;
- case 1:
- return getElementTypeName_(className, 1);
- default:
- return className.substring(1);
- }
- }
-
- /**
- * Return the specified class's simple name.
- * Return an empty string if the specified class is anonymous.
- *
- * The simple name of an array type is the simple name of the
- * component type with "[]"
appended. In particular,
- * the simple name of an array type whose component type is
- * anonymous is simply "[]"
.
- * @see java.lang.Class#getSimpleName()
- */
- public static String getSimpleName(String className) {
- return isArray(className) ?
- getSimpleName(getComponentTypeName(className)) + "[]" : //$NON-NLS-1$
- getSimpleName_(className);
- }
-
- /**
- * pre-condition: specified class is not an array type
- */
- private static String getSimpleName_(String className) {
- int index = className.lastIndexOf('$');
- if (index == -1) { // "top-level" class - strip package name
- return className.substring(className.lastIndexOf('.') + 1);
- }
-
- int len = className.length();
- for (int i = ++index; i < len; i++) {
- if ( ! charIsAsciiDigit(className.charAt(i))) {
- return className.substring(i); // "member" or "local" class
- }
- }
- // all the characters past the '$' are ASCII digits ("anonymous" class)
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Return the specified class's package name (e.g.
- * "java.lang.Object"
returns
- * "java.lang"
).
- * Return an empty string if the specified class is:
- * in the "default" package
- * an array class
- * a primtive class
- *
- * @see java.lang.Class#getPackage()
- * @see java.lang.Package#getName()
- */
- public static String getPackageName(String className) {
- if (isArray(className)) {
- return ""; //$NON-NLS-1$
- }
- int lastPeriod = className.lastIndexOf('.');
- return (lastPeriod == -1) ? "" : className.substring(0, lastPeriod); //$NON-NLS-1$
- }
-
- /**
- * Return whether the specified class is a "top-level" class,
- * as opposed to a "member", "local", or "anonymous" class,
- * using the standard JDK naming conventions (i.e. the class
- * name does NOT contain a '$'
).
- * A "top-level" class can be either the "primary" (public) class defined
- * in a file/compilation unit (i.e. the class with the same name as its
- * file's simple base name) or a "non-primary" (package visible) class
- * (i.e. the other top-level classes defined in a file).
- * A "top-level" class can contain any of the other types of classes.
- * @see java.lang.Class#getName()
- */
- public static boolean isTopLevel(String className) {
- if (isArray(className)) {
- return false;
- }
- return className.lastIndexOf('$') == -1;
- }
-
- /**
- * Return whether the specified class is a "member" class,
- * as opposed to a "top-level", "local", or "anonymous" class,
- * using the standard JDK naming convention (i.e. the class
- * name ends with a '$'
followed by a legal class name; e.g.
- * "TopLevelClass$1LocalClass$MemberClass"
).
- * A "member" class can be either "nested" (static) or "inner";
- * but there is no way to determine which from the class's name.
- * A "member" class can contain "local", "anonymous", or other
- * "member" classes; and vice-versa.
- * @see java.lang.Class#getName()
- */
- public static boolean isMember(String className) {
- if (isArray(className)) {
- return false;
- }
- int index = className.lastIndexOf('$');
- if (index == -1) {
- return false; // "top-level" class
- }
- // the character immediately after the dollar sign cannot be an ASCII digit
- return ! charIsAsciiDigit(className.charAt(++index));
- }
-
- /**
- * Return whether the specified class is a "local" class,
- * as opposed to a "top-level", "member", or "anonymous" class,
- * using the standard JDK naming convention (i.e. the class name
- * ends with "$nnnXXX"
,
- * where the '$'
is
- * followed by a series of numeric digits which are followed by the
- * local class name; e.g. "TopLevelClass$1LocalClass"
).
- * A "local" class can contain "member", "anonymous", or other
- * "local" classes; and vice-versa.
- * @see java.lang.Class#getName()
- */
- public static boolean isLocal(String className) {
- if (isArray(className)) {
- return false;
- }
- int index = className.lastIndexOf('$');
- if (index == -1) {
- return false; // "top-level" class
- }
- if ( ! charIsAsciiDigit(className.charAt(++index))) {
- return false; // "member" class
- }
- int len = className.length();
- for (int i = ++index; i < len; i++) {
- if ( ! charIsAsciiDigit(className.charAt(i))) {
- return true;
- }
- }
- // all the characters past the '$' are ASCII digits ("anonymous" class)
- return false;
- }
-
- /**
- * Return whether the specified class is an "anonymous" class,
- * as opposed to a "top-level", "member", or "local" class,
- * using the standard JDK naming convention (i.e. the class
- * name ends with "$nnn"
where all the characters past the
- * last '$'
are ASCII numeric digits;
- * e.g. "TopLevelClass$1"
).
- * An "anonymous" class can contain "member", "local", or other
- * "anonymous" classes; and vice-versa.
- * @see java.lang.Class#getName()
- */
- public static boolean isAnonymous(String className) {
- if (isArray(className)) {
- return false;
- }
- int index = className.lastIndexOf('$');
- if (index == -1) {
- return false; // "top-level" class
- }
- if ( ! charIsAsciiDigit(className.charAt(++index))) {
- return false; // "member" class
- }
- int len = className.length();
- for (int i = ++index; i < len; i++) {
- if ( ! charIsAsciiDigit(className.charAt(i))) {
- return false; // "local" class
- }
- }
- // all the characters past the '$' are ASCII digits ("anonymous" class)
- return true;
- }
-
- /**
- * {@link Character#isDigit(char)} returns true
for some non-ASCII
- * digits. This method does not.
- */
- private static boolean charIsAsciiDigit(char c) {
- return ('0' <= c) && (c <= '9');
- }
-
- /**
- * Return whether the specified class is a "reference"
- * class (i.e. neither void
nor one of the primitive variable classes,
- * boolean
, int
, float
, etc.).
- *
- * NB: void.class.isPrimitive() == true
- */
- public static boolean isReference(String className) {
- return ! isPrimitive(className);
- }
-
- /**
- * Return whether the specified class is a primitive
- * class (i.e. void
or one of the primitive variable classes,
- * boolean
, int
, float
, etc.).
- *
- * NB: void.class.isPrimitive() == true
- */
- public static boolean isPrimitive(String className) {
- if (isArray(className) || (className.length() > ReflectionTools.MAX_PRIMITIVE_CLASS_NAME_LENGTH)) {
- return false; // performance tweak
- }
- for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) {
- if (className.equals(primitive.javaClass.getName())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return whether the specified class is a primitive wrapper
- * class (i.e. java.lang.Void
or one of the primitive
- * variable wrapper classes, java.lang.Boolean
,
- * java.lang.Integer
, java.lang.Float
, etc.).
- *
- * NB: void.class.isPrimitive() == true
- */
- public static boolean isPrimitiveWrapper(String className) {
- if (isArray(className) || (className.length() > ReflectionTools.MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH)) {
- return false; // performance tweak
- }
- for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) {
- if (className.equals(primitive.wrapperClass.getName())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return whether the specified class is a "variable" primitive
- * class (i.e. boolean
, int
, float
, etc.,
- * but not void
).
- *
- * NB: void.class.isPrimitive() == true
- */
- public static boolean isVariablePrimitive(String className) {
- return isPrimitive(className)
- && ( ! className.equals(VOID_CLASS_NAME));
- }
-
- /**
- * Return whether the specified class is a "variable" primitive wrapper
- * class (i.e. java.lang.Boolean
,
- * java.lang.Integer
, java.lang.Float
, etc.,
- * but not java.lang.Void
).
- *
- * NB: void.class.isPrimitive() == true
- */
- public static boolean isVariablePrimitiveWrapper(String className) {
- return isPrimitiveWrapper(className)
- && ( ! className.equals(VOID_WRAPPER_CLASS_NAME));
- }
-
- /**
- * Return the name of the primitive wrapper class corresponding to the specified
- * primitive class. Return null
if the specified class is not a primitive.
- */
- public static String getWrapperClassName(String primitiveClassName) {
- for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) {
- if (primitive.javaClass.getName().equals(primitiveClassName)) {
- return primitive.wrapperClass.getName();
- }
- }
- return null;
- }
-
- /**
- * Return the name of the primitive class corresponding to the specified
- * primitive wrapper class. Return null
if the specified class
- * is not a primitive wrapper.
- */
- public static String getPrimitiveClassName(String primitiveWrapperClassName) {
- for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) {
- if (primitive.wrapperClass.getName().equals(primitiveWrapperClassName)) {
- return primitive.javaClass.getName();
- }
- }
- return null;
- }
-
- /**
- * Return whether the two class names are equivalent, given autoboxing.
- * (e.g. "java.lang.Integer" and "int" should be equivalent)
- */
- public static boolean areAutoboxEquivalents(String className1, String className2) {
- return Tools.valuesAreEqual(className1, className2)
- || Tools.valuesAreEqual(getPrimitiveClassName(className1), className2)
- || Tools.valuesAreEqual(getWrapperClassName(className1), className2);
- }
-
-
- // ********** primitive codes **********
-
- /**
- * Return the primitive class name for the specified primitive class code.
- * Return null
if the specified code
- * is not a primitive class code.
- * @see java.lang.Class#getName()
- */
- public static String forCode(int classCode) {
- return forCode((char) classCode);
- }
-
- /**
- * Return the primitive class name for the specified primitive class code.
- * Return null
if the specified code
- * is not a primitive class code.
- * @see java.lang.Class#getName()
- */
- public static String forCode(char classCode) {
- Class> primitiveClass = ReflectionTools.getClassForCode(classCode);
- return (primitiveClass == null) ? null : primitiveClass.getName();
- }
-
- /**
- * Return the class code for the specified primitive class.
- * Return 0
if the specified class
- * is not a primitive class.
- * @see java.lang.Class#getName()
- */
- public static char getCodeForClassName(String primitiveClassName) {
- if (( ! isArray(primitiveClassName)) && (primitiveClassName.length() <= ReflectionTools.MAX_PRIMITIVE_CLASS_NAME_LENGTH)) {
- for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) {
- if (primitive.javaClass.getName().equals(primitiveClassName)) {
- return primitive.code;
- }
- }
- }
- return 0;
- }
-
- static void append(String className, StringBuilder sb) {
- sb.append(REFERENCE_CLASS_CODE);
- sb.append(className);
- sb.append(REFERENCE_CLASS_NAME_DELIMITER);
- }
-
-
- // ********** suppressed constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private ClassName() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java
deleted file mode 100644
index dcf03bd2cf..0000000000
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java
+++ /dev/null
@@ -1,939 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2010 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;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
-
-/**
- * Classpath
models a Java classpath, which consists of a list of
- * {@link Entry}s, each of which contain Java classes. The classpath can return
- * the names of classes found in it etc. There are a number of static
- * convenience methods that can be use to construct Classpath
s
- * corresponding to the Java classpath etc.
- */
-public class Classpath
- implements Serializable
-{
- /** The entries in the classpath */
- private final Entry[] entries;
-
- private static final long serialVersionUID = 1L;
-
-
- // ********** static methods **********
-
- // ***** factory methods for "standard" classpaths *****
-
- /**
- * Return the Java "boot" classpath. This includes rt.jar
.
- */
- public static Classpath bootClasspath() {
- return new Classpath(System.getProperty("sun.boot.class.path")); //$NON-NLS-1$
- }
-
- /**
- * Return a "virtual classpath" that contains all the jars
- * that would be used by the Java Extension Mechanism.
- */
- public static Classpath javaExtensionClasspath() {
- File[] dirs = javaExtensionDirectories();
- List jarFileNames = new ArrayList();
- for (File dir : dirs) {
- if (dir.isDirectory()) {
- addJarFileNamesTo(dir, jarFileNames);
- }
- }
- return new Classpath(jarFileNames);
- }
-
- /**
- * Return the Java "system" classpath.
- */
- public static Classpath javaClasspath() {
- return new Classpath(System.getProperty("java.class.path")); //$NON-NLS-1$
- }
-
- /**
- * Return the unretouched "complete" classpath.
- * This includes the boot classpath, the Java Extension
- * Mechanism classpath, and the normal "system" classpath.
- */
- public static Classpath completeClasspath() {
- return new Classpath(new Classpath[] {
- bootClasspath(),
- javaExtensionClasspath(),
- javaClasspath()
- });
- }
-
- /**
- * Return a classpath that contains the location of the specified class.
- */
- public static Classpath classpathFor(Class> javaClass) {
- return new Classpath(locationFor(javaClass));
- }
-
-
- // ***** file => class *****
-
- /**
- * Convert a relative file name to a class name; this will work for
- * any file that has a single extension beyond the base
- * class name:
- * "java/lang/String.class"
is converted to "java.lang.String"
- * "java/lang/String.java"
is converted to "java.lang.String"
- *
- */
- public static String convertToClassName(String classFileName) {
- String className = FileTools.stripExtension(classFileName);
- // do this for archive entry names
- className = className.replace('/', '.');
- // do this for O/S-specific file names
- if (File.separatorChar != '/') {
- className = className.replace(File.separatorChar, '.');
- }
- return className;
- }
-
- /**
- * Convert a file to a class name;
- * e.g. File(java/lang/String.class)
is converted to
- * "java.lang.String"
.
- */
- public static String convertToClassName(File classFile) {
- return convertToClassName(classFile.getPath());
- }
-
- /**
- * Convert a relative file name to a class;
- * e.g. "java/lang/String.class"
is converted to
- * java.lang.String.class
.
- */
- public static Class> convertToClass(String classFileName) throws ClassNotFoundException {
- return Class.forName(convertToClassName(classFileName));
- }
-
- /**
- * Convert a relative file to a class;
- * e.g. File(java/lang/String.class)
is converted to
- * java.lang.String.class
.
- */
- public static Class> convertToClass(File classFile) throws ClassNotFoundException {
- return convertToClass(classFile.getPath());
- }
-
-
- // ***** class => JAR entry *****
-
- /**
- * Convert a class name to an archive entry name base;
- * e.g. "java.lang.String"
is converted to
- * "java/lang/String"
.
- */
- public static String convertToArchiveEntryNameBase(String className) {
- return className.replace('.', '/');
- }
-
- /**
- * Convert a class to an archive entry name base;
- * e.g. java.lang.String.class
is converted to
- * "java/lang/String"
.
- */
- public static String convertToArchiveEntryNameBase(Class> javaClass) {
- return convertToArchiveEntryNameBase(javaClass.getName());
- }
-
- /**
- * Convert a class name to an archive class file entry name;
- * e.g. "java.lang.String"
is converted to
- * "java/lang/String.class"
.
- */
- public static String convertToArchiveClassFileEntryName(String className) {
- return convertToArchiveEntryNameBase(className) + ".class"; //$NON-NLS-1$
- }
-
- /**
- * Convert a class to an archive class file entry name;
- * e.g. java.lang.String.class
is converted to
- * "java/lang/String.class"
.
- */
- public static String convertToArchiveClassFileEntryName(Class> javaClass) {
- return convertToArchiveClassFileEntryName(javaClass.getName());
- }
-
-
- // ***** class => file (.class or .java) *****
-
- /**
- * Convert a class name to a file name base for the current O/S;
- * e.g. "java.lang.String"
is converted to
- * "java/lang/String"
on Unix and
- * "java\\lang\\String"
on Windows.
- */
- public static String convertToFileNameBase(String className) {
- return className.replace('.', File.separatorChar);
- }
-
- /**
- * Convert a class to a file name base for the current O/S;
- * e.g. java.lang.String.class
is converted to
- * "java/lang/String"
on Unix and
- * "java\\lang\\String"
on Windows.
- */
- public static String convertToFileNameBase(Class> javaClass) {
- return convertToFileNameBase(javaClass.getName());
- }
-
- /**
- * Convert a class name to a class file name for the current O/S;
- * e.g. "java.lang.String"
is converted to
- * "java/lang/String.class"
on Unix and
- * "java\\lang\\String.class"
on Windows.
- */
- public static String convertToClassFileName(String className) {
- return convertToFileNameBase(className) + ".class"; //$NON-NLS-1$
- }
-
- /**
- * Convert a class to a class file name for the current O/S;
- * e.g. java.lang.String.class
is converted to
- * "java/lang/String.class"
on Unix and
- * "java\\lang\\String.class"
on Windows.
- */
- public static String convertToClassFileName(Class> javaClass) {
- return convertToClassFileName(javaClass.getName());
- }
-
- /**
- * Convert a class name to a class file for the current O/S;
- * e.g. "java.lang.String"
is converted to
- * File(java/lang/String.class)
.
- */
- public static File convertToClassFile(String className) {
- return new File(convertToClassFileName(className));
- }
-
- /**
- * Convert a class to a class file for the current O/S;
- * e.g. java.lang.String.class
is converted to
- * File(java/lang/String.class)
.
- */
- public static File convertToClassFile(Class> javaClass) {
- return convertToClassFile(javaClass.getName());
- }
-
- /**
- * Convert a class name to a java file name for the current O/S;
- * e.g. "java.lang.String"
is converted to
- * "java/lang/String.java"
on Unixl and
- * "java\\lang\\String.java"
on Windows.
- */
- public static String convertToJavaFileName(String className) {
- return convertToFileNameBase(className) + ".java"; //$NON-NLS-1$
- }
-
- /**
- * Convert a class to a java file name for the current O/S;
- * e.g. java.lang.String.class
is converted to
- * "java/lang/String.java"
on Unix and
- * "java\\lang\\String.java"
on Windows.
- */
- public static String convertToJavaFileName(Class> javaClass) {
- return convertToJavaFileName(javaClass.getName());
- }
-
- /**
- * Convert a class name to a java file for the current O/S;
- * e.g. "java.lang.String"
is converted to
- * File(java/lang/String.java)
.
- */
- public static File convertToJavaFile(String className) {
- return new File(convertToJavaFileName(className));
- }
-
- /**
- * Convert a class to a java file for the current O/S;
- * e.g. java.lang.String.class
is converted to
- * File(java/lang/String.java)
.
- */
- public static File convertToJavaFile(Class> javaClass) {
- return convertToJavaFile(javaClass.getName());
- }
-
-
- // ***** class => resource *****
-
- /**
- * Convert a class to a resource name;
- * e.g. java.lang.String.class
is converted to
- * "/java/lang/String.class"
.
- */
- public static String convertToResourceName(Class> javaClass) {
- return '/' + convertToArchiveClassFileEntryName(javaClass);
- }
-
- /**
- * Convert a class to a resource;
- * e.g. java.lang.String.class
is converted to
- * URL(jar:file:/C:/jdk/1.4.2_04/jre/lib/rt.jar!/java/lang/String.class)
.
- */
- public static URL convertToResource(Class> javaClass) {
- return javaClass.getResource(convertToResourceName(javaClass));
- }
-
-
- // ***** utilities *****
-
- /**
- * Return whether the specified file is an archive file;
- * i.e. its name ends with ".zip"
or ".jar"
.
- */
- public static boolean fileNameIsArchive(String fileName) {
- String ext = FileTools.extension(fileName).toLowerCase();
- return ext.equals(".jar") || ext.equals(".zip"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Return whether the specified file is an archive file;
- * i.e. its name ends with ".zip"
or ".jar"
.
- */
- public static boolean fileIsArchive(File file) {
- return fileNameIsArchive(file.getName());
- }
-
- /**
- * Return what should be the fully-qualified file name
- * for the JRE runtime JAR;
- * e.g. "C:\jdk1.4.2_04\jre\lib\rt.jar"
.
- */
- public static String rtJarName() {
- return locationFor(java.lang.Object.class);
- }
-
- /**
- * Return the location from where the specified class was loaded.
- */
- public static String locationFor(Class> javaClass) {
- URL url = convertToResource(javaClass);
- String path;
- try {
- path = FileTools.buildFile(url).getPath();
- } catch (URISyntaxException ex) {
- throw new RuntimeException(ex);
- }
- String protocol = url.getProtocol().toLowerCase();
- if (protocol.equals("jar")) { //$NON-NLS-1$
- // if the class is in a JAR, the URL will look something like this:
- // jar:file:/C:/jdk/1.4.2_04/jre/lib/rt.jar!/java/lang/String.class
- return path.substring(0, path.indexOf('!'));
- } else if (protocol.equals("file")) { //$NON-NLS-1$
- // if the class is in a directory, the URL will look something like this:
- // file:/C:/dev/main/mwdev/class/org/eclipse/dali/utility/Classpath.class
- return path.substring(0, path.length() - convertToClassFileName(javaClass).length() - 1);
- } else if (protocol.equals("bundleresource")) { //$NON-NLS-1$
- // if the class is in a bundle resource (Eclipse?), the URL will look something like this:
- // bundleresource://43/org/eclipse/dali/utility/Classpath.class
- return path.substring(0, path.length() - convertToClassFileName(javaClass).length() - 1);
- }
-
- throw new IllegalStateException(url.toString());
- }
-
- /**
- * Return the directories used by the Java Extension Mechanism.
- */
- public static File[] javaExtensionDirectories() {
- return convertToFiles(javaExtensionDirectoryNames());
- }
-
- /**
- * Return the directory names used by the Java Extension Mechanism.
- */
- public static String[] javaExtensionDirectoryNames() {
- return System.getProperty("java.ext.dirs").split(File.pathSeparator); //$NON-NLS-1$
- }
-
-
- // ***** internal *****
-
- private static File[] convertToFiles(String[] fileNames) {
- File[] files = new File[fileNames.length];
- for (int i = fileNames.length; i-- > 0; ) {
- files[i] = new File(fileNames[i]);
- }
- return files;
- }
-
- private static void addJarFileNamesTo(File dir, List jarFileNames) {
- File[] jarFiles = jarFilesIn(dir);
- for (File jarFile : jarFiles) {
- jarFileNames.add(FileTools.canonicalFile(jarFile).getPath());
- }
- }
-
- private static File[] jarFilesIn(File directory) {
- return directory.listFiles(jarFileFilter());
- }
-
- private static FileFilter jarFileFilter() {
- return new FileFilter() {
- public boolean accept(File file) {
- return FileTools.extension(file.getName()).toLowerCase().equals(".jar"); //$NON-NLS-1$
- }
- };
- }
-
-
- // ********** constructors **********
-
- /**
- * Construct a classpath with the specified entries.
- */
- private Classpath(Entry[] entries) {
- super();
- this.entries = entries;
- }
-
- /**
- * Construct a classpath with the specified entries.
- */
- public Classpath(String... fileNames) {
- this(buildEntries(fileNames));
- }
-
- /**
- * Skip empty file names because they will end up expanding to the current
- * working directory, which is not what we want. Empty file names actually
- * occur with some frequency; such as when the classpath has been built up
- * dynamically with too many separators. For example:
- * "C:\dev\foo.jar;;C:\dev\bar.jar"
- * will be parsed into three file names:
- * { "C:\dev\foo.jar", "", "C:\dev\bar.jar" }
- *
- */
- private static Entry[] buildEntries(String[] fileNames) {
- List entries = new ArrayList();
- for (String fileName : fileNames) {
- if ((fileName != null) && (fileName.length() != 0)) {
- entries.add(new Entry(fileName));
- }
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- /**
- * Construct a classpath with the specified path.
- */
- public Classpath(String path) {
- this(path.split(File.pathSeparator));
- }
-
- /**
- * Construct a classpath with the specified entries.
- */
- public Classpath(Iterable fileNames) {
- this(ArrayTools.array(fileNames, StringTools.EMPTY_STRING_ARRAY));
- }
-
- /**
- * Consolidate the specified classpaths into a single classpath.
- */
- public Classpath(Classpath... classpaths) {
- this(consolidateEntries(classpaths));
- }
-
- private static Entry[] consolidateEntries(Classpath[] classpaths) {
- List entries = new ArrayList();
- for (Classpath classpath : classpaths) {
- CollectionTools.addAll(entries, classpath.getEntries());
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
-
- // ********** public API **********
-
- /**
- * Return the classpath's entries.
- */
- public Iterable getEntries() {
- return new ArrayIterable(this.entries);
- }
-
- /**
- * Return the classpath's path.
- */
- public String getPath() {
- int max = this.entries.length - 1;
- if (max == -1) {
- return ""; //$NON-NLS-1$
- }
- StringBuilder sb = new StringBuilder(2000);
- // stop one short of the end of the array
- for (int i = 0; i < max; i++) {
- sb.append(this.entries[i].getFileName());
- sb.append(File.pathSeparatorChar);
- }
- sb.append(this.entries[max].getFileName());
- return sb.toString();
- }
-
- /**
- * Search the classpath for the specified (unqualified) file
- * and return its entry. Return null if an entry is not found.
- * For example, you could use this method to find the entry
- * for "rt.jar"
or "toplink.jar"
.
- */
- public Entry getEntryForFileNamed(String shortFileName) {
- for (Entry entry : this.entries) {
- if (entry.getFile().getName().equals(shortFileName)) {
- return entry;
- }
- }
- return null;
- }
-
- /**
- * Return the first entry file in the classpath
- * that contains the specified class.
- * Return null if an entry is not found.
- */
- public Entry getEntryForClassNamed(String className) {
- String relativeClassFileName = convertToClassFileName(className);
- String archiveEntryName = convertToArchiveClassFileEntryName(className);
- for (Entry entry : this.entries) {
- if (entry.contains(relativeClassFileName, archiveEntryName)) {
- return entry;
- }
- }
- return null;
- }
-
- /**
- * Return the names of all the classes discovered on the classpath,
- * with duplicates removed.
- * @see #classNames()
- */
- public Iterable getClassNames() {
- return this.getClassNames(Filter.Null.instance());
- }
-
- /**
- * Return the names of all the classes discovered on the classpath
- * and accepted by the specified filter, with duplicates removed.
- * @see #classNames(Filter)
- */
- public Iterable getClassNames(Filter filter) {
- Collection classNames = new HashSet(10000);
- this.addClassNamesTo(classNames, filter);
- return classNames;
- }
-
- /**
- * Add the names of all the classes discovered on the classpath
- * to the specified collection.
- */
- public void addClassNamesTo(Collection classNames) {
- this.addClassNamesTo(classNames, Filter.Null.instance());
- }
-
- /**
- * Add the names of all the classes discovered on the classpath
- * and accepted by the specified filter to the specified collection.
- */
- public void addClassNamesTo(Collection classNames, Filter filter) {
- for (Entry entry : this.entries) {
- entry.addClassNamesTo(classNames, filter);
- }
- }
-
- /**
- * Return the names of all the classes discovered on the classpath.
- * Just a bit more performant than {@link #getClassNames()}.
- */
- public Iterator classNames() {
- return this.classNames(Filter.Null.instance());
- }
-
- /**
- * Return the names of all the classes discovered on the classpath
- * that are accepted by the specified filter.
- * Just a bit more performant than {@link #getClassNames(Filter)}.
- */
- public Iterator classNames(Filter filter) {
- return new CompositeIterator(this.entryClassNamesIterators(filter));
- }
-
- private Iterator> entryClassNamesIterators(final Filter filter) {
- return new TransformationIterator>(new ArrayIterator(this.entries)) {
- @Override
- protected Iterator transform(Entry entry) {
- return entry.classNames(filter);
- }
- };
- }
-
- /**
- * Return a "compressed" version of the classpath with its
- * duplicate entries eliminated.
- */
- public Classpath compressed() {
- return new Classpath(ArrayTools.removeDuplicateElements(this.entries));
- }
-
- /**
- * Convert the classpath to an array of URLs
- * (that can be used to instantiate a {@link java.net.URLClassLoader}).
- */
- public Iterable getURLs() {
- int len = this.entries.length;
- URL[] urls = new URL[len];
- for (int i = 0; i < len; i++) {
- urls[i] = this.entries[i].getURL();
- }
- return new ArrayIterable(urls);
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.getPath());
- }
-
-
- // ********** inner class **********
-
- /**
- * Entry
models a Java classpath entry, which can be either a
- * directory containing .class
files or a JAR file (or,
- * similarly, a .zip
file). The entry can return the names of
- * classes found in it etc.
- */
- public static class Entry implements Serializable {
- private final String fileName;
- private final File file;
- private final File canonicalFile;
-
- private static final long serialVersionUID = 1L;
-
- Entry(String fileName) {
- super();
- if ((fileName == null) || (fileName.length() == 0)) {
- throw new IllegalArgumentException("'fileName' must be non-empty"); //$NON-NLS-1$
- }
- this.fileName = fileName;
- this.file = new File(fileName);
- this.canonicalFile = FileTools.canonicalFile(this.file);
- }
-
- public String getFileName() {
- return this.fileName;
- }
-
- public File getFile() {
- return this.file;
- }
-
- public File getCanonicalFile() {
- return this.canonicalFile;
- }
-
- public String getCanonicalFileName() {
- return this.canonicalFile.getAbsolutePath();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( ! (o instanceof Entry)) {
- return false;
- }
- return ((Entry) o).canonicalFile.equals(this.canonicalFile);
- }
-
- @Override
- public int hashCode() {
- return this.canonicalFile.hashCode();
- }
-
- /**
- * Return the entry's "canonical" URL.
- */
- public URL getURL() {
- try {
- return this.canonicalFile.toURI().toURL();
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * Return whether the entry contains the specified class.
- */
- public boolean contains(Class> javaClass) {
- return this.contains(javaClass.getName());
- }
-
- /**
- * Return whether the entry contains the specified class.
- */
- public boolean contains(String className) {
- return this.contains(convertToClassFileName(className), convertToArchiveClassFileEntryName(className));
- }
-
- /**
- * Return whether the entry contains either the specified relative
- * class file or the specified archive entry.
- * Not the prettiest signature, but it's internal....
- */
- boolean contains(String relativeClassFileName, String archiveEntryName) {
- if ( ! this.canonicalFile.exists()) {
- return false;
- }
- if (this.canonicalFile.isDirectory() && (new File(this.canonicalFile, relativeClassFileName)).exists()) {
- return true;
- }
- return (fileIsArchive(this.canonicalFile) && this.archiveContainsEntry(archiveEntryName));
- }
-
- /**
- * Return whether the entry's archive contains the specified entry.
- */
- private boolean archiveContainsEntry(String zipEntryName) {
- ZipFile zipFile = null;
- ZipEntry zipEntry = null;
- try {
- zipFile = new ZipFile(this.canonicalFile);
- zipEntry = zipFile.getEntry(zipEntryName);
- } catch (IOException ex) {
- // something is wrong, leave the entry null
- } finally {
- try {
- if (zipFile != null) {
- zipFile.close();
- }
- } catch (IOException ex) {
- zipEntry = null; // something is wrong, clear out the entry
- }
- }
- return zipEntry != null;
- }
-
- /**
- * Return the names of all the classes discovered in the entry.
- * @see #classNames()
- */
- public Iterable getClassNames() {
- return this.getClassNames(Filter.Null.instance());
- }
-
- /**
- * Return the names of all the classes discovered in the entry
- * and accepted by the specified filter.
- * @see #classNames(Filter)
- */
- public Iterable getClassNames(Filter filter) {
- Collection classNames = new ArrayList(2000);
- this.addClassNamesTo(classNames, filter);
- return classNames;
- }
-
- /**
- * Add the names of all the classes discovered in the entry
- * to the specified collection.
- */
- public void addClassNamesTo(Collection classNames) {
- this.addClassNamesTo(classNames, Filter.Null.instance());
- }
-
- /**
- * Add the names of all the classes discovered in the entry
- * and accepted by the specified filter to the specified collection.
- */
- public void addClassNamesTo(Collection classNames, Filter filter) {
- if (this.canonicalFile.exists()) {
- if (this.canonicalFile.isDirectory()) {
- this.addClassNamesForDirectoryTo(classNames, filter);
- } else if (fileIsArchive(this.canonicalFile)) {
- this.addClassNamesForArchiveTo(classNames, filter);
- }
- }
- }
-
- /**
- * Add the names of all the classes discovered
- * under the entry's directory and accepted by
- * the specified filter to the specified collection.
- */
- private void addClassNamesForDirectoryTo(Collection classNames, Filter filter) {
- int start = this.canonicalFile.getAbsolutePath().length() + 1;
- for (Iterator stream = this.classFilesForDirectory(); stream.hasNext(); ) {
- String className = convertToClassName(stream.next().getAbsolutePath().substring(start));
- if (filter.accept(className)) {
- classNames.add(className);
- }
- }
- }
-
- /**
- * Return an iterator on all the class files discovered
- * under the entry's directory.
- */
- private Iterator classFilesForDirectory() {
- return new FilteringIterator(FileTools.filesInTree(this.canonicalFile)) {
- @Override
- protected boolean accept(File next) {
- return Entry.this.fileNameMightBeForClassFile(next.getName());
- }
- };
- }
-
- /**
- * Add the names of all the classes discovered
- * in the entry's archive file and accepted by the
- * specified filter to the specified collection.
- */
- private void addClassNamesForArchiveTo(Collection classNames, Filter filter) {
- ZipFile zipFile = null;
- try {
- zipFile = new ZipFile(this.canonicalFile);
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- for (Enumeration extends ZipEntry> stream = zipFile.entries(); stream.hasMoreElements(); ) {
- ZipEntry zipEntry = stream.nextElement();
- String zipEntryName = zipEntry.getName();
- if (this.fileNameMightBeForClassFile(zipEntryName)) {
- String className = convertToClassName(zipEntryName);
- if (filter.accept(className)) {
- classNames.add(className);
- }
- }
- }
- try {
- zipFile.close();
- } catch (IOException ex) {
- return;
- }
- }
-
- /**
- * Return whether the specified file might be a Java class file.
- * The file name must at least end with ".class"
and contain no spaces.
- * (Neither class names nor package names may contain spaces.)
- * Whether it actually is a class file will need to be determined by
- * a class loader.
- */
- boolean fileNameMightBeForClassFile(String name) {
- return FileTools.extension(name).toLowerCase().equals(".class") //$NON-NLS-1$
- && (name.indexOf(' ') == -1);
- }
-
- /**
- * Return the names of all the classes discovered on the classpath.
- * Just a bit more performant than {@link #getClassNames()}.
- */
- public Iterator classNames() {
- return this.classNames(Filter.Null.