Commit Graph

4104 Commits

Author SHA1 Message Date
Costin Manolache b73b147176 Fix the name - the file in CVS is called LICENCE.txt.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130753 13f79535-47bb-0310-9956-ffa450edef68
2002-07-25 18:08:05 +00:00
Jason van Zyl 26712251ba o getting the tests to work by removing the last non-testcase class.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130752 13f79535-47bb-0310-9956-ffa450edef68
2002-07-25 03:18:04 +00:00
Jason van Zyl 4ebf207d4d o cleaning up the maven descriptors for the projects so that a site
with decent names is generated (link to come)

o made all the projects use a LICENSE.txt file. one this doesn't wig
  out windows users and the checkstyle report likes to have one to
  make sure that all sources files have a license present so if they
  don't it can be reported.

o using the reactor tag in its first forms to provide a mechanism
  to build the entire commons (still problems with detecting
  JDK 1.4) and to generate a site where the navigation is gleaned
  from the project themselves and don't have to kept in sync
  manually.

o added a little front-end site deployer.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130751 13f79535-47bb-0310-9956-ffa450edef68
2002-07-25 02:36:45 +00:00
Jason van Zyl 87341f1984 o excluding all non-testcases so that the tests pass
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130750 13f79535-47bb-0310-9956-ffa450edef68
2002-07-24 06:09:19 +00:00
Jason van Zyl 62a4ae05ab o adding project.xml and maven.xml. these don't work yet as the <build/>
element will have to be change.

  this is an example of the differences in testing patterns. The
  FooBarTestCase.java used in beanutils provides a nice way to grab
  on to the tests while leaving test classes out of the picture while
  not having to explicitly write a TestAll running. So with the
  introduction of a nice pattern that is used in Bean utils you don't
  need a runner and test classes will be ommitted and you can just add
  test cases and go, no need to modify anything else.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130749 13f79535-47bb-0310-9956-ffa450edef68
2002-07-23 16:41:11 +00:00
Michael Smith 693659db99 Add documentation indicating that the Bag interface violates the Collection
interface.

Submitted by: Paul Jack


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130748 13f79535-47bb-0310-9956-ffa450edef68
2002-07-19 01:15:01 +00:00
Rodney Waldhoff 2d1bbdb5aa add no-arg constructor
fix method name
add some javadoc comments


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130747 13f79535-47bb-0310-9956-ffa450edef68
2002-07-10 14:06:39 +00:00
Michael Smith 84fbbbcef1 Improved class level javadoc.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130746 13f79535-47bb-0310-9956-ffa450edef68
2002-07-10 03:35:32 +00:00
Rodney Waldhoff 32487bf55b add CollatingIterator and tests
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130745 13f79535-47bb-0310-9956-ffa450edef68
2002-07-09 16:48:56 +00:00
Michael Smith cee7a2c322 Update naming convention to be a bit more relaxed on decorator method names
(e.g. allow unmodifiableBuffer as an allowed decorator name)


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130744 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 02:34:09 +00:00
Michael Smith 5248e3fb4a Fixed javadoc links.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130743 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 02:16:48 +00:00
Michael Smith c2307801a0 ArrayStack and BinaryHeap now implement Buffer.
Submitted by: Paul Jack


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130742 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 02:09:06 +00:00
Michael Smith 6cf2dc519e Added proper license.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130741 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 01:59:50 +00:00
Michael Smith 9f3b7f5f43 Add Buffer implementations, utilities, and tests.
BoundedFifoBuffer is renamed from Avalon's FixedSizeBuffer. Made it extend
AbstractCollection, provided an iterator. Removed "final" from class and method
declarations. Added javadoc.

UnboundedFifoBuffer is renamed from Avalon's VariableSizeBuffer. Made it extend
AbstractCollection, provided an iterator. Removed "final" from class and method
delcarations. Added javadoc.

BufferUtils provides Buffer decorators for synchronized, unmodifiable, and
predicated Buffers.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130740 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 01:57:08 +00:00
Michael Smith 6f35a6f718 Fix license to approved long form.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130739 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 01:45:47 +00:00
Michael Smith 8c21747867 Added Buffer interface from Avalon Excaliber.
Modified the interface from Avalon so that it (a) defines a read-only get()
method and (b) extends java.util.Collection. Also altered the documentation so
that the scope of the interface is broader; it can apply to stacks, heaps and
LRU caches as well.

Submitted by: Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130738 13f79535-47bb-0310-9956-ffa450edef68
2002-07-03 01:44:04 +00:00
Michael Smith 69c5c0e07f Formalize naming conventions proposal.
Submitted by: Stephen Colebourne

