Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.util
Class DeltaSet

`java.lang.Object
java.util.AbstractCollection
java.util.AbstractSet
com.tangosol.util.DeltaSet`

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set

      public class DeltaSet

extends java.util.AbstractSet
implements java.lang.Cloneable, java.io.Serializable

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

Version:
  1.00, 11/30/98
Author:
  Cameron Purdy

Nested Class Summary
`protected class` | `DeltaSet.DeltaIterator` Iterator for the contents of a delta set.

Constructor Summary
`DeltaSet(java.util.Set set)` Construct this set based on an existing set.

Method Summary
`boolean` | `add(java.lang.Object o)` Ensures that this Collection contains the specified element.
`void` | `clear()` Removes all of the elements from this Collection.
`java.lang.Object` | `clone()` Clone the delta set.
`boolean` | `contains(java.lang.Object o)` Returns true if this Collection contains the specified element.
`protected java.util.Set` | `ensureAdded()` Get a mutable set of items that were added to the delta set.
`protected java.util.Set` | `ensureRemoved()` Get a mutable set of items that were removed from the delta set.
`java.util.Set` | `getAdded()` Determine what items were added to the delta set.
`java.util.Set` | `getOriginal()` Determine what items were in the original set.
`java.util.Set` | `getRemoved()` Determine what items were removed from the delta set.
`boolean` | `isModified()` Determine if any items were added or removed.
`java.util.Iterator` | `iterator()` Returns an Iterator over the elements contained in this Collection.
`boolean` | `remove(java.lang.Object o)` Removes a single instance of the specified element from this Collection, if it is present (optional operation).
`void` | `reset()` Discard the changes to the set ("rollback").
`void` | `resolve()` Apply the changes to the underlying set ("commit").
`int` | `size()` Returns the number of elements in this Collection.
`java.lang.Object[]` | `toArray()` Returns an array containing all of the elements in this Set.

Methods inherited from class java.util.AbstractSet
`equals, hashCode, removeAll`

Methods inherited from class java.util.AbstractCollection
`addAll, containsAll, isEmpty, retainAll, toArray, toString`

Methods inherited from interface java.util.Set
`addAll, containsAll, isEmpty, retainAll, toArray`

Constructor Detail

### DeltaSet

    public DeltaSet(java.util.Set set)

  Construct this set based on an existing set.
  Parameters:
    `set` - the set to base this delta set on

Method Detail

### getOriginal

    public java.util.Set getOriginal()

  Determine what items were in the original set.
  Returns:
    the set used to construct this DeltaSet

### isModified

    public boolean isModified()

  Determine if any items were added or removed.
  Returns:
    true if the set has been modified

### getAdded

    public java.util.Set getAdded()

  Determine what items were added to the delta set.
  Returns:
    an immutable set of added items

### getRemoved

    public java.util.Set getRemoved()

  Determine what items were removed from the delta set.
  Returns:
    an immutable set of removed items

### ensureAdded

    protected java.util.Set ensureAdded()

  Get a mutable set of items that were added to the delta set.
  Returns:
    a mutable set of added items

### ensureRemoved

    protected java.util.Set ensureRemoved()

  Get a mutable set of items that were removed from the delta set.
  Returns:
    a mutable set of removed items

### resolve

    public void resolve()

  Apply the changes to the underlying set ("commit").

### reset

    public void reset()

  Discard the changes to the set ("rollback").

### iterator

    public java.util.Iterator iterator()

  Returns an Iterator over the elements contained in this Collection.
  Specified by:
    `iterator` in interface `java.lang.Iterable`
  Specified by:
    `iterator` in interface `java.util.Collection`
  Specified by:
    `iterator` in interface `java.util.Set`
  Specified by:
    `iterator` in class `java.util.AbstractCollection`
  Returns:
    an Iterator over the elements contained in this Collection

### size

    public int size()

  Returns the number of elements in this Collection.
  Specified by:
    `size` in interface `java.util.Collection`
  Specified by:
    `size` in interface `java.util.Set`
  Specified by:
    `size` in class `java.util.AbstractCollection`
  Returns:
    the number of elements in this Collection

### contains

    public boolean contains(java.lang.Object o)

  Returns true if this Collection contains the specified element. More formally, returns true if and only if this Collection contains at least one element `e` such that `(o==null ? e==null : o.equals(e))`.
  Specified by:
    `contains` in interface `java.util.Collection`
  Specified by:
    `contains` in interface `java.util.Set`
  Overrides:
    `contains` in class `java.util.AbstractCollection`
  Parameters:
    `o` - the object to search for in the set
  Returns:
    true if this set contains the specified object

### add

    public boolean add(java.lang.Object o)

  Ensures that this Collection contains the specified element.
  Specified by:
    `add` in interface `java.util.Collection`
  Specified by:
    `add` in interface `java.util.Set`
  Overrides:
    `add` in class `java.util.AbstractCollection`
  Parameters:
    `o` - element whose presence in this Collection is to be ensured
  Returns:
    true if the Collection changed as a result of the call

### remove

    public boolean remove(java.lang.Object o)

  Removes a single instance of the specified element from this Collection, if it is present (optional operation). More formally, removes an element `e` such that `(o==null ? e==null : o.equals(e))`, if the Collection contains one or more such elements. Returns true if the Collection contained the specified element (or equivalently, if the Collection changed as a result of the call).
  Specified by:
    `remove` in interface `java.util.Collection`
  Specified by:
    `remove` in interface `java.util.Set`
  Overrides:
    `remove` in class `java.util.AbstractCollection`
  Parameters:
    `o` - element to be removed from this Collection, if present
  Returns:
    true if the Collection contained the specified element

### clear

    public void clear()

  Removes all of the elements from this Collection.
  Specified by:
    `clear` in interface `java.util.Collection`
  Specified by:
    `clear` in interface `java.util.Set`
  Overrides:
    `clear` in class `java.util.AbstractCollection`

### toArray

    public java.lang.Object[] toArray()

  Returns an array containing all of the elements in this Set. Obeys the general contract of Collection.toArray.
  Specified by:
    `toArray` in interface `java.util.Collection`
  Specified by:
    `toArray` in interface `java.util.Set`
  Overrides:
    `toArray` in class `java.util.AbstractCollection`
  Returns:
    an Object array containing all of the elements in this Set

### clone

    public java.lang.Object clone()

  Clone the delta set.
  Returns:
    a clone of this delta set

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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