org.chorem.jtimer.utils
Class DailySortedMap<T>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<Date,T>
          extended by org.chorem.jtimer.utils.DailySortedMap<T>
Type Parameters:
T - values type
All Implemented Interfaces:
Serializable, Cloneable, Map<Date,T>, NavigableMap<Date,T>, SortedMap<Date,T>

public class DailySortedMap<T>
extends TreeMap<Date,T>

SortedMap that return a unique value for all date for a day.

Version:
$Revision: 2607 $ Last update : $Date: 2009-06-18 17:19:19 +0200 (jeu. 18 juin 2009) $ By : $Author: echatellier $
Author:
chatellier
See Also:
SortedMap, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
DailySortedMap()
          Constructs a new, empty tree map, using the natural ordering of its keys.
DailySortedMap(Comparator<? super Date> comparator)
          Constructs a new, empty tree map, ordered according to the given comparator.
DailySortedMap(Map<? extends Date,? extends T> m)
          Constructs a new tree map containing the same mappings as the given map, ordered according to the natural ordering of its keys.
DailySortedMap(SortedMap<Date,? extends T> m)
          Constructs a new tree map containing the same mappings and using the same ordering as the specified sorted map.
 
Method Summary
 Map.Entry<Date,T> ceilingEntry(Date key)
          
 Date ceilingKey(Date key)
          
 boolean containsKey(Object key)
          
 Map.Entry<Date,T> floorEntry(Date key)
          
 Date floorKey(Date key)
          
 T get(Object key)
          
protected  Date getDayDate(Date date)
          Get date at 0h00:00.000.
 SortedMap<Date,T> headMap(Date toKey)
          
 NavigableMap<Date,T> headMap(Date toKey, boolean inclusive)
          
 Map.Entry<Date,T> higherEntry(Date key)
          
 Date higherKey(Date key)
          
 Map.Entry<Date,T> lowerEntry(Date key)
          
 Date lowerKey(Date key)
          
 T put(Date key, T value)
          
 void putAll(Map<? extends Date,? extends T> map)
          
 NavigableMap<Date,T> subMap(Date fromKey, boolean fromInclusive, Date toKey, boolean toInclusive)
          
 SortedMap<Date,T> subMap(Date fromKey, Date toKey)
          
 SortedMap<Date,T> tailMap(Date fromKey)
          
 NavigableMap<Date,T> tailMap(Date fromKey, boolean inclusive)
          
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, keySet, lastEntry, lastKey, navigableKeySet, pollFirstEntry, pollLastEntry, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

DailySortedMap

public DailySortedMap()
Constructs a new, empty tree map, using the natural ordering of its keys.


DailySortedMap

public DailySortedMap(Comparator<? super Date> comparator)
Constructs a new, empty tree map, ordered according to the given comparator.

Parameters:
comparator - comparator

DailySortedMap

public DailySortedMap(Map<? extends Date,? extends T> m)
Constructs a new tree map containing the same mappings as the given map, ordered according to the natural ordering of its keys.

Parameters:
m - init map

DailySortedMap

public DailySortedMap(SortedMap<Date,? extends T> m)
Constructs a new tree map containing the same mappings and using the same ordering as the specified sorted map.

Parameters:
m - init map
Method Detail

ceilingEntry

public Map.Entry<Date,T> ceilingEntry(Date key)

Specified by:
ceilingEntry in interface NavigableMap<Date,T>
Overrides:
ceilingEntry in class TreeMap<Date,T>

ceilingKey

public Date ceilingKey(Date key)

Specified by:
ceilingKey in interface NavigableMap<Date,T>
Overrides:
ceilingKey in class TreeMap<Date,T>

containsKey

public boolean containsKey(Object key)

Specified by:
containsKey in interface Map<Date,T>
Overrides:
containsKey in class TreeMap<Date,T>

floorEntry

public Map.Entry<Date,T> floorEntry(Date key)

Specified by:
floorEntry in interface NavigableMap<Date,T>
Overrides:
floorEntry in class TreeMap<Date,T>

floorKey

public Date floorKey(Date key)

Specified by:
floorKey in interface NavigableMap<Date,T>
Overrides:
floorKey in class TreeMap<Date,T>

get

public T get(Object key)

Specified by:
get in interface Map<Date,T>
Overrides:
get in class TreeMap<Date,T>

headMap

public NavigableMap<Date,T> headMap(Date toKey,
                                    boolean inclusive)

Specified by:
headMap in interface NavigableMap<Date,T>
Overrides:
headMap in class TreeMap<Date,T>

headMap

public SortedMap<Date,T> headMap(Date toKey)

Specified by:
headMap in interface NavigableMap<Date,T>
Specified by:
headMap in interface SortedMap<Date,T>
Overrides:
headMap in class TreeMap<Date,T>

higherEntry

public Map.Entry<Date,T> higherEntry(Date key)

Specified by:
higherEntry in interface NavigableMap<Date,T>
Overrides:
higherEntry in class TreeMap<Date,T>

higherKey

public Date higherKey(Date key)

Specified by:
higherKey in interface NavigableMap<Date,T>
Overrides:
higherKey in class TreeMap<Date,T>

lowerEntry

public Map.Entry<Date,T> lowerEntry(Date key)

Specified by:
lowerEntry in interface NavigableMap<Date,T>
Overrides:
lowerEntry in class TreeMap<Date,T>

lowerKey

public Date lowerKey(Date key)

Specified by:
lowerKey in interface NavigableMap<Date,T>
Overrides:
lowerKey in class TreeMap<Date,T>

put

public T put(Date key,
             T value)

Specified by:
put in interface Map<Date,T>
Overrides:
put in class TreeMap<Date,T>

putAll

public void putAll(Map<? extends Date,? extends T> map)

Specified by:
putAll in interface Map<Date,T>
Overrides:
putAll in class TreeMap<Date,T>

subMap

public NavigableMap<Date,T> subMap(Date fromKey,
                                   boolean fromInclusive,
                                   Date toKey,
                                   boolean toInclusive)

Specified by:
subMap in interface NavigableMap<Date,T>
Overrides:
subMap in class TreeMap<Date,T>

subMap

public SortedMap<Date,T> subMap(Date fromKey,
                                Date toKey)

Specified by:
subMap in interface NavigableMap<Date,T>
Specified by:
subMap in interface SortedMap<Date,T>
Overrides:
subMap in class TreeMap<Date,T>

tailMap

public NavigableMap<Date,T> tailMap(Date fromKey,
                                    boolean inclusive)

Specified by:
tailMap in interface NavigableMap<Date,T>
Overrides:
tailMap in class TreeMap<Date,T>

tailMap

public SortedMap<Date,T> tailMap(Date fromKey)

Specified by:
tailMap in interface NavigableMap<Date,T>
Specified by:
tailMap in interface SortedMap<Date,T>
Overrides:
tailMap in class TreeMap<Date,T>

getDayDate

protected Date getDayDate(Date date)
Get date at 0h00:00.000.

Parameters:
date - date to convert
Returns:
day date


Copyright © 2007-2009 CodeLutin. All Rights Reserved.