Side of Software
Dated Collections Library 2.0

sos.dated.util
Class IdentityHashMapByDate<K,V,D>

java.lang.Object
  extended by sos.dated.util.AbstractDatedObject<D>
      extended by sos.dated.util.AbstractDatedMap<K,V,D>
          extended by sos.dated.util.AbstractMapByDate<K,V,D>
              extended by sos.dated.util.IdentityHashMapByDate<K,V,D>
Type Parameters:
K - the type of keys maintained by this dated map
V - the type of values maintained by this dated map
D - the type of dates used by this dated map
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, DatedMap<K,V,D>, DatedObject<D>

public class IdentityHashMapByDate<K,V,D>
extends AbstractMapByDate<K,V,D>
implements DatedMap<K,V,D>, java.io.Serializable, java.lang.Cloneable

A special-purpose, non-conforming implementation of DatedMap that uses identity equality and identity hash code by maintaining a java.util.IdentityHashMap at each date.

This implementation is serializable and cloneable; however, it is not synchronized. To use it safely in a multi-threaded situation, wrap an instance of the dated set with a call to synchronizedDatedMap.

Since:
1.0
See Also:
IdentityHashMapByKey, DatedMap, DatedCollections.synchronizedDatedMap(DatedMap)

Nested Class Summary
 
Nested classes/interfaces inherited from interface sos.dated.util.DatedMap
DatedMap.Entry<K,V,D>
 
Constructor Summary
IdentityHashMapByDate()
          Creates a new instance of IdentityHashMapByDate with the expected maximum size at any given date of 21.
IdentityHashMapByDate(DatedMap<? extends K,? extends V,D> datedMap)
          Constructs a new instance of IdentityHashMapByDate initialized with the mappings of datedMap.
IdentityHashMapByDate(int expectedMaxSize)
          Creates an instance of IdentityHashMapByDate with the specified expected maximum size at a given date.
 
Method Summary
 java.lang.Object clone()
          Creates and returns a shallow copy of this object.
protected  java.util.Map<K,V> createMap(D from, D to)
          Creates and returns a new empty map given the specified date range.
 DatedValue<V,D> get(java.lang.Object key)
          Returns the values associated with the specified key for all dates.
 
Methods inherited from class sos.dated.util.AbstractMapByDate
checkForComodification, containsKey, containsValue, copyMap, dateIterator, entrySet, get, modCount, put, putAll, remove, upModCount
 
Methods inherited from class sos.dated.util.AbstractDatedMap
clear, containsKeyThroughout, containsValueThroughout, equals, excludesKeyThroughout, excludesValueThroughout, hashCode, hasSizeThroughout, isEmpty, isEmptyThroughout, keySet, size, toString, values
 
Methods inherited from class sos.dated.util.AbstractDatedObject
dateIterator, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface sos.dated.util.DatedMap
clear, containsKey, containsKeyThroughout, containsValue, containsValueThroughout, entrySet, equals, excludesKeyThroughout, excludesValueThroughout, get, hashCode, hasSizeThroughout, isEmpty, isEmptyThroughout, keySet, put, putAll, remove, size, values
 
Methods inherited from interface sos.dated.util.DatedObject
dateIterator, dateIterator, equals, hashCode, toString
 

Constructor Detail

IdentityHashMapByDate

public IdentityHashMapByDate()
Creates a new instance of IdentityHashMapByDate with the expected maximum size at any given date of 21.


IdentityHashMapByDate

public IdentityHashMapByDate(int expectedMaxSize)
Creates an instance of IdentityHashMapByDate with the specified expected maximum size at a given date.

Parameters:
expectedMaxSize - the expected maximum size of the dated map at any date
Throws:
java.lang.IllegalArgumentException - if expectedMaxSize < 0
Since:
2.0

IdentityHashMapByDate

public IdentityHashMapByDate(DatedMap<? extends K,? extends V,D> datedMap)
Constructs a new instance of IdentityHashMapByDate initialized with the mappings of datedMap.

Parameters:
datedMap - dated map with which to initialize this IdentityHashMapByDate
Throws:
java.lang.NullPointerException - if datedMap is null.
Method Detail

clone

public java.lang.Object clone()
Creates and returns a shallow copy of this object.

Overrides:
clone in class AbstractMapByDate<K,V,D>
Returns:
a copy of this dated map

createMap

protected java.util.Map<K,V> createMap(D from,
                                       D to)
Creates and returns a new empty map given the specified date range. This implementation returns a new IdentityHashMap.

Specified by:
createMap in class AbstractMapByDate<K,V,D>
Parameters:
from - start date (inclusive) for which to create the map
to - end date (exclusive) for which to create the map
Returns:
a map to hold the entries for the specified date range

get

public DatedValue<V,D> get(java.lang.Object key)
Returns the values associated with the specified key for all dates.

Specified by:
get in interface DatedMap<K,V,D>
Overrides:
get in class AbstractDatedMap<K,V,D>
Parameters:
key - key whose values are to be returned
Returns:
a dated value of the values associated with key

Side of Software
Dated Collections Library 2.0

Copyright 2003-09 Side of Software (SOS). All rights reserved.