Author: tabish
Date: Sat Feb 14 02:38:38 2009
New Revision: 744373
URL: http://svn.apache.org/viewvc?rev=744373&view=rev
Log:
Further implementation of the Decaf Collections API
Added:
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractList.h (with
props)
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractMap.h (with props)
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractQueue.h (with
props)
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSequentialList.h
(with props)
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSet.h (with props)
Modified:
activemq/activemq-cpp/trunk/src/main/Makefile.am
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractCollection.h
activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h
activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h
activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h
activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h
Modified: activemq/activemq-cpp/trunk/src/main/Makefile.am
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/Makefile.am?rev=744373&r1=744372&r2=744373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/main/Makefile.am Sat Feb 14 02:38:38 2009
@@ -367,6 +367,10 @@
decaf/util/Iterator.h \
decaf/util/ListIterator.h \
decaf/util/AbstractCollection.h \
+ decaf/util/AbstractList.h \
+ decaf/util/AbstractSequentialList.h \
+ decaf/util/AbstractSet.h \
+ decaf/util/AbstractMap.h \
decaf/util/Collection.h \
decaf/util/Comparator.h \
decaf/util/List.h \
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractCollection.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractCollection.h?rev=744373&r1=744372&r2=744373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractCollection.h
(original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractCollection.h Sat
Feb 14 02:38:38 2009
@@ -26,6 +26,7 @@
#include <decaf/util/Iterator.h>
#include <decaf/util/Collection.h>
#include <decaf/util/concurrent/Synchronizable.h>
+#include <decaf/util/concurrent/Mutex.h>
#include <memory>
namespace decaf {
@@ -54,7 +55,11 @@
* @since 1.0
*/
template< typename E >
- class AbstractCollection : public decaf::util::Collection<E> {
+ class DECAF_API AbstractCollection : public decaf::util::Collection<E> {
+ protected:
+
+ util::concurrent::Mutex mutex;
+
public:
virtual ~AbstractCollection() {}
@@ -200,6 +205,32 @@
return valueArray;
}
+ public:
+
+ virtual void lock() throw( lang::Exception ) {
+ mutex.lock();
+ }
+
+ virtual void unlock() throw( lang::Exception ) {
+ mutex.unlock();
+ }
+
+ virtual void wait() throw( lang::Exception ) {
+ mutex.wait();
+ }
+
+ virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
+ mutex.wait( millisecs );
+ }
+
+ virtual void notify() throw( lang::Exception ) {
+ mutex.notify();
+ }
+
+ virtual void notifyAll() throw( lang::Exception ) {
+ mutex.notifyAll();
+ }
+
};
}}
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractList.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractList.h?rev=744373&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractList.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractList.h Sat Feb 14
02:38:38 2009
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_ABSTRACTLIST_H_
+#define _DECAF_UTIL_ABSTRACTLIST_H_
+
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/Iterable.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/List.h>
+#include <memory>
+
+namespace decaf {
+namespace util {
+
+ /**
+ * This class provides a skeletal implementation of the List interface to
minimize
+ * the effort required to implement this interface backed by a "random
access" data
+ * store (such as an array). For sequential access data (such as a linked
list),
+ * AbstractSequentialList should be used in preference to this class.
+ *
+ * To implement an unmodifiable list, the programmer needs only to extend
this class
+ * and provide implementations for the get(int) and size() methods.
+ *
+ * To implement a modifiable list, the programmer must additionally
override the
+ * set(int, E) method (which otherwise throws an
UnsupportedOperationException). If
+ * the list is variable-size the programmer must additionally override the
add(int, E)
+ * and remove(int) methods.
+ *
+ * The programmer should generally provide a void (no argument) and
collection
+ * constructor, as per the recommendation in the Collection interface
specification.
+ *
+ * Unlike the other abstract collection implementations, the programmer
does not have
+ * to provide an iterator implementation; the iterator and list iterator
are implemented
+ * by this class, on top of the "random access" methods: get(int),
set(int, E),
+ * add(int, E) and remove(int).
+ *
+ * The documentation for each non-abstract method in this class describes
its
+ * implementation in detail. Each of these methods may be overridden if
the collection
+ * being implemented admits a more efficient implementation.
+ *
+ * @since 1.0
+ */
+ template< typename E >
+ class DECAF_API AbstractList : public decaf::util::List<E> {
+ public:
+
+ virtual ~AbstractList() {}
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTLIST_H_ */
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractList.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractMap.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractMap.h?rev=744373&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractMap.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractMap.h Sat Feb 14
02:38:38 2009
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_ABSTRACTMAP_H_
+#define _DECAF_UTIL_ABSTRACTMAP_H_
+
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/Map.h>
+#include <decaf/util/Set.h>
+#include <memory>
+
+namespace decaf {
+namespace util {
+
+ /**
+ * This class provides a skeletal implementation of the Map interface, to
minimize the
+ * effort required to implement this interface.
+ *
+ * To implement an unmodifiable map, the programmer needs only to extend
this class and
+ * provide an implementation for the entrySet method, which returns a
set-view of the
+ * map's mappings. Typically, the returned set will, in turn, be
implemented atop
+ * AbstractSet. This set should not support the add or remove methods, and
its iterator
+ * should not support the remove method.
+ *
+ * To implement a modifiable map, the programmer must additionally
override this class's
+ * put method (which otherwise throws an UnsupportedOperationException),
and the iterator
+ * returned by entrySet().iterator() must additionally implement its
remove method.
+ *
+ * The programmer should generally provide a void (no argument) and map
constructor, as
+ * per the recommendation in the Map interface specification.
+ *
+ * The documentation for each non-abstract method in this class describes
its
+ * implementation in detail. Each of these methods may be overridden if
the map being
+ * implemented admits a more efficient implementation.
+ *
+ * @since 1.0
+ */
+ template< typename K, typename V, typename COMPARATOR>
+ class AbstractMap : public decaf::util::Map<K, V, COMPARATOR> {
+ public:
+
+ virtual ~AbstractMap() {}
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTMAP_H_ */
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractMap.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractQueue.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractQueue.h?rev=744373&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractQueue.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractQueue.h Sat Feb 14
02:38:38 2009
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ABSTRACTQUEUE_H_
+#define ABSTRACTQUEUE_H_
+
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/Iterable.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/Queue.h>
+#include <memory>
+
+namespace decaf {
+namespace util {
+
+ /**
+ * This class provides skeletal implementations of some Queue operations.
+ * Methods add, remove, and element are based on offer, poll, and peek,
respectively
+ * but throw exceptions instead of indicating failure via false or null
returns.
+ *
+ * A Queue implementation that extends this class must minimally define a
method Queue.
+ * offer(E) which does not permit insertion of null elements, along with
methods Queue.
+ * peek(), Queue.poll(), Collection.size(), and a Collection.iterator()
supporting
+ * Iterator.remove(). Typically, additional methods will be overridden as
well. If these
+ * requirements cannot be met, consider instead subclassing
AbstractCollection.
+ *
+ * @since 1.0
+ */
+ template< typename E >
+ class DECAF_API AbstractQueue : public decaf::util::Queue<E> {
+ public:
+
+ virtual ~AbstractQueue() {}
+
+ };
+
+}}
+
+#endif /* ABSTRACTQUEUE_H_ */
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractQueue.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSequentialList.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSequentialList.h?rev=744373&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSequentialList.h
(added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSequentialList.h
Sat Feb 14 02:38:38 2009
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_ABSTRACTSEQUENTIALLIST_H_
+#define _DECAF_UTIL_ABSTRACTSEQUENTIALLIST_H_
+
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/Iterable.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/AbstractList.h>
+#include <memory>
+
+namespace decaf {
+namespace util {
+
+ /**
+ * This class provides a skeletal implementation of the List interface to
minimize
+ * the effort required to implement this interface backed by a "sequential
access"
+ * data store (such as a linked list). For random access data (such as an
array),
+ * AbstractList should be used in preference to this class.
+ *
+ * This class is the opposite of the AbstractList class in the sense that
it implements
+ * the "random access" methods (get(int index), set(int index, E element),
add(int index,
+ * E element) and remove(int index)) on top of the list's list iterator,
instead of the
+ * other way around.
+ *
+ * To implement a list the programmer needs only to extend this class and
provide
+ * implementations for the listIterator and size methods. For an
unmodifiable list, the
+ * programmer need only implement the list iterator's hasNext, next,
hasPrevious,
+ * previous and index methods.
+ *
+ * For a modifiable list the programmer should additionally implement the
list iterator's
+ * set method. For a variable-size list the programmer should additionally
implement the
+ * list iterator's remove and add methods.
+ *
+ * The programmer should generally provide a void (no argument) and
collection constructor,
+ * as per the recommendation in the Collection interface specification.
+ *
+ * @since 1.0
+ */
+ template< typename E >
+ class DECAF_API AbstractSequentialList : public decaf::util::AbstractList {
+ public:
+
+ virtual ~AbstractSequentialList() {}
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTSEQUENTIALLIST_H_ */
Propchange:
activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSequentialList.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSet.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSet.h?rev=744373&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSet.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSet.h Sat Feb 14
02:38:38 2009
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _DECAF_UTIL_ABSTRACTSET_H_
+#define _DECAF_UTIL_ABSTRACTSET_H_
+
+#include <decaf/util/Config.h>
+#include <decaf/lang/exceptions/UnsupportedOperationException.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/lang/Iterable.h>
+#include <decaf/util/Iterator.h>
+#include <decaf/util/Set.h>
+#include <memory>
+
+namespace decaf {
+namespace util {
+
+ /**
+ * This class provides a skeletal implementation of the Set interface to
minimize the
+ * effort required to implement this interface.
+ *
+ * The process of implementing a set by extending this class is identical
to that of
+ * implementing a Collection by extending AbstractCollection, except that
all of the
+ * methods and constructors in subclasses of this class must obey the
additional
+ * constraints imposed by the Set interface (for instance, the add method
must not
+ * permit addition of multiple instances of an object to a set).
+ *
+ * Note that this class does not override any of the implementations from
the
+ * AbstractCollection class. It merely adds implementations for equals and
removeAll.
+ */
+ template<typename E >
+ class DECAF_API AbstractSet : public decaf::util::Set<E> {
+ public:
+
+ virtual ~AbstractSet() {}
+
+ };
+
+}}
+
+#endif /* _DECAF_UTIL_ABSTRACTSET_H_ */
Propchange: activemq/activemq-cpp/trunk/src/main/decaf/util/AbstractSet.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h?rev=744373&r1=744372&r2=744373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Queue.h Sat Feb 14 02:38:38
2009
@@ -19,7 +19,7 @@
#include <decaf/util/Config.h>
#include <decaf/util/Iterator.h>
-#include <decaf/util/Collection.h>
+#include <decaf/util/AbstractCollection.h>
#include <decaf/lang/Exception.h>
#include <decaf/lang/exceptions/NoSuchElementException.h>
#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
@@ -45,7 +45,7 @@
* can be obtained by calling the Queue method <code>getEmptyMarker</code>.
*/
template <typename E>
- class DECAF_API Queue : public decaf::util::Collection<E> {
+ class DECAF_API Queue : public decaf::util::AbstractCollection<E> {
public:
virtual ~Queue() {}
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h?rev=744373&r1=744372&r2=744373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/Set.h Sat Feb 14 02:38:38
2009
@@ -22,7 +22,7 @@
#include <decaf/util/concurrent/Synchronizable.h>
#include <decaf/util/concurrent/Mutex.h>
#include <decaf/util/Iterator.h>
-#include <decaf/util/Collection.h>
+#include <decaf/util/AbstractCollection.h>
namespace decaf{
namespace util{
@@ -40,7 +40,7 @@
* manner that affects equals comparisons while the object is an element
in the set.
*/
template <typename E>
- class Set : public decaf::util::Collection<E> {
+ class Set : public decaf::util::AbstractCollection<E> {
public:
virtual ~Set() {}
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h?rev=744373&r1=744372&r2=744373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/StlList.h Sat Feb 14
02:38:38 2009
@@ -43,7 +43,6 @@
private:
std::list<E> values;
- util::concurrent::Mutex mutex;
private:
@@ -519,32 +518,6 @@
return oldValue;
}
- public:
-
- virtual void lock() throw( lang::Exception ) {
- mutex.lock();
- }
-
- virtual void unlock() throw( lang::Exception ) {
- mutex.unlock();
- }
-
- virtual void wait() throw( lang::Exception ) {
- mutex.wait();
- }
-
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
- mutex.wait( millisecs );
- }
-
- virtual void notify() throw( lang::Exception ) {
- mutex.notify();
- }
-
- virtual void notifyAll() throw( lang::Exception ) {
- mutex.notifyAll();
- }
-
};
}}
Modified: activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h?rev=744373&r1=744372&r2=744373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h (original)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/StlSet.h Sat Feb 14
02:38:38 2009
@@ -40,7 +40,6 @@
private:
std::set<E> values;
- util::concurrent::Mutex mutex;
private:
@@ -170,22 +169,6 @@
virtual bool equals( const StlSet& source ) const {
return this->values == source.values;
}
- virtual bool equals( const Collection<E>& source ) const {
- if( this->values.size() != source.size() ) {
- return false;
- }
-
- std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
- std::auto_ptr< Iterator<E> > thisIter( this->iterator() );
-
- while( srcIter->hasNext() ) {
- if( !( thisIter->next() == srcIter->next() ) ) {
- return false;
- }
- }
-
- return true;
- }
/**
* {...@inheritdoc}
@@ -194,14 +177,6 @@
this->values.clear();
this->values = source.values;
}
- virtual void copy( const Collection<E>& source ) {
- this->values.clear();
-
- std::auto_ptr< Iterator<E> > iter( source.iterator() );
- while( iter->hasNext() ) {
- this->values.insert( iter->next() );
- }
- }
/**
* {...@inheritdoc}
@@ -220,22 +195,6 @@
}
/**
- * {...@inheritdoc}
- */
- virtual bool containsAll( const Collection<E>& source ) const
- throw ( lang::Exception ) {
-
- std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
- while( srcIter->hasNext() ) {
- if( !this->contains( srcIter->next() ) ) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
* @return if the set contains any element or not, TRUE or FALSE
*/
virtual bool isEmpty() const {
@@ -262,22 +221,6 @@
/**
* {...@inheritdoc}
*/
- virtual bool addAll( const Collection<E>& source )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::IllegalArgumentException ) {
-
- bool result = false;
- std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
- while( srcIter->hasNext() ) {
- result = this->add( srcIter->next() );
- }
-
- return result;
- }
-
- /**
- * {...@inheritdoc}
- */
virtual bool remove( const E& value )
throw ( lang::exceptions::UnsupportedOperationException,
lang::exceptions::IllegalArgumentException ) {
@@ -285,82 +228,6 @@
return values.erase( value ) != 0;
}
- /**
- * {...@inheritdoc}
- */
- virtual bool removeAll( const Collection<E>& source )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::IllegalArgumentException ) {
-
- bool result = false;
- std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
- while( srcIter->hasNext() ) {
- result = this->remove( srcIter->next() );
- }
-
- return result;
- }
-
- /**
- * {...@inheritdoc}
- */
- virtual bool retainAll( const Collection<E>& collection )
- throw ( lang::exceptions::UnsupportedOperationException,
- lang::exceptions::IllegalArgumentException ) {
-
- bool result = false;
- std::auto_ptr< Iterator<E> > iter( this->iterator() );
- while( iter->hasNext() ) {
- if( !collection.contains( iter->next() ) ) {
- iter->remove();
- result = true;
- }
- }
-
- return result;
- }
-
- /**
- * {...@inheritdoc}
- */
- virtual std::vector<E> toArray() const {
- std::vector<E> valueArray( values.size() );
-
- typename std::set<E>::const_iterator iter;
- iter=values.begin();
- for( int ix=0; iter != values.end(); ++iter, ++ix ){
- valueArray[ix] = *iter;
- }
-
- return valueArray;
- }
-
- public:
-
- virtual void lock() throw( lang::Exception ) {
- mutex.lock();
- }
-
- virtual void unlock() throw( lang::Exception ) {
- mutex.unlock();
- }
-
- virtual void wait() throw( lang::Exception ) {
- mutex.wait();
- }
-
- virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
- mutex.wait( millisecs );
- }
-
- virtual void notify() throw( lang::Exception ) {
- mutex.notify();
- }
-
- virtual void notifyAll() throw( lang::Exception ) {
- mutex.notifyAll();
- }
-
};
}}