Skip navigation links

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

E47890-01


com.tangosol.util
Class SortedBag.ViewBag

java.lang.Object
  extended by java.util.AbstractCollection
      extended by com.tangosol.util.SortedBag
          extended by com.tangosol.util.SortedBag.ViewBag

All Implemented Interfaces:
java.lang.Iterable, java.util.Collection
Enclosing class:
SortedBag

protected class SortedBag.ViewBag
extends SortedBag

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.


Nested Class Summary

 

Nested classes/interfaces inherited from class com.tangosol.util.SortedBag
SortedBag.UniqueElement, SortedBag.ViewBag, SortedBag.WrapperComparator

 

Field Summary
protected  java.lang.Object f_oFrom
          The (inclusive) lower bound of this view.
protected  java.lang.Object f_oTo
          The (exclusive) upper bound of this view.

 

Fields inherited from class com.tangosol.util.SortedBag
m_atomicNonce, m_comparator, m_map, NO_VALUE

 

Constructor Summary
SortedBag.ViewBag(java.lang.Object oFrom, java.lang.Object oTo)
          Construct a view of the SortedBag, constrained to the range [oFrom, oTo).

 

Method Summary
 boolean add(java.lang.Object o)
          
protected  void checkRange(java.lang.Object o)
          Check that the specified object is within the range of this view.
 SortedBag headBag(java.lang.Object toElement)
          Returns a view of the portion of this bag whose elements are strictly less than toElement.
 SortedBag subBag(java.lang.Object fromElement, java.lang.Object toElement)
          Returns a view of the portion of this bag whose elements range from fromElement, inclusive, to toElement, exclusive.
 SortedBag tailBag(java.lang.Object fromElement)
          Returns a view of the portion of this bag whose elements are greater than or equal to fromElement.

 

Methods inherited from class com.tangosol.util.SortedBag
contains, first, getComparator, getInternalMap, getNonceCounter, instantiateInternalMap, isEmpty, iterator, last, remove, removeFirst, removeLast, size, unwrap, wrap

 

Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, removeAll, retainAll, toArray, toArray, toString

 

Methods inherited from interface java.util.Collection
equals, hashCode

 

Field Detail

f_oFrom

protected final java.lang.Object f_oFrom
The (inclusive) lower bound of this view.

f_oTo

protected final java.lang.Object f_oTo
The (exclusive) upper bound of this view.

Constructor Detail

SortedBag.ViewBag

public SortedBag.ViewBag(java.lang.Object oFrom,
                         java.lang.Object oTo)
Construct a view of the SortedBag, constrained to the range [oFrom, oTo).
Parameters:
oFrom - the "from" element (inclusive), or null
oTo - the "to" element (exclusive), or null

Method Detail

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Overrides:
add in class SortedBag

subBag

public SortedBag subBag(java.lang.Object fromElement,
                        java.lang.Object toElement)
Returns a view of the portion of this bag whose elements range from fromElement, inclusive, to toElement, exclusive. (If fromElement and toElement 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.

Overrides:
subBag in class SortedBag
Parameters:
fromElement - low endpoint (inclusive) of the returned bag
toElement - high endpoint (exclusive) of the returned bag
Returns:
a view of the portion of this bag whose elements range from fromElement, inclusive, to toElement, exclusive

headBag

public SortedBag headBag(java.lang.Object toElement)
Returns a view of the portion of this bag whose elements are strictly less than toElement. 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.

Overrides:
headBag in class SortedBag
Parameters:
toElement - high endpoint (exclusive) of the returned bag
Returns:
a view of the portion of this bag whose elements are strictly less than toElement

tailBag

public SortedBag tailBag(java.lang.Object fromElement)
Returns a view of the portion of this bag whose elements are greater than or equal to fromElement. 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.

Overrides:
tailBag in class SortedBag
Parameters:
fromElement - low endpoint (inclusive) of the returned bag
Returns:
a view of the portion of this bag whose elements are greater than or equal to fromElement

checkRange

protected void checkRange(java.lang.Object o)
Check that the specified object is within the range of this view.
Parameters:
o - the object to check

Skip navigation links

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

E47890-01


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.