activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1050221 [4/8] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/cmsutil/ main/activemq/core/ main/activemq/state/ main/activemq/threads/ main/activemq/transport/ main/activemq/transport/failover/ main/activemq/util/ m...
Date Thu, 16 Dec 2010 23:18:06 GMT
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "Queue.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Queue.h Thu Dec 16 23:18:02 2010
@@ -21,8 +21,8 @@
 #include <decaf/util/Iterator.h>
 #include <decaf/util/AbstractCollection.h>
 #include <decaf/lang/Exception.h>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
+#include <decaf/util/NoSuchElementException.h>
 
 namespace decaf{
 namespace util{
@@ -52,7 +52,7 @@ namespace util{
      * @since 1.0
      */
     template <typename E>
-    class Queue : public decaf::util::AbstractCollection<E> {
+    class Queue : public virtual decaf::util::Collection<E> {
     public:
 
         virtual ~Queue() {}
@@ -118,8 +118,7 @@ namespace util{
          *
          * @return the element in the head of the queue.
          *
-         * @throws NoSuchElementException
-         *         if there is no element in the queue.
+         * @throws NoSuchElementException if there is no element in the queue.
          */
         virtual E element() const = 0;
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "Set.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Set.h Thu Dec 16 23:18:02 2010
@@ -18,7 +18,7 @@
 #ifndef _DECAF_UTIL_SET_H_
 #define _DECAF_UTIL_SET_H_
 
-#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/NoSuchElementException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
 #include <decaf/util/concurrent/Mutex.h>
 #include <decaf/util/Iterator.h>
@@ -42,7 +42,7 @@ namespace util{
      * @since 1.0
      */
     template <typename E>
-    class Set : public decaf::util::AbstractCollection<E> {
+    class Set : public virtual decaf::util::Collection<E> {
     public:
 
         virtual ~Set() {}

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "StlList.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlList.h Thu Dec 16 23:18:02 2010
@@ -22,14 +22,13 @@
 #include <algorithm>
 #include <memory>
 #include <decaf/lang/exceptions/UnsupportedOperationException.h>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/NoSuchElementException.h>
 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
-#include <decaf/util/concurrent/Synchronizable.h>
-#include <decaf/util/concurrent/Mutex.h>
 #include <decaf/util/Config.h>
 #include <decaf/util/Iterator.h>
 #include <decaf/util/ListIterator.h>
 #include <decaf/util/List.h>
+#include <decaf/util/AbstractList.h>
 
 namespace decaf{
 namespace util{
@@ -39,7 +38,7 @@ namespace util{
      * additional methods not provided by the STL type.
      */
     template <typename E>
-    class StlList : public decaf::util::List<E> {
+    class StlList : public decaf::util::AbstractList<E> {
     private:
 
         std::list<E> values;
@@ -64,14 +63,18 @@ namespace util{
             StlListIterator( typename std::list<E>* list, int index ) :
                 current( list->begin() ), prev( list->end() ), list( list ) {
 
-                std::advance( this->current, index );
+                if( index < (int)list->size() ) {
+                    std::advance( this->current, index );
+                } else {
+                    this->current = list->end();
+                }
             }
 
             virtual ~StlListIterator() {}
 
             virtual E next() {
                 if( this->current == list->end() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "List::Iterator::next - No more elements to return" );
                 }
@@ -95,22 +98,17 @@ namespace util{
                 this->prev = this->list->end();
             }
 
-            virtual void add( const E& e DECAF_UNUSED ) {
-
-                throw lang::exceptions::UnsupportedOperationException(
-                    __FILE__, __LINE__,
-                    "List::ListIterator::add - Not Implemented Yet." );
+            virtual void add( const E& e ) {
+                this->list->insert( this->current, e );
             }
 
             virtual void set( const E& e ) {
 
                 if( this->current == list->end() ) {
-                    throw lang::exceptions::IllegalStateException(
-                        __FILE__, __LINE__,
-                        "List::Iterator::set - Not a valid state for set" );
+                    this->list->insert( this->current, e );
+                } else {
+                    *( this->current ) = e;
                 }
-
-                *( this->current ) = e;
             }
 
             virtual bool hasPrevious() const {
@@ -119,7 +117,7 @@ namespace util{
 
             virtual E previous() {
                 if( this->current == this->list->begin() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "List::ListIterator::previous - No Previous element." );
                 }
@@ -164,14 +162,18 @@ namespace util{
             ConstStlListIterator( const typename std::list<E>* list, int index ) :
                 ListIterator<E>(), current( list->begin() ), prev( list->end() ), list( list ) {
 
-                std::advance( this->current, index );
+                if( index < (int)list->size() ) {
+                    std::advance( this->current, index );
+                } else {
+                    this->current = list->end();
+                }
             }
 
             virtual ~ConstStlListIterator() {}
 
             virtual E next() {
                 if( this->current == list->end() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "List::Iterator::next - No more elements to return" );
                 }
@@ -211,7 +213,7 @@ namespace util{
 
             virtual E previous() {
                 if( this->current == this->list->begin() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "List::ListIterator::previous - No Previous element." );
                 }
@@ -242,14 +244,14 @@ namespace util{
         /**
          * Default constructor - does nothing.
          */
-        StlList() : List<E>(), values() {}
+        StlList() : AbstractList<E>(), values() {}
 
         /**
          * Copy constructor - copies the content of the given set into this
          * one.
          * @param source The source set.
          */
-        StlList( const StlList& source ) : List<E>(), values() {
+        StlList( const StlList& source ) : AbstractList<E>(), values() {
             copy( source );
         }
 
@@ -258,19 +260,31 @@ namespace util{
          * one.
          * @param source The source set.
          */
-        StlList( const Collection<E>& source ) : List<E>(), values() {
-            List<E>::copy( source );
+        StlList( const Collection<E>& source ) : AbstractList<E>(), values() {
+            AbstractList<E>::copy( source );
         }
 
         virtual ~StlList() {}
 
+        using AbstractList<E>::equals;
+
         /**
          * {@inheritDoc}
          */
-        virtual bool equals( const StlList& source ) const {
+        bool equals( const StlList& source ) const {
             return this->values == source.values;
         }
 
+        using AbstractList<E>::copy;
+
+        /**
+         * {@inheritDoc}
+         */
+        void copy( const StlList& source ) {
+            this->values.clear();
+            this->values = source.values;
+        }
+
         /**
          * {@inheritDoc}
          */
@@ -296,20 +310,20 @@ namespace util{
          */
         virtual ListIterator<E>* listIterator( int index ) {
 
-            if( index >= this->size() ) {
+            if( index < 0 || index > this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
-                    "List::listIterator - Index greater than size()" );
+                    "List::listIterator - Index greater than size() or negative" );
             }
 
             return new StlListIterator( &values, index );
         }
         virtual ListIterator<E>* listIterator( int index ) const {
 
-            if( index >= this->size() ) {
+            if( index < 0 || index > this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
-                    "List::listIterator - Index greater than size()" );
+                    "List::listIterator - Index greater than size() or negative" );
             }
 
             return new ConstStlListIterator( &values, index );
@@ -318,14 +332,6 @@ namespace util{
         /**
          * {@inheritDoc}
          */
-        virtual void copy( const StlList& source ) {
-            this->values.clear();
-            this->values = source.values;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
         virtual void clear() {
             values.clear();
         }
@@ -333,50 +339,6 @@ namespace util{
         /**
          * {@inheritDoc}
          */
-        virtual bool contains( const E& value ) const {
-            typename std::list<E>::const_iterator iter;
-            iter = std::find( values.begin(), values.end(), value );
-            return iter != values.end();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        virtual int indexOf( const E& value ) {
-
-            typename std::list<E>::iterator iter;
-            iter = std::find( values.begin(), values.end(), value );
-
-            if( iter == values.end() ) {
-                throw decaf::lang::exceptions::NoSuchElementException(
-                    __FILE__, __LINE__,
-                    "List::indexOf - No matching element in list" );
-            }
-
-            return (int)std::distance( values.begin(), iter );
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        virtual int lastIndexOf( const E& value ) {
-
-            typename std::list<E>::reverse_iterator iter;
-            iter = std::find( values.rbegin(), values.rend(), value );
-
-            if( iter == values.rend() ) {
-                throw decaf::lang::exceptions::NoSuchElementException(
-                    __FILE__, __LINE__,
-                    "List::lastIndexOf - No matching element in list" );
-            }
-
-            // Now reverse the result to get the last index
-            return (int)( this->size() - std::distance( values.rbegin(), iter ) - 1 );
-        }
-
-        /**
-         * {@inheritDoc}
-         */
         virtual bool isEmpty() const {
             return values.empty();
         }
@@ -393,10 +355,10 @@ namespace util{
          */
         virtual E get( int index ) const {
 
-            if( index >= this->size() ) {
+            if( index < 0 || index >= this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
-                    "List::get - Index greater than size()" );
+                    "List::get - Index greater than size() or negative" );
             }
 
             // Advance from begin and return the value at that location.
@@ -410,10 +372,10 @@ namespace util{
          */
         virtual E set( int index, const E& element ) {
 
-            if( index >= this->size() ) {
+            if( index < 0 || index >= this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
-                    "List::get - Index greater than size()" );
+                    "List::get - Index greater than size() or negative" );
             }
 
             // Advance from begin and return the value at that location
@@ -426,20 +388,9 @@ namespace util{
             return oldValue;
         }
 
-        /**
-         * {@inheritDoc}
-         */
-        virtual bool add( const E& value ) {
-            values.insert( values.end(), value );
-            return true;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
         virtual void add( int index, const E& element ) {
 
-            if( index > this->size() ) {
+            if( index < 0 || index > this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
                     "List::add - Index greater than size()" );
@@ -451,23 +402,54 @@ namespace util{
             this->values.insert( iter, element );
         }
 
+        virtual bool add( const E& value ) {
+            values.insert( values.end(), value );
+            return true;
+        }
+
+        virtual bool addAll( const Collection<E>& collection ) {
+
+            if( collection.isEmpty() ) {
+                return false;
+            }
+
+            std::vector<E> array = collection.toArray();
+            typename std::vector<E>::const_iterator vecIter = array.begin();
+
+            std::auto_ptr< ListIterator<E> > iter( this->listIterator( (int)this->values.size() ) );
+
+            while( vecIter != array.end() ) {
+                iter->add( *( vecIter++) );
+            }
+
+            return true;
+        }
+
         /**
          * {@inheritDoc}
          */
-        virtual bool addAll( int index, const Collection<E>& source ) {
+        virtual bool addAll( int index, const Collection<E>& collection ) {
 
-            if( index != 0 && index > this->size() ) {
+            if( index < 0 || index > this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
                     "List::addAll - Index greater than size()" );
             }
 
-            std::auto_ptr< Iterator<E> > srcIter( source.iterator() );
-            while( srcIter->hasNext() ) {
-                this->add( index++, srcIter->next() );
+            if( collection.isEmpty() ) {
+                return false;
             }
 
-            return !source.isEmpty();
+            std::vector<E> array = collection.toArray();
+            typename std::vector<E>::const_iterator vecIter = array.begin();
+
+            std::auto_ptr< ListIterator<E> > iter( this->listIterator( index ) );
+
+            while( vecIter != array.end() ) {
+                iter->add( *( vecIter++) );
+            }
+
+            return true;
         }
 
         /**
@@ -483,12 +465,12 @@ namespace util{
         /**
          * {@inheritDoc}
          */
-        virtual E remove( int index ) {
+        virtual E removeAt( int index ) {
 
-            if( index > this->size() ) {
+            if( index < 0 || index >= this->size() ) {
                 throw decaf::lang::exceptions::IndexOutOfBoundsException(
                     __FILE__, __LINE__,
-                    "List::add - Index greater than size()" );
+                    "List::removeAt - Index greater than size() or negative" );
             }
 
             // Advance from begin and insert the value at that location
@@ -500,6 +482,37 @@ namespace util{
             return oldValue;
         }
 
+        virtual int indexOf( const E& value ) const {
+
+            typename std::list<E>::const_iterator iter;
+            iter = std::find( values.begin(), values.end(), value );
+
+            if( iter == values.end() ) {
+                return -1;
+            }
+
+            return (int)std::distance( values.begin(), iter );
+        }
+
+        virtual int lastIndexOf( const E& value ) const {
+
+            typename std::list<E>::const_reverse_iterator iter;
+            iter = std::find( values.rbegin(), values.rend(), value );
+
+            if( iter == values.rend() ) {
+                return -1;
+            }
+
+            // Now reverse the result to get the last index
+            return (int)( this->size() - std::distance( values.rbegin(), iter ) - 1 );
+        }
+
+        virtual bool contains( const E& value ) const {
+            typename std::list<E>::const_iterator iter;
+            iter = std::find( values.begin(), values.end(), value );
+            return iter != values.end();
+        }
+
     };
 
 }}

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "StlMap.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlMap.h Thu Dec 16 23:18:02 2010
@@ -20,7 +20,7 @@
 
 #include <map>
 #include <vector>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/NoSuchElementException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
 #include <decaf/util/concurrent/Mutex.h>
 #include <decaf/util/Map.h>
@@ -169,7 +169,7 @@ namespace util{
             typename std::map<K,V,COMPARATOR>::iterator iter;
             iter = valueMap.find( key );
             if( iter == valueMap.end() ){
-                throw lang::exceptions::NoSuchElementException(
+                throw NoSuchElementException(
                     __FILE__, __LINE__, "Key does not exist in map" );
             }
 
@@ -184,7 +184,7 @@ namespace util{
             typename std::map<K,V,COMPARATOR>::const_iterator iter;
             iter = valueMap.find( key );
             if( iter == valueMap.end() ){
-                throw lang::exceptions::NoSuchElementException(
+                throw NoSuchElementException(
                     __FILE__, __LINE__, "Key does not exist in map" );
             }
 
@@ -226,7 +226,7 @@ namespace util{
 
             typename std::map<K,V,COMPARATOR>::iterator iter = valueMap.find( key );
             if( iter == valueMap.end() ) {
-                throw decaf::lang::exceptions::NoSuchElementException(
+                throw NoSuchElementException(
                     __FILE__, __LINE__, "Key is not present in this Map." );
             }
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "StlQueue.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlQueue.h Thu Dec 16 23:18:02 2010
@@ -85,7 +85,7 @@ namespace util{
 
             virtual T next() {
                 if( this->current == queue->end() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "Queue::Iterator::next - No more elements to return" );
                 }

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "StlSet.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StlSet.h Thu Dec 16 23:18:02 2010
@@ -21,7 +21,7 @@
 #include <set>
 #include <vector>
 #include <memory>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/NoSuchElementException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
 #include <decaf/util/concurrent/Mutex.h>
 #include <decaf/util/Iterator.h>
@@ -60,7 +60,7 @@ namespace util{
 
             virtual E next() {
                 if( this->current == set->end() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "Set::Iterator::next - No more elements to return" );
                 }
@@ -102,7 +102,7 @@ namespace util{
 
             virtual E next() {
                 if( this->current == set->end() ) {
-                    throw lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__,
                         "Set::Iterator::next - No more elements to return" );
                 }
@@ -144,7 +144,7 @@ namespace util{
          * @param source The source set.
          */
         StlSet( const Collection<E>& source ) : AbstractSet<E>(), values() {
-            copy( source );
+            AbstractSet<E>::copy( source );
         }
 
         virtual ~StlSet() {}
@@ -159,17 +159,21 @@ namespace util{
             return new ConstSetIterator( &values );
         }
 
+        using AbstractSet<E>::equals;
+
         /**
          * {@inheritDoc}
          */
-        virtual bool equals( const StlSet& source ) const {
+        bool equals( const StlSet& source ) const {
             return this->values == source.values;
         }
 
+        using AbstractSet<E>::copy;
+
         /**
          * {@inheritDoc}
          */
-        virtual void copy( const StlSet& source ) {
+        void copy( const StlSet& source ) {
             this->values.clear();
             this->values = source.values;
         }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StringTokenizer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StringTokenizer.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StringTokenizer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/StringTokenizer.h Thu Dec 16 23:18:02 2010
@@ -17,7 +17,7 @@
 #ifndef _DECAF_UTIL_STRINGTOKENIZER_H_
 #define _DECAF_UTIL_STRINGTOKENIZER_H_
 
-#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/NoSuchElementException.h>
 #include <decaf/util/Config.h>
 #include <string>
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+#include "BlockingQueue.h"
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BlockingQueue.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+#include "BrokenBarrierException.h"
+
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+////////////////////////////////////////////////////////////////////////////////
+BrokenBarrierException::~BrokenBarrierException() throw() {
+
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/BrokenBarrierException.h Thu Dec 16 23:18:02 2010
@@ -123,7 +123,7 @@ namespace concurrent{
             return new BrokenBarrierException( *this );
         }
 
-        virtual ~BrokenBarrierException() throw() {}
+        virtual ~BrokenBarrierException() throw();
 
     };
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "Callable.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+#include "ConcurrentMap.h"
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentMap.h Thu Dec 16 23:18:02 2010
@@ -22,8 +22,8 @@
 #include <decaf/util/Map.h>
 
 #include <decaf/lang/exceptions/UnsupportedOperationException.h>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
 #include <decaf/lang/exceptions/IllegalStateException.h>
+#include <decaf/util/NoSuchElementException.h>
 
 namespace decaf {
 namespace util {

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+#include "ConcurrentStlMap.h"
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h Thu Dec 16 23:18:02 2010
@@ -20,7 +20,7 @@
 
 #include <map>
 #include <vector>
-#include <decaf/lang/exceptions/NoSuchElementException.h>
+#include <decaf/util/NoSuchElementException.h>
 #include <decaf/util/concurrent/Synchronizable.h>
 #include <decaf/util/concurrent/ConcurrentMap.h>
 #include <decaf/util/concurrent/Mutex.h>
@@ -194,8 +194,7 @@ namespace concurrent{
         /**
          * {@inheritDoc}
          */
-        virtual V& get( const K& key )
-            throw( lang::exceptions::NoSuchElementException ) {
+        virtual V& get( const K& key ) {
 
             typename std::map<K,V,COMPARATOR>::iterator iter;
 
@@ -206,15 +205,14 @@ namespace concurrent{
                 }
             }
 
-            throw lang::exceptions::NoSuchElementException(
+            throw NoSuchElementException(
                 __FILE__, __LINE__, "Key does not exist in map" );
         }
 
         /**
          * {@inheritDoc}
          */
-        virtual const V& get( const K& key ) const
-            throw( lang::exceptions::NoSuchElementException ) {
+        virtual const V& get( const K& key ) const {
 
             typename std::map<K,V,COMPARATOR>::const_iterator iter;
 
@@ -225,7 +223,7 @@ namespace concurrent{
                 }
             }
 
-            throw lang::exceptions::NoSuchElementException(
+            throw NoSuchElementException(
                 __FILE__, __LINE__, "Key does not exist in map" );
         }
 
@@ -274,7 +272,7 @@ namespace concurrent{
             synchronized( &mutex ) {
                 typename std::map<K,V,COMPARATOR>::iterator iter = valueMap.find( key );
                 if( iter == valueMap.end() ) {
-                    throw decaf::lang::exceptions::NoSuchElementException(
+                    throw NoSuchElementException(
                         __FILE__, __LINE__, "Key is not present in this Map." );
                 }
 
@@ -445,7 +443,7 @@ namespace concurrent{
                 }
             }
 
-            throw decaf::lang::exceptions::NoSuchElementException(
+            throw NoSuchElementException(
                 __FILE__, __LINE__, "Value to Replace was not in the Map." );
         }
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+#include "CopyOnWriteArrayList.h"
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,763 @@
+/*
+ * 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_CONCURRENT_COPYONWRITEARRAYLIST_H_
+#define _DECAF_UTIL_CONCURRENT_COPYONWRITEARRAYLIST_H_
+
+#include <decaf/util/NoSuchElementException.h>
+#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
+#include <decaf/util/concurrent/Synchronizable.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/lang/ArrayPointer.h>
+#include <decaf/lang/System.h>
+#include <decaf/util/List.h>
+
+namespace decaf {
+namespace util {
+namespace concurrent {
+
+    using decaf::lang::ArrayPointer;
+    using decaf::lang::System;
+
+    template< typename E >
+    class CopyOnWriteArrayList : public List<E> {
+    private:
+
+        Mutex mutex;
+        ArrayPointer<E> array;
+
+    public:
+
+        class ArrayListIterator : public ListIterator<E> {
+        private:
+
+            ArrayPointer<E> array;
+            int position;
+
+        public:
+
+            ArrayListIterator( const ArrayPointer<E>& array, int index ) :
+                ListIterator<E>(), array( array ), position( index ) {
+
+                if( position < 0 || position > array.length() ) {
+                    throw decaf::lang::exceptions::IndexOutOfBoundsException(
+                        __FILE__, __LINE__, "Iterator created with invalid index." );
+                }
+            }
+
+            virtual ~ArrayListIterator() {};
+
+            virtual E next() {
+
+                if( position >= array.length() ) {
+                    throw NoSuchElementException();
+                }
+
+                return this->array[position++];
+            }
+
+            virtual bool hasNext() const {
+                return this->position < array.length();
+            }
+
+            virtual void remove() {
+                throw decaf::lang::exceptions::UnsupportedOperationException(
+                    __FILE__, __LINE__, "CopyOnWriteArrayList Iterator cannot remove elements." );
+            }
+
+            virtual void add( const E& e DECAF_UNUSED ) {
+                throw decaf::lang::exceptions::UnsupportedOperationException(
+                    __FILE__, __LINE__, "CopyOnWriteArrayList Iterator cannot add elements." );
+            }
+
+            virtual void set( const E& e DECAF_UNUSED ) {
+                throw decaf::lang::exceptions::UnsupportedOperationException(
+                    __FILE__, __LINE__, "CopyOnWriteArrayList Iterator cannot add elements." );
+            }
+
+            virtual bool hasPrevious() const {
+                return this->position > 0;
+            }
+
+            virtual E previous() {
+                if( position <= 0 ) {
+                    throw NoSuchElementException();
+                }
+
+                return this->array[position--];
+            }
+
+            virtual int nextIndex() const {
+                return this->position;
+            }
+
+            virtual int previousIndex() const {
+                return this->position - 1;
+            }
+
+        };
+
+    public:
+
+        CopyOnWriteArrayList() : List<E>() {
+        }
+
+        CopyOnWriteArrayList( const Collection<E>& collection ) : List<E>() {
+            this->copy( collection );
+        }
+
+        CopyOnWriteArrayList( const E* array, int size ) : List<E>() {
+
+            E* elements = new E[size];
+            for( int i = 0; i < size; ++i ) {
+                elements[i] = array[i];
+            }
+
+            this->array.reset( elements, size );
+        }
+
+        virtual ~CopyOnWriteArrayList() {}
+
+    public:  // Collections API
+
+        virtual void copy( const Collection<E>& collection ) {
+
+            if( (void*)this == &collection ) {
+                return;
+            }
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> data( collection.size() );
+
+                std::auto_ptr< Iterator<E> > iter( collection.iterator() );
+                int index = 0;
+
+                while( iter->hasNext() ) {
+                    data[index++] = iter->next();
+                }
+
+                this->array = data;
+            }
+        }
+
+        virtual bool add( const E& value ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> oldData = this->array;
+                int size = oldData.length();
+                E* elements = new E[size + 1];
+                if( size > 0 ) {
+                    System::arraycopy( oldData.get(), 0, elements, 0, size );
+                }
+                elements[size] = value;
+                this->array.reset( elements, size + 1 );
+
+                return true;
+            }
+
+            return false;
+        }
+
+        virtual bool addAll( const Collection<E>& collection ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> oldData = this->array;
+                int size = oldData.length();
+                E* elements = new E[size + collection.size()];
+
+                if( size > 0 ) {
+                    System::arraycopy( oldData.get(), 0, elements, 0, size );
+                }
+
+                std::auto_ptr< Iterator<E> > iter( collection.iterator() );
+                while( iter->hasNext() ) {
+                    elements[size++] = iter->next();
+                }
+
+                this->array.reset( elements, size );
+
+                return true;
+            }
+
+            return false;
+        }
+
+        virtual void clear() {
+            synchronized( &this->mutex ) {
+                this->array.reset( NULL );
+            }
+        }
+
+        virtual bool contains( const E& value ) const {
+
+            ArrayPointer<E> elements = this->array;
+            for( int i = 0; i < elements.length(); ++i ) {
+                if( elements[i] == value ) {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+        virtual bool containsAll( const Collection<E>& collection ) const {
+
+            ArrayPointer<E> elements = this->array;
+            std::auto_ptr< Iterator<E> > iter( collection.iterator() );
+            while( iter->hasNext() ) {
+                E next = iter->next();
+                if( !this->contains( next ) ) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        virtual bool equals( const Collection<E>& collection ) const {
+
+            if( (void*)this == &collection ) {
+                return true;
+            }
+
+            const List<E>* asList = dynamic_cast<const List<E>*>( &collection );
+            if( asList == NULL ) {
+                return false;
+            }
+
+            if( this->size() != asList->size() ) {
+                return false;
+            }
+
+            std::auto_ptr< Iterator<E> > thisIter( this->iterator() );
+            std::auto_ptr< Iterator<E> > otherIter( asList->iterator() );
+
+            while( thisIter->hasNext() ) {
+                if( !otherIter->hasNext() ) {
+                    return false;
+                }
+
+                E myNext = thisIter->next();
+                E otherNext = otherIter->next();
+
+                if( myNext != otherNext ) {
+                    return false;
+                }
+            }
+
+            if( otherIter->hasNext() ) {
+                return false;
+            }
+
+            return true;
+        }
+
+        virtual bool isEmpty() const {
+            return this->getArray().length() == 0;
+        }
+
+        virtual bool remove( const E& value ) {
+
+            synchronized( &this->mutex ) {
+
+                int index = this->indexOf( value );
+                if( index == -1 ) {
+                    return false;
+                }
+
+                this->removeAt( index );
+
+                return true;
+            }
+
+            return false;
+        }
+
+        virtual bool removeAll( const Collection<E>& collection ) {
+
+            if( collection.isEmpty() ) {
+                return false;
+            }
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> oldData = this->array;
+                int size = oldData.length();
+
+                if( size == 0 ) {
+                    return false;
+                }
+
+                ArrayPointer<E> elements( size );
+                int count = 0;
+
+                for( int i = 0; i < size; ++i ) {
+                    E value = oldData[i];
+                    if( !collection.contains( value ) ) {
+                        elements[count++] = value;
+                    }
+                }
+
+                if( count == 0 ) {
+                    this->array.reset( NULL );
+                } else {
+                    E* newArray = new E[count];
+                    System::arraycopy( elements.get(), 0, newArray, 0, count );
+                    this->array.reset( newArray, count );
+                }
+
+                return true;
+
+            }
+
+            return false;
+        }
+
+        virtual bool retainAll( const Collection<E>& collection ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> oldData = this->array;
+                int size = oldData.length();
+
+                if( size == 0 ) {
+                    return false;
+                }
+
+                if( collection.isEmpty() ) {
+                    this->array.reset( NULL );
+                    return true;
+                }
+
+                ArrayPointer<E> elements( size );
+                int count = 0;
+
+                for( int i = 0; i < size; ++i ) {
+                    E value = oldData[i];
+                    if( collection.contains( value ) ) {
+                        elements[count++] = value;
+                    }
+                }
+
+                if( count == 0 ) {
+                    this->array.reset( NULL );
+                } else {
+                    E* newArray = new E[count];
+                    System::arraycopy( elements.get(), 0, newArray, 0, count );
+                    this->array.reset( newArray, count );
+                }
+
+                return true;
+
+            }
+
+            return false;
+        }
+
+        virtual int size() const {
+            return this->getArray().length();
+        }
+
+        virtual std::vector<E> toArray() const {
+
+            ArrayPointer<E> data = this->getArray();
+            std::vector<E> result( data.length() );
+            for( int i = 0; i < data.length(); ++i ) {
+                result[i] = data[i];
+            }
+
+            return result;
+        }
+
+    public:  // Iterable API
+
+        virtual decaf::util::Iterator<E>* iterator() {
+            return new ArrayListIterator( this->getArray(), 0 );
+        }
+        virtual decaf::util::Iterator<E>* iterator() const {
+            return new ArrayListIterator( this->getArray(), 0 );
+        }
+
+    public:  // List API
+
+        virtual ListIterator<E>* listIterator()  {
+            return new ArrayListIterator( this->getArray(), 0 );
+        }
+        virtual ListIterator<E>* listIterator() const  {
+            return new ArrayListIterator( this->getArray(), 0 );
+        }
+
+        virtual ListIterator<E>* listIterator( int index )  {
+            return new ArrayListIterator( this->getArray(), index );
+        }
+        virtual ListIterator<E>* listIterator( int index ) const  {
+            return new ArrayListIterator( this->getArray(), index );
+        }
+
+        virtual int indexOf( const E& value ) const {
+
+            ArrayPointer<E> elements = this->array;
+            for( int i = 0; i < elements.length(); ++i ) {
+                if( elements[i] == value ) {
+                    return i;
+                }
+            }
+
+            return -1;
+        }
+
+        virtual int lastIndexOf( const E& value ) const {
+
+            ArrayPointer<E> elements = this->array;
+            for( int i = elements.length() - 1; i >= 0; --i ) {
+                if( elements[i] == value ) {
+                    return i;
+                }
+            }
+
+            return -1;
+        }
+
+        virtual E get( int index ) const {
+            ArrayPointer<E> array = this->getArray();
+            checkIndexExclusive( index, array.length() );
+            return array[index];
+        }
+
+        virtual E set( int index, const E& element ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> previous = this->getArray();
+                int size = previous.length();
+                this->checkIndexExclusive( index, size );
+                E* newArray = new E[size];
+                System::arraycopy( previous.get(), 0, newArray, 0, size );
+                E old = newArray[index];
+                newArray[index] = element;
+                this->array.reset( newArray, size );
+
+                return old;
+            }
+
+            return E();
+        }
+
+        virtual void add( int index, const E& element ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> previous = this->getArray();
+                int size = previous.length();
+                checkIndexInclusive( index, size );
+                E* newArray = new E[size+1];
+
+                if( size > 0 ) {
+                    System::arraycopy( previous.get(), 0, newArray, 0, index);
+                }
+
+                if( size > index ) {
+                    System::arraycopy( previous.get(), index, newArray, index + 1, size - index );
+                }
+
+                newArray[index] = element;
+
+                this->array.reset( newArray, size+1 );
+            }
+        }
+
+        virtual bool addAll( int index, const Collection<E>& collection ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> previous = this->getArray();
+                int size = previous.length();
+                checkIndexInclusive( index, size );
+                int csize = collection.size();
+
+                if( csize == 0 ) {
+                    return false;
+                }
+
+                E* newArray = new E[size+csize];
+
+                if( size > 0 ) {
+                    System::arraycopy( previous.get(), 0, newArray, 0, index);
+                }
+
+                std::auto_ptr< Iterator<E> > iter( collection.iterator() );
+                int pos = index;
+                while( iter->hasNext() ) {
+                    newArray[pos++] = iter->next();
+                }
+
+                if( size > index ) {
+                    System::arraycopy( previous.get(), index, newArray, index + csize, size - index );
+                }
+
+                this->array.reset( newArray, size+csize );
+            }
+
+            return true;
+        }
+
+        virtual E removeAt( int index ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> previous = this->getArray();
+                int size = previous.length();
+                this->checkIndexExclusive( index, size );
+                E old = previous[index];
+
+                if( size == 1 ) {
+                    this->array.reset( NULL );
+                    return old;
+                }
+
+                E* newArray = new E[size-1];
+                System::arraycopy( previous.get(), 0, newArray, 0, index );
+
+                if( size > index ) {
+                    System::arraycopy( previous.get(), index + 1, newArray, index, size - index - 1 );
+                }
+
+                this->array.reset( newArray, size - 1 );
+
+                return old;
+            }
+
+            return E();
+        }
+
+        virtual std::string toString() const {
+            ArrayPointer<E> current = this->getArray();
+
+            std::string result;
+
+            return result;
+        }
+
+    public:
+
+        /**
+         * Adds the given value to the end of this List if it is not already contained
+         * in this List.
+         *
+         * @param value
+         *      The element to be added if not already contained in this List.
+         *
+         * @returns true if the element is added to this List.
+         */
+        bool addIfAbsent( const E& value ) {
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> previous = this->getArray();
+                int size = previous.length();
+
+                if( size != 0 ) {
+                    if( this->indexOf( value ) != -1 ) {
+                        return false;
+                    }
+                }
+
+                E* newArray = new E[size+1];
+                if( size > 0 ) {
+                    System::arraycopy( previous.get(), 0, newArray, 0, size );
+                }
+                newArray[size] = value;
+
+                this->array.reset( newArray, size+1 );
+
+                return true;
+            }
+
+            return false;
+        }
+
+        /**
+         * Every element in the given collection that is not already contained in this Collection
+         * is added to the end of this collection.  The order that the elements are added is ditacted
+         * by the order that the collection's iterator returns them.
+         *
+         * @param collection
+         *      The collection whose elements are to be added if not already in this List.
+         *
+         * @returns the number of elements that are added to this List.
+         */
+        int addAllAbsent( const Collection<E>& collection ) {
+
+            if( collection.size() == 0 ) {
+                return 0;
+            }
+
+            synchronized( &this->mutex ) {
+
+                ArrayPointer<E> previous = this->getArray();
+                int size = previous.length();
+
+                ArrayPointer<E> add( collection.size() );
+                int count = 0;
+
+                std::auto_ptr< Iterator<E> > iter( collection.iterator() );
+                while( iter->hasNext() ) {
+                    E value = iter->next();
+                    if( this->indexOf( value ) == -1 ) {
+                        add[count++] = value;
+                    }
+                }
+
+                E* newArray = new E[size+count];
+                System::arraycopy( previous.get(), 0, newArray, 0, size );
+                System::arraycopy( add.get(), 0, newArray, size, count );
+
+                this->array.reset( newArray, size+count );
+
+                return count;
+            }
+
+            return 0;
+        }
+
+        /**
+         * Searches backwards through the List for the given element starting at the index
+         * specified.
+         *
+         * @param value
+         *      The value to search for in the List.
+         * @param index
+         *      The index in the list to begin the search from.
+         *
+         * @returns the index in the list that matches the value given, or -1 if not found.
+         *
+         * @throws IndexOutOfBoundsException if the given index is greater than or equal to the List size.
+         */
+        int lastIndexOf( const E& value, int index ) {
+
+            ArrayPointer<E> elements = this->array;
+
+            if( index >= elements.length() ) {
+                throw decaf::lang::exceptions::IndexOutOfBoundsException(
+                    __FILE__, __LINE__, "Index given %d, actual size %d", index, elements.length() );
+            }
+
+            for( int i = index - 1; i >= 0; --i ) {
+                if( elements[i] == value ) {
+                    return i;
+                }
+            }
+
+            return -1;
+        }
+
+        /**
+         * Searches the List starting from the specified index and returns the index of the
+         * first item in the list that is equal to the given value.
+         *
+         * @param value
+         *      The value to search for in the List.
+         * @param index
+         *      The index in the List to begin the search from.
+         *
+         * @returns the index in the List that matches the given element or -1 if not found.
+         *
+         * @throws IndexOutOfBoundsException if the given index is negative.
+         */
+        int indexOf( const E& value, int index ) const {
+
+            ArrayPointer<E> elements = this->array;
+
+            if( index < 0 ) {
+                throw decaf::lang::exceptions::IndexOutOfBoundsException(
+                    __FILE__, __LINE__, "Index given %d, actual size %d", index, elements.length() );
+            }
+
+            for( int i = index; i < elements.length(); ++i ) {
+                if( elements[i] == value ) {
+                    return i;
+                }
+            }
+
+            return -1;
+        }
+
+    public:  // Synchronizable
+
+        virtual void lock() {
+            mutex.lock();
+        }
+
+        virtual bool tryLock() {
+            return mutex.tryLock();
+        }
+
+        virtual void unlock() {
+            mutex.unlock();
+        }
+
+        virtual void wait()  {
+            mutex.wait();
+        }
+
+        virtual void wait( long long millisecs ) {
+            mutex.wait( millisecs );
+        }
+
+        virtual void wait( long long millisecs, int nanos ) {
+            mutex.wait( millisecs, nanos );
+        }
+
+        virtual void notify() {
+            mutex.notify();
+        }
+
+        virtual void notifyAll() {
+            mutex.notifyAll();
+        }
+
+    private:
+
+        template<typename T>
+        friend class CopyOnWriteArraySet;
+
+        ArrayPointer<E> getArray() const {
+            return this->array;
+        }
+
+        static void checkIndexInclusive( int index, int size ) {
+            if( index < 0 || index > size ) {
+                throw decaf::lang::exceptions::IndexOutOfBoundsException(
+                    __FILE__, __LINE__, "Index is %d, size is %d", index, size );
+            }
+        }
+
+        static void checkIndexExclusive( int index, int size ) {
+            if( index < 0 || index >= size ) {
+                throw decaf::lang::exceptions::IndexOutOfBoundsException(
+                    __FILE__, __LINE__, "Index is %d, size is %d", index, size );
+            }
+        }
+
+    };
+
+}}}
+
+#endif /* _DECAF_UTIL_CONCURRENT_COPYONWRITEARRAYLIST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArrayList.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+
+#include "CopyOnWriteArraySet.h"
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.h?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.h Thu Dec 16 23:18:02 2010
@@ -0,0 +1,178 @@
+/*
+ * 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_CONCURRENT_COPYONWRITEARRAYSET_H_
+#define _DECAF_UTIL_CONCURRENT_COPYONWRITEARRAYSET_H_
+
+#include <decaf/util/NoSuchElementException.h>
+#include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
+#include <decaf/lang/ArrayPointer.h>
+#include <decaf/util/concurrent/CopyOnWriteArrayList.h>
+#include <decaf/util/concurrent/Synchronizable.h>
+#include <decaf/util/Set.h>
+#include <decaf/util/Arrays.h>
+#include <decaf/util/AbstractSet.h>
+
+namespace decaf {
+namespace util {
+namespace concurrent {
+
+    using decaf::lang::ArrayPointer;
+
+    /**
+     * Since the CopyOnWriteArraySet and the CopyOnWriteArrayList share much of the same
+     * operational semantics this class uses the CopyOnWriteArrayList for all its underlying
+     * operations.
+     *
+     * This collection is best used in applications where the Set size is usually small and
+     * write operations are minimal as they result in a copy of the underlying array being
+     * created.  Reads are generally fast and the iterators provided by this collection
+     * do not block as they operate on a snapshot of the data taken at the time of their
+     * creation.
+     *
+     * @since 1.0
+     */
+    template< typename E >
+    class CopyOnWriteArraySet : public AbstractSet<E> {
+    private:
+
+        CopyOnWriteArrayList<E> array;
+
+    public:
+
+        CopyOnWriteArraySet() : AbstractSet<E>(), array() {
+        }
+
+        CopyOnWriteArraySet( const Collection<E>& collection ) : AbstractSet<E>(), array() {
+            this->copy( collection );
+        }
+
+        CopyOnWriteArraySet( const E* array, int size ) : AbstractSet<E>(), array() {
+
+            for( int i = 0; i < size; ++i ) {
+                this->array.addIfAbsent( array[i] );
+            }
+        }
+
+        virtual ~CopyOnWriteArraySet() {}
+
+    public:
+
+        virtual void copy( const Collection<E>& collection ) {
+            this->array.copy( collection );
+        }
+
+        virtual decaf::util::Iterator<E>* iterator() {
+            return this->array.iterator();
+        }
+
+        virtual decaf::util::Iterator<E>* iterator() const {
+            return this->array.iterator();
+        }
+
+        virtual int size() const {
+            return this->array.size();
+        }
+
+        virtual bool isEmpty() const {
+            return this->array.isEmpty();
+        }
+
+        virtual bool add( const E& value ) {
+            return this->array.addIfAbsent( value );
+        }
+
+        virtual bool addAll( const Collection<E>& collection ) {
+            return this->array.addAllAbsent( collection );
+        }
+
+        virtual void clear() {
+            this->array.clear();
+        }
+
+        virtual bool contains( const E& value ) const {
+            return this->array.contains( value );
+        }
+
+        virtual bool containsAll( const Collection<E>& collection ) const {
+            return this->array.containsAll( collection );
+        }
+
+        virtual bool remove( const E& value ) {
+            return this->array.remove( value );
+        }
+
+        virtual bool removeAll( const Collection<E>& collection ) {
+            return this->array.removeAll( collection );
+        }
+
+        virtual bool retainAll( const Collection<E>& collection ) {
+            return this->array.retainAll( collection );
+        }
+
+        virtual std::vector<E> toArray() const {
+            return this->array.toArray();
+        }
+
+        virtual bool equals( const Collection<E>& collection ) const {
+
+            if( (void*)this == &collection ) {
+                return true;
+            }
+
+            const Set<E>* asSet = dynamic_cast<const Set<E>*>( &collection );
+            if( asSet == NULL ) {
+                return false;
+            }
+
+            if( this->size() != asSet->size() ) {
+                return false;
+            }
+
+            std::auto_ptr< Iterator<E> > setIter( asSet->iterator() );
+
+            //  Use a single snapshot of underlying array
+            ArrayPointer<E> elements = this->array.getArray();
+            int length = elements.length();
+
+            ArrayPointer<bool> matched( length, false );
+
+            while( setIter->hasNext() ) {
+
+                E value = setIter->next();
+                for( int i = 0; i < length; ++i ) {
+                    if( !matched[i] && value == elements[i] ) {
+                        matched[i] = true;
+                        break;
+                    }
+                }
+            }
+
+            for( int i = 0; i < length; ++i ) {
+                if( matched[i] == false ) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+    };
+
+}}}
+
+#endif /* _DECAF_UTIL_CONCURRENT_COPYONWRITEARRAYSET_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/CopyOnWriteArraySet.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Delayed.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Delayed.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Delayed.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Delayed.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "Delayed.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Delayed.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "Executor.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Executor.h Thu Dec 16 23:18:02 2010
@@ -101,7 +101,7 @@ namespace concurrent {
          *
          * @throws NullPointerException if command is null
          */
-        virtual void execute( Runnable* command ) = 0;
+        virtual void execute( decaf::lang::Runnable* command ) = 0;
 
     };
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "ExecutorService.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h?rev=1050221&r1=1050220&r2=1050221&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h Thu Dec 16 23:18:02 2010
@@ -67,7 +67,7 @@ namespace concurrent {
          *
          * @throws InterruptedException - if interrupted while waiting.
          */
-        bool awaitTermination( long long timeout, const TimeUnit& unit ) = 0;
+        virtual bool awaitTermination( long long timeout, const TimeUnit& unit ) = 0;
 
     };
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.cpp?rev=1050221&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.cpp Thu Dec 16 23:18:02 2010
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+#include "Future.h"

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Future.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message