activemq-cpp-3.9.5
Collection.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_UTIL_COLLECTION_H_
19#define _DECAF_UTIL_COLLECTION_H_
20
21#include <decaf/util/Config.h>
25#include <decaf/lang/Iterable.h>
26#include <decaf/util/Iterator.h>
28
29namespace decaf {
30namespace util {
31
67 template< typename E >
68 class Collection : public virtual lang::Iterable<E>,
70 public:
71
72 virtual ~Collection() {}
73
84 virtual void copy(const Collection<E>& collection) = 0;
85
122 virtual bool add(const E& value) = 0;
123
145 virtual bool addAll(const Collection<E>& collection) = 0;
146
154 virtual void clear() = 0;
155
169 virtual bool contains(const E& value) const = 0;
170
181 virtual bool containsAll(const Collection<E>& collection) const = 0;
182
190 virtual bool equals(const Collection<E>& value) const = 0;
191
195 virtual bool isEmpty() const = 0;
196
214 virtual bool remove(const E& value) = 0;
215
231 virtual bool removeAll(const Collection<E>& collection) = 0;
232
248 virtual bool retainAll(const Collection<E>& collection) = 0;
249
256 virtual int size() const = 0;
257
269 virtual std::vector<E> toArray() const = 0;
270
271 };
272
273}}
274
275#endif /*_DECAF_UTIL_COLLECTION_H_*/
Implementing this interface allows an object to be cast to an Iterable type for generic collections A...
Definition Iterable.h:32
The root interface in the collection hierarchy.
Definition Collection.h:69
virtual bool removeAll(const Collection< E > &collection)=0
Removes all this collection's elements that are also contained in the specified collection (optional ...
virtual void clear()=0
Removes all of the elements from this collection (optional operation).
virtual bool add(const E &value)=0
Returns true if this collection changed as a result of the call.
virtual bool equals(const Collection< E > &value) const =0
Compares the passed collection to this one, if they contain the same elements, i.e.
virtual ~Collection()
Definition Collection.h:72
virtual bool contains(const E &value) const =0
Returns true if this collection contains the specified element.
virtual bool retainAll(const Collection< E > &collection)=0
Retains only the elements in this collection that are contained in the specified collection (optional...
virtual int size() const =0
Returns the number of elements in this collection.
virtual bool containsAll(const Collection< E > &collection) const =0
Returns true if this collection contains all of the elements in the specified collection.
virtual bool addAll(const Collection< E > &collection)=0
Adds all of the elements in the specified collection to this collection.
virtual bool remove(const E &value)=0
Removes a single instance of the specified element from the collection.
virtual std::vector< E > toArray() const =0
Returns an array containing all of the elements in this collection.
virtual bool isEmpty() const =0
virtual void copy(const Collection< E > &collection)=0
Renders this Collection as a Copy of the given Collection.
The interface for all synchronizable objects (that is, objects that can be locked and unlocked).
Definition Synchronizable.h:37
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25