Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47891-01

SortedBag::ViewBag Class Reference

#include <coherence/util/SortedBag.hpp>

Inherits SortedBag.

List of all members.


Detailed Description

A range-limited view of the SortedBag.

This view is backed by the SortedBag, so any modifications made to it are visible to the underlying bag, and vice-versa.

Public Types

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

Public Member Functions

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 SortedBag::Handle subBag (Object::View vFrom, Object::View vTo)
 Returns a view of the portion of this bag whose elements range from vFrom, inclusive, to vTo, exclusive.

(If vFrom and vTo are equal, the returned bag is empty.) The returned bag is backed by this bag, so changes in the returned bag are reflected in this bag, and vice-versa. The returned bag supports all optional bag operations that this bag supports.

The returned bag will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Parameters:
vFrom low endpoint (inclusive) of the returned bag
vTo high endpoint (exclusive) of the returned bag
Returns:
a view of the portion of this bag whose elements range from vFrom, inclusive, to vTo, exclusive
Exceptions:
ClassCastException if vFrom and vTo cannot be compared to one another using this bag's comparator (or, if the bag has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception if vFrom or vTo cannot be compared to elements currently in the bag.
NullPointerException if vFrom or vTo is NULL and this bag does not permit NULL elements
IllegalArgumentException if vFrom is greater than vTo; or if this bag itself has a restricted range, and vFrom or vTo lies outside the bounds of the range

virtual SortedBag::View subBag (Object::View vFrom, Object::View vTo) const
 
virtual SortedBag::Handle headBag (Object::View vTo)
 Returns a view of the portion of this bag whose elements are strictly less than vTo.

The returned bag is backed by this bag, so changes in the returned bag are reflected in this bag, and vice-versa. The returned bag supports all optional bag operations that this bag supports.

The returned bag will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Parameters:
vTo high endpoint (exclusive) of the returned bag
Returns:
a view of the portion of this bag whose elements are strictly less than vTo
Exceptions:
ClassCastException if vTo is not compatible with this bag's comparator (or, if the bag has no comparator, if vTo does not implement Comparable). Implementations may, but are not required to, throw this exception if vTo cannot be compared to elements currently in the bag.
NullPointerException if vTo is NULL and this bag does not permit NULL elements
IllegalArgumentException if this bag itself has a restricted range, and vTo lies outside the bounds of the range

virtual SortedBag::View headBag (Object::View vTo) const
 
virtual SortedBag::Handle tailBag (Object::View vFrom)
 Returns a view of the portion of this bag whose elements are greater than or equal to vFrom.

The returned bag is backed by this bag, so changes in the returned bag are reflected in this bag, and vice-versa. The returned bag supports all optional bag operations that this bag supports.

The returned bag will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Parameters:
vFrom low endpoint (inclusive) of the returned bag
Returns:
a view of the portion of this bag whose elements are greater than or equal to vFrom
Exceptions:
ClassCastException if vFrom is not compatible with this bag's comparator (or, if the bag has no comparator, if vFrom does not implement Comparable). Implementations may, but are not required to, throw this exception if vFrom cannot be compared to elements currently in the bag.
NullPointerException if vFrom is NULL and this bag does not permit NULL elements
IllegalArgumentException if this bag itself has a restricted range, and vFrom lies outside the bounds of the range

virtual SortedBag::View tailBag (Object::View vFrom) const
 

Protected Member Functions

 ViewBag (SortedBag::Holder ohBag, Object::View vFrom, Object::View vTo)
 Construct a view of the SortedBag, constrained to the range [ohFrom, ohTo).
void checkRange (Object::View v) const
 Check that the specified object is within the range of this view.

Protected Attributes

FinalHolder< SortedBagf_ohBag
 The "outer this".
FinalView< Objectf_vFrom
 The (inclusive) lower bound of this view.
FinalView< Objectf_vTo
 The (exclusive) upper bound of this view.


Constructor & Destructor Documentation

ViewBag ( SortedBag::Holder  ohBag,
Object::View  vFrom,
Object::View  vTo 
) [protected]

Construct a view of the SortedBag, constrained to the range [ohFrom, ohTo).

Parameters:
ohBag reference to the "outer this"
vFrom the "from" element (inclusive), or null
vTo the "to" element (exclusive), or null


Member Function Documentation

void checkRange ( Object::View  v  )  const [protected]

Check that the specified object is within the range of this view.

Parameters:
v the object to check


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