I made a few minor modifications (e.g. adding </li> tags), along with modifying
the requirement of static inner classes for the decorators to be more in line
with my perception of consensus from the discussion.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130737 13f79535-47bb-0310-9956-ffa450edef68
2002-06-29 03:49:01 +00:00
Michael Smith 39dd7c6f92 Added BucketMap, renamed to StaticBucketMap, from Avalon Excaliber. I made the
following changes to the Avalon implementation:

Changed improper short form of license to the approved long form.

Changed package from org.apache.avalon.excaliber.collections to
org.apache.commons.collections.

Altered to allow null keys and null values.

Fixed the values() method to return all values from the map.  That is, when a
particular value is mapped to from two different keys, it should be included
twice in the values() collection; however the avalon implementation was using a
Set (thus not including duplicates). The new implementation uses a list which
does not restrict duplicate elements.

Fixed the put(Object,Object) method to return null rather than the value being
put into the map when the key does not already exist in the map (per the Map
contract).

Added equals(Object) and hashCode() implementations to conform to the Map
contract.

Altered the Node inner class's hashCode() method to return the hashCode of the
Map.Entry as defined in the Map.Entry's contract.

Added an equals(Object) method to the Node inner class to conform to the
Map.Entry contract.


Things left todo:

Alter the keySet(), values(), and entrySet() methods to return collections that
are backed by the map per the Map contract.

Add a constructor that takes another Map and adds all the mappings from that
map (per the Map recommendation).

Implement a DynamicBucketMap that will allow for dynamic resizing of the
hashtable's structure such that the map will not suffer a performance penalty
when the number of elements in the map exceeds the number of buckets in the
map.

Improve the documentation to indicate the performance problems when specifying
a size that is smaller than the expected number of elements.

Other general documentation cleanup


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130736 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 06:17:45 +00:00
Michael Smith 9752389b61 Made the TestCases for primitive lists extend TestList,
so the full suite of List tests is performed on them.
Used BulkTest.makeSuite to pick up the sublist tests.

There should probably be additional work for testing the
primitive operations.

Submitted by: Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130735 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 04:01:31 +00:00
Michael Smith c3a859c1ce FloatArrayList didn't implement set(int,Object) or remove(int),
essentially making it an unmodifiable List.  Since setFloat(int,float)
and removeFloatAt(int) already existed, I added trivial
implementations for set(int,Object) and remove(int).

Submitted by: Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130734 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 03:50:40 +00:00
Michael Smith f96c2305fa Enable the bulk tests in TestArrayStack,
TestFastArrayList, TestFastArrayList1.

Submitted by:  Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130733 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 03:33:28 +00:00
Michael Smith 831f19ee73 Removed the deprecated method from TestCollection, as no one uses
it anymore.

Modified TestCursorableLinkedList so that serialization tests on
sublists and sub-sublists are ignored.

Submitted by:  Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130732 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 03:32:06 +00:00
Michael Smith 5b3f6003c5 TestList tests have been rewritten to conform to the general
TestCollection patterns.  A bulk test has been included for
sublists and sub-sublists.

Removed the deprecated method from TestCollection, as no one uses
it anymore.

Modified TestCursorableLinkedList so that serialization tests on
sublists and sub-sublists are ignored.

Submitted by:  Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130731 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 03:28:54 +00:00
Michael Smith 4ab1ffccbe The indexOf(Object) and lastIndexOf(Object) were incorrectly
raising a NullPointerException if null were passed as the argument.
This patch file fixes the behavior so that these methods will
correctly find a null element.

Submitted by: Paul Jack ( pjack at sfaf dot org )


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130730 13f79535-47bb-0310-9956-ffa450edef68
2002-06-21 03:26:15 +00:00
Henri Yandell f405dbaea6 Added a start and end index to the ArrayIterator. Unit tests also added and
currently passing.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130729 13f79535-47bb-0310-9956-ffa450edef68
2002-06-20 02:51:18 +00:00
Michael Smith 486972dbc7 Remove use of TestHashMap which didn't really test anything that isn't
already tested in TestMap.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130728 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 05:41:11 +00:00
Michael Smith 02c0d12fca Enabled the new test framework in the following test classes:
- TestBeanMap
 - TestCursorableLinkedList
 - TestDoubleOrderedMap
 - TestFastHashMap
 - TestFastHashMap1
 - TestFastTreeMap
 - TestFastTreeMap1
 - TestLRUMap
 - TestSequencedHashMap
 - TestSoftRefHashMap

Submitted by Paul Jack ( pjack at sfaf dot org ).

