sos.dated.util
Class HashMapByDate

java.lang.Object
  |
  +--sos.dated.util.AbstractDatedObject
        |
        +--sos.dated.util.AbstractDatedMap
              |
              +--sos.dated.util.AbstractMapByDate
                    |
                    +--sos.dated.util.HashMapByDate
All Implemented Interfaces:
java.lang.Cloneable, DatedMap, DatedObject, java.io.Serializable

public class HashMapByDate
extends AbstractMapByDate
implements DatedMap, java.io.Serializable, java.lang.Cloneable

An implementation of DatedMap that maintains a java.util.HashMap at each date where a change occurs, yielding fast date iterations and fast retrievals.

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 map with a call to DatedCollections.synchronizedDatedMap.

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

Nested Class Summary
 
Nested classes inherited from class sos.dated.util.DatedMap
DatedMap.Entry
 
Field Summary
 
Fields inherited from interface sos.dated.util.DatedObject
MAX_DATE, MIN_DATE
 
Constructor Summary
HashMapByDate()
          Constructs a new instance of HashMapByDate.
HashMapByDate(DatedMap datedMap)
          Constructs a new instance of HashMapByDate initialized with the mappings of datedMap.
 
Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
protected  java.util.Map copyMap(java.util.Map map)
          Returns a new HashMap initialized with the mappings of map.
protected  java.util.Map createMap()
          Returns a freshly created, empty HashMap.
 
Methods inherited from class sos.dated.util.AbstractMapByDate
checkForComodification, containsKey, containsValue, dateIterator, entrySet, modCount, put, remove, upModCount
 
Methods inherited from class sos.dated.util.AbstractDatedMap
clear, containsKeyThroughout, containsValueThroughout, equals, excludesKeyThroughout, excludesValueThroughout, get, get, hashCode, hasSizeThroughout, isEmpty, isEmptyThroughout, keySet, putAll, 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, 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

HashMapByDate

public HashMapByDate()
Constructs a new instance of HashMapByDate.


HashMapByDate

public HashMapByDate(DatedMap datedMap)
Constructs a new instance of HashMapByDate initialized with the mappings of datedMap.

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

clone

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

Overrides:
clone in class AbstractMapByDate
Returns:
a clone of this instance

createMap

protected java.util.Map createMap()
Returns a freshly created, empty HashMap.

Specified by:
createMap in class AbstractMapByDate
Returns:
a freshly created, empty HashMap.

copyMap

protected java.util.Map copyMap(java.util.Map map)
Returns a new HashMap initialized with the mappings of map.

Overrides:
copyMap in class AbstractMapByDate
Parameters:
map - mappings to be included in the new map
Returns:
a new HashMap initialized with the mappings of map.


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