fulmine.util.collection
Class AbstractCoalescingCollection<E extends IAddressable>
java.lang.Object
fulmine.util.collection.AbstractCoalescingCollection<E>
- Type Parameters:
E
- the element type this collection operates with, a sub-class of
IAddressable
- All Implemented Interfaces:
- Iterable<E>, Collection<E>
- Direct Known Subclasses:
- CoalescingCollection, OrderedCoalescingCollection
public abstract class AbstractCoalescingCollection<E extends IAddressable>
- extends Object
- implements Collection<E>
A collection implementation that stores and identifies objects based on their
identity
within a Map
. This provides coalescing of objects that are added to
the event store, like a set but based on the system identity of the object
rather than the hashcode.
This class is not thread aware and is not thread safe.
- Author:
- Ramon Servadei
- See Also:
System.identityHashCode(Object)
data
protected final Map<Object,E extends IAddressable> data
AbstractCoalescingCollection
protected AbstractCoalescingCollection(Map<Object,E> data)
- Constructor to pass in the data map implementation
- Parameters:
data
- the data map implementation backing this collection
add
public boolean add(E e)
- Specified by:
add
in interface Collection<E extends IAddressable>
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll
in interface Collection<E extends IAddressable>
clear
public void clear()
- Specified by:
clear
in interface Collection<E extends IAddressable>
contains
public boolean contains(Object o)
- Specified by:
contains
in interface Collection<E extends IAddressable>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interface Collection<E extends IAddressable>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Collection<E extends IAddressable>
iterator
public Iterator<E> iterator()
- Specified by:
iterator
in interface Iterable<E extends IAddressable>
- Specified by:
iterator
in interface Collection<E extends IAddressable>
remove
public boolean remove(Object o)
- Specified by:
remove
in interface Collection<E extends IAddressable>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interface Collection<E extends IAddressable>
retainAll
public boolean retainAll(Collection<?> c)
- Unsupported.
- Specified by:
retainAll
in interface Collection<E extends IAddressable>
- Throws:
UnsupportedOperationException
size
public int size()
- Specified by:
size
in interface Collection<E extends IAddressable>
toArray
public Object[] toArray()
- Specified by:
toArray
in interface Collection<E extends IAddressable>
toArray
public <T> T[] toArray(T[] array)
- Specified by:
toArray
in interface Collection<E extends IAddressable>
toString
public final String toString()
- Overrides:
toString
in class Object
hashCode
public final int hashCode()
- Specified by:
hashCode
in interface Collection<E extends IAddressable>
- Overrides:
hashCode
in class Object
equals
public final boolean equals(Object obj)
- Specified by:
equals
in interface Collection<E extends IAddressable>
- Overrides:
equals
in class Object
getSystemIdentity
public static final String getSystemIdentity(Object object)
- Get the system identity for the object. If the object implements
IAddressable
, then the identity is formed of the
IAddressable.getIdentity()
, IAddressable.getType()
and
IAddressable.getDomain()
, otherwise a platform dependent system
identifier mechanism is invoked on the object.
- Parameters:
object
- the object to get the system identity for
- Returns:
- the
String
identity representing the unique system
identifier for the object.
Copyright © 2007-2009. All Rights Reserved.