Note: TestAll does not contain reference to TestSoftRefHashMap, so this test is
not automatically run.  If you run it manually, you will see many failures that
are due to bug 9571.

Note: With this commit, there are four test failures if you are running with
JDK 1.2.  This is due to a bug in the JDK's implementation of keySet on a
HashMap which incorrectly returns false after removing a mapping which maps a
key to a null value.  Incidently, this problem is very similar to the problem
that existed on SequencedHashMap, filed as bug 9719, and fixed on June 9th.
See: http://developer.java.sun.com/developer/bugParade/bugs/4286765.html


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130727 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 05:35:58 +00:00
Michael Smith 326f500bb3 Modified tests that used makeEmptyMap and makeFullMap to use the map field
along with resetEmpty() and resetFull().  This allows for more calls to verify
to ensure that calls to methods that should not modify a collection don't
actually modify it.

Split the verify() method into four separate verification methods.  This way,
if a Map implementation needs to change the way verification is performed for
just one of the collection views, they only need to override one method and
won't need to reimplement all the other verifications.

Override TestMultiHashMap's verifyValues() method to retrieve a fresh copy of
the values collection before verification.  This ensures some verification
testing on the values, even though the values is not backed by the map (bug
9573)

Override a few more test methods and the verifyyMap and verifyEntrySet methods
for TestMultiHashMap since it's values are collections rather than the expected
objects.  These will need to be filled in with better implementations to
actually test the MultiMap contact.

Removed the SupportsPut marker interface.

Removed some duplicate tests (i.e. some old tests that weren't written with the
current framework in mind and just duplicate the tests that have been added).


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130726 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 03:28:35 +00:00
Michael Smith be0b62cfc3 Enhanced TestMap to more completely test the Map contract.
Submitted by: Paul Jack ( pjack at sfaf dot org ).

Needed to change Paul's implementation slightly to get things compile properly
using JDK 1.2.  The 1.2 compiler thought that the "confirmed" field was
ambiguous in the anonymous inner class and thus needed to be qualified with a
ClassName.this.  In order to do that, the anonymous inner classes needed to be
made named inner classes.

This change exposes one test failure for MultiHashMap that appears to be caused
by its values() method not being backed by the map (bug 9573).


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130725 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 03:17:34 +00:00
Michael Smith 6b825d40c2 Made the makeCollection and makeFullCollection methods final since set tests
should use makeEmptySet and makeFullSet rather than their collection
counterparts.

Added getSet() and getConfirmedSet() methods which wrap the collection and
confirmed fixtures so that tests don't need to perform the cast to a Set.

Modified tests that used makeEmptySet and makeFullSet to use the fixture
getSet() along with resetEmpty() and resetFull().  This allows for more calls
to verify() to ensure that calls to methods that should not modify a
collection don't actually modify it.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130724 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 03:06:45 +00:00
Michael Smith 45b1116ed9 Added new TestSet class, extending the TestCollection class to test the
complete Set contract.  This will be used to test Set implementations and set
views of other collections (e.g. Map.entrySet() and Map.keySet()).

Submitted by: Paul Jack ( pjack at sfaf dot org ).


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130723 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 02:58:28 +00:00
Michael Smith 10e245918f Renamed supportsAdd and supportsRemove to isAddSupported and isRemoveSupported.
Removed commented out tests for equals and hashCode (the collection contract
does not specify a specific contract on equals and hashCode), and added a
comment at the top of the class so that no one comes in later and re-adds the
test cases.

Removed dependence on HashBag.  If HashBag has a bug, this may adversly affect
the tests that are using it.  Reimplemented without using HashBag.

Modified tests that used makeFullCollection and makeCollection to use the
fixture field "collection" along with resetEmpty() and resetFull().  This
allowed for more calls to verify to ensure that calls to methods that should
not modify a collection don't actually modify it.

When removing using the iterator, an equivalent operation cannot really be
performed on the confirmed collection for verification.  After some
investigation, changed the existing tests (tested for instances of Set, List
and Bag) to one that is a bit more generic: A new flag (that test subclasses
can override) which specifies whether the elements in the collection are
distinguishable from each other (and such that it might matter which element is
actually removed from the collection when the iterator's remove method is
called).


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130722 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 02:51:12 +00:00
Michael Smith b79307f302 Enhanced TestCollection to more completely test the Collection contract. This
will be used to test straight Collection implementations and for collection
views of other collections (e.g. Map.values()).

Submitted by: Paul Jack ( pjack at sfaf dot org ).

