Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

DeltaSet Class Reference

#include <coherence/util/DeltaSet.hpp>

Inherits AbstractSet.

List of all members.


Detailed Description

Implements a set which is based on another set, which is assumed to be immutable.

Author:
tb 2009.02.10
 

Public Types

typedef spec::Handle Handle
 DeltaSet Handle definition.
typedef spec::View View
 DeltaSet View definition.
typedef spec::Holder Holder
 DeltaSet Holder definition.

Public Member Functions

 DeltaSet (Set::Holder hSet)
 Construct this set based on an existing set.
virtual Set::View getOriginal () const
 Determine what items were in the original set.
virtual bool isModified () const
 Determine if the set has been modified.
virtual Set::View getAdded () const
 Determine what items were added to the DeltaSet.
virtual Set::View getRemoved () const
 Determine what items were removed from the DeltaSet.
virtual Set::Handle ensureAdded ()
 Get a mutable set of items that were added to the DeltaSet.
virtual Set::Handle ensureRemoved ()
 Get a mutable set of items that are removed in the DeltaSet.
virtual void resolve ()
 Apply the changes to the underlying set ("commit").
virtual void reset ()
 Discard the changes to the set ("rollback").
virtual size32_t size () const
 Return the number of elements in this collection.

Returns:
the number of elements in this collection
virtual bool contains (Object::View v) const
 Determine if this collection contains the specified element.

Parameters:
 v the element to test for containment
Returns:
true iff this collection contains the given element
virtual Iterator::Handle iterator () const
 Return an Iterator over this collection.

Returns:
an Iterator over this collection
virtual Muterator::Handle iterator ()
 Return an Iterator over this collection.

Returns:
an Iterator over this collection
virtual
ObjectArray::Handle 
toArray (ObjectArray::Handle hao=NULL) const
 Return the contents of this collection as an ObjectArray.

If the collection fits in the specified array, it is returned, otherwise, a new array is allocated that is the size of this collection.

If this collection fits in the array with aditional room then the element in the array immediately following the end of the collection is set to NULL. This can be useful in determining the length of this collection if the caller knows that the collection does not contain any NULL elements.

Parameters:
 hao an array in which to store the collection's contents
Returns:
a ObjectArray containing all the elements of the collection in the same order as returned by the collection's Iterator
See also:
Iterator
virtual bool add (Object::Holder oh)
 Add the given element to this collection.

Parameters:
 oh the element to add
Returns:
true iff this collection was modified as a result of this operation

This implementation will throw a coherence::lang::UnsupportedOperationException

virtual bool remove (Object::View v)
 Remove the supplied element from this collection.

Parameters:
 v the element to remove
Returns:
true iff this collection was modified as a result of this operation

This implementation will throw a coherence::lang::UnsupportedOperationException unless add() is overridden (assuming the specified collection is non-empty).

virtual void clear ()
 Remove all elements from this collection.

This implementation will throw a coherence::lang::UnsupportedOperationException.


Protected Attributes

FinalHolder< Setm_ohSetOrig
 The underlying set (assumed immutable).
MemberHandle< Setm_hSetAdded
 The added items.
MemberHandle< Setm_hSetRemoved
 The removed items.

Constructor & Destructor Documentation

DeltaSet ( Set::Holder  hSet  )   

Construct this set based on an existing set.

Parameters:
 set the set to base this delta set on


Member Function Documentation

virtual Set::View getOriginal (  )  const [virtual]

Determine what items were in the original set.

Returns:
the set used to construct this DeltaSet

virtual bool isModified (  )  const [virtual]

Determine if the set has been modified.

Returns:
true if any items have been removed

virtual Set::View getAdded (  )  const [virtual]

Determine what items were added to the DeltaSet.

Returns:
a set of added items

virtual Set::View getRemoved (  )  const [virtual]

Determine what items were removed from the DeltaSet.

Returns:
an immutable set of removed items

virtual Set::Handle ensureAdded (  )  [virtual]

Get a mutable set of items that were added to the DeltaSet.

Returns:
a mutable set of added items

virtual Set::Handle ensureRemoved (  )  [virtual]

Get a mutable set of items that are removed in the DeltaSet.

Returns:
a mutable set of removed items


The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.