Changed TestBag to extend from TestObject instead of TestCollection since the
Bag contract conflicts with the Collection contract.  This needs to be
addressed at some point.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130721 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 01:14:23 +00:00
Michael Smith aed28e1dd2 Added framework to modularize collections tests such the testing code used for
testing collections, maps, etc., can be reused to test collections, maps,
etc. that are returned from other collections.  For example, the Map interface
defines entrySet() which is supposed to return a valid Set.  The framework
added here would allow the Set testing code to be used for testing Sets and the
set returned from Map's entrySet() method.

Submitted by: Paul Jack < pjack at sfaf dot org >


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130720 13f79535-47bb-0310-9956-ffa450edef68
2002-06-18 01:04:03 +00:00
Michael Smith d74c53cd0d Add a toString() to aid in debugging.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130719 13f79535-47bb-0310-9956-ffa450edef68
2002-06-16 18:56:19 +00:00
Michael Smith c28176cb14 Fixed javadoc warnings, most of which only appear with javadoc 1.4. I
really don't understand why javadoc likes references to inner classes in
some cases, but in others, it requires it to be fully qualified.  This
fixes all the warnings reported though.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130718 13f79535-47bb-0310-9956-ffa450edef68
2002-06-16 03:39:40 +00:00
Michael Smith e9f2bdc6a5 Fix NullPointerException in CursorableLinkedList.remove(Object) and
CursorableLinkedList.contains(Object) methods when the argument is
null.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130717 13f79535-47bb-0310-9956-ffa450edef68
2002-06-15 03:52:24 +00:00
Michael Smith 5fe503ec59 Renamed nullFirst and nullLast to nullLow and nullHigh. "First" and
"Last" don't really mean mcuh in the context of comparing two items.
Especially if you consider the comparator being used for a maximum
heap.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130716 13f79535-47bb-0310-9956-ffa450edef68
2002-06-12 04:28:22 +00:00
Michael Smith 404ad88cdc Added @since tags for classes introduced in the 1.0 and 2.0
collection releases.  I did not add @since tags to classes
added since the 2.0 release, because I'm not certain whether
the next release will be 2.1 or 3.0 or whatever.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130715 13f79535-47bb-0310-9956-ffa450edef68
2002-06-12 03:59:17 +00:00
James Strachan b8766d82a6 applied Paul Jacks' patch for a number of helper methods for working with Comparators.
This can help avoid folks having to use the o.a*.c*.collections.comparators package, providing nice simple static helper method instead along the same lines as java.util.Collections and CollectionUtils here.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130714 13f79535-47bb-0310-9956-ffa450edef68
2002-06-11 16:22:06 +00:00
Michael Smith b8dc22933b Fix email address links.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130713 13f79535-47bb-0310-9956-ffa450edef68
2002-06-11 02:41:47 +00:00
Michael Smith 8fdad7215b Add some collections that were missing from the package
documentation.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130712 13f79535-47bb-0310-9956-ffa450edef68
2002-06-11 02:40:52 +00:00
Michael Smith c8e641739a Fixed typo.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130711 13f79535-47bb-0310-9956-ffa450edef68
2002-06-10 05:33:53 +00:00
Michael Smith e02e354300 Added a comparator that provides explicit control over comparisons with null.
This can be used to create SortedSets or other sorted collections where nulls
are sorted first or last.  The basis for this comparator was this discussion on
the commons mailing list:

http://www.mail-archive.com/commons-dev%40jakarta.apache.org/msg07762.html


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130710 13f79535-47bb-0310-9956-ffa450edef68
2002-06-09 19:23:53 +00:00
Michael Smith c1cdfa611c Fix for bug 9719.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130709 13f79535-47bb-0310-9956-ffa450edef68
2002-06-09 07:14:14 +00:00
James Strachan bde0d09c4c Added Jonathan Carlson's patch for a Comparator that uses a Transformer
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130708 13f79535-47bb-0310-9956-ffa450edef68
2002-06-08 06:42:00 +00:00
Rodney Waldhoff d7f1ac38d0 add FloatArrayList and test
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130707 13f79535-47bb-0310-9956-ffa450edef68
2002-06-04 16:50:09 +00:00
Rodney Waldhoff 61cf43c0e7 add primitive collections, and tests
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130706 13f79535-47bb-0310-9956-ffa450edef68
2002-06-04 16:01:28 +00:00
Arron Claude Bates 26fbf88577 fixed List growing issue.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130705 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 03:22:42 +00:00
Arron Claude Bates 2dd5130b2c initial commit.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130704 13f79535-47bb-0310-9956-ffa450edef68
2002-05-29 02:57:41 +00:00