Java Doc for ValueTreeMap.java in  » Search-Engine » Jofti » com » jofti » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » Jofti » com.jofti.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jofti.util.AbstractMap
      com.jofti.util.ValueTreeMap

ValueTreeMap
public class ValueTreeMap extends AbstractMap implements Cloneable,java.io.Serializable(Code)
This class is a modified version of the TreeMap class from the Java Collections Framework.

The changes are to allow SQL type multi-attribute sorting by ordering the entries based on a modified comparator/search method that allows value ordering as well as key ordering. However, this slightly breaks the Map semantics as it enables two objects with the same key to be placed in the Map. As this class is not desgned as a general Map this is not a problem as it should be used as am immutable result Map. This may be formalised more closely later on.


author:
   Steve Woodcock
author:
   Josh Bloch and Doug Lea
version:
   1.56, 01/23/03
See Also:   Map
See Also:   HashMap
See Also:   Hashtable
See Also:   Comparable
See Also:   Comparator
See Also:   Collection
See Also:   Collections.synchronizedMap(Map)
since:
   1.2

Inner Class :static class Entry implements Map.Entry
Inner Class :class DefaultComparator implements Comparator

Field Summary
transient volatile  SetkeySet
    
transient volatile  Collectionvalues
    

Constructor Summary
public  ValueTreeMap()
     Constructs a new, empty map, sorted according to the keys' natural order.
public  ValueTreeMap(Comparator c)
     Constructs a new, empty map, sorted according to the given comparator. All keys inserted into the map must be mutually comparable by the given comparator: comparator.compare(k1, k2) must not throw a ClassCastException for any keys k1 and k2 in the map.
public  ValueTreeMap(Map m)
     Constructs a new map containing the same mappings as the given map, sorted according to the keys' natural order.
public  ValueTreeMap(SortedMap m)
     Constructs a new map containing the same mappings as the given SortedMap, sorted according to the same ordering.

Method Summary
 voidaddAllForTreeSet(SortedSet set, Object defaultVal)
    
public  voidclear()
     Removes all mappings from this TreeMap.
public  Objectclone()
     Returns a shallow copy of this TreeMap instance.
public  Comparatorcomparator()
     Returns the comparator used to order this map, or null if this map uses its keys' natural order.
public  booleancontainsKey(Object key)
     Returns true if this map contains a mapping for the specified key.
Parameters:
  key - key whose presence in this map is to be tested.
public  booleancontainsValue(Object value)
     Returns true if this map maps one or more keys to the specified value.
public  SetentrySet()
     Returns a set view of the mappings contained in this map.
public  ObjectfirstKey()
     Returns the first (lowest) key currently in this sorted map.
public  Objectget(Object key)
     Returns the value to which this map maps the specified key.
public  MapgetSubMap(int startEntry, int maxNumber)
    
public  SetkeySet()
     Returns a Set view of the keys contained in this map.
public  ObjectlastKey()
     Returns the last (highest) key currently in this sorted map.
public  Objectput(Object key, Object value)
     Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
Parameters:
  key - key with which the specified value is to be associated.
Parameters:
  value - value to be associated with the specified key.
public  voidputAll(Map map)
    
 voidreadTreeSet(int size, java.io.ObjectInputStream s, Object defaultVal)
    
public  Objectremove(Object key)
     Removes the mapping for this key from this TreeMap if present.
Parameters:
  key - key for which mapping should be removed previous value associated with specified key, or nullif there was no mapping for key.
public  ObjectremoveEntry(Object key, Object value)
    
public  intsize()
     Returns the number of key-value mappings in this map.
public  Collectionvalues()
     Returns a collection view of the values contained in this map.

Field Detail
keySet
transient volatile Set keySet(Code)



values
transient volatile Collection values(Code)




Constructor Detail
ValueTreeMap
public ValueTreeMap()(Code)
Constructs a new, empty map, sorted according to the keys' natural order. All keys inserted into the map must implement the Comparable interface. Furthermore, all such keys must be mutually comparable: k1.compareTo(k2) must not throw a ClassCastException for any elements k1 and k2 in the map. If the user attempts to put a key into the map that violates this constraint (for example, the user attempts to put a string key into a map whose keys are integers), the put(Object key, Object value) call will throw a ClassCastException.
See Also:   Comparable



ValueTreeMap
public ValueTreeMap(Comparator c)(Code)
Constructs a new, empty map, sorted according to the given comparator. All keys inserted into the map must be mutually comparable by the given comparator: comparator.compare(k1, k2) must not throw a ClassCastException for any keys k1 and k2 in the map. If the user attempts to put a key into the map that violates this constraint, the put(Object key, Object value) call will throw a ClassCastException.
Parameters:
  c - the comparator that will be used to sort this map. Anull value indicates that the keys' naturalordering should be used.



ValueTreeMap
public ValueTreeMap(Map m)(Code)
Constructs a new map containing the same mappings as the given map, sorted according to the keys' natural order. All keys inserted into the new map must implement the Comparable interface. Furthermore, all such keys must be mutually comparable: k1.compareTo(k2) must not throw a ClassCastException for any elements k1 and k2 in the map. This method runs in n*log(n) time.
Parameters:
  m - the map whose mappings are to be placed in this map.
throws:
  ClassCastException - the keys in t are not Comparable, orare not mutually comparable.
throws:
  NullPointerException - if the specified map is null.



ValueTreeMap
public ValueTreeMap(SortedMap m)(Code)
Constructs a new map containing the same mappings as the given SortedMap, sorted according to the same ordering. This method runs in linear time.
Parameters:
  m - the sorted map whose mappings are to be placed in this map,and whose comparator is to be used to sort this map.
throws:
  NullPointerException - if the specified sorted map is null.




Method Detail
addAllForTreeSet
void addAllForTreeSet(SortedSet set, Object defaultVal)(Code)
Intended to be called only from TreeSet.addAll *



clear
public void clear()(Code)
Removes all mappings from this TreeMap.



clone
public Object clone()(Code)
Returns a shallow copy of this TreeMap instance. (The keys and values themselves are not cloned.) a shallow copy of this Map.



comparator
public Comparator comparator()(Code)
Returns the comparator used to order this map, or null if this map uses its keys' natural order. the comparator associated with this sorted map, ornull if it uses its keys' natural sort method.



containsKey
public boolean containsKey(Object key)(Code)
Returns true if this map contains a mapping for the specified key.
Parameters:
  key - key whose presence in this map is to be tested. true if this map contains a mapping for thespecified key.
throws:
  ClassCastException - if the key cannot be compared with the keyscurrently in the map.
throws:
  NullPointerException - key is null and this map usesnatural ordering, or its comparator does not toleratenull keys.



containsValue
public boolean containsValue(Object value)(Code)
Returns true if this map maps one or more keys to the specified value. More formally, returns true if and only if this map contains at least one mapping to a value v such that (value==null ? v==null : value.equals(v)). This operation will probably require time linear in the Map size for most implementations of Map.
Parameters:
  value - value whose presence in this Map is to be tested. true if a mapping to value exists;false otherwise.
since:
   1.2



entrySet
public Set entrySet()(Code)
Returns a set view of the mappings contained in this map. The set's iterator returns the mappings in ascending key order. Each element in the returned set is a Map.Entry. The set is backed by this map, so changes to this map are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding mapping from the TreeMap, through the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations. a set view of the mappings contained in this map.
See Also:   Map.Entry



firstKey
public Object firstKey()(Code)
Returns the first (lowest) key currently in this sorted map. the first (lowest) key currently in this sorted map.
throws:
  NoSuchElementException - Map is empty.



get
public Object get(Object key)(Code)
Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.
Parameters:
  key - key whose associated value is to be returned. the value to which this map maps the specified key, ornull if the map contains no mapping for the key.
throws:
  ClassCastException - key cannot be compared with the keyscurrently in the map.
throws:
  NullPointerException - key is null and this map usesnatural ordering, or its comparator does not toleratenull keys.
See Also:   ValueTreeMap.containsKey(Object)



getSubMap
public Map getSubMap(int startEntry, int maxNumber)(Code)



keySet
public Set keySet()(Code)
Returns a Set view of the keys contained in this map. The set's iterator will return the keys in ascending order. The map is backed by this TreeMap instance, so changes to this map are reflected in the Set, and vice-versa. The Set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations. a set view of the keys contained in this TreeMap.



lastKey
public Object lastKey()(Code)
Returns the last (highest) key currently in this sorted map. the last (highest) key currently in this sorted map.
throws:
  NoSuchElementException - Map is empty.



put
public Object put(Object key, Object value)(Code)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
Parameters:
  key - key with which the specified value is to be associated.
Parameters:
  value - value to be associated with the specified key. previous value associated with specified key, or nullif there was no mapping for key. A null return canalso indicate that the map previously associated nullwith the specified key.
throws:
  ClassCastException - key cannot be compared with the keyscurrently in the map.
throws:
  NullPointerException - key is null and this map usesnatural order, or its comparator does not toleratenull keys.



putAll
public void putAll(Map map)(Code)



readTreeSet
void readTreeSet(int size, java.io.ObjectInputStream s, Object defaultVal) throws java.io.IOException, ClassNotFoundException(Code)
Intended to be called only from TreeSet.readObject *



remove
public Object remove(Object key)(Code)
Removes the mapping for this key from this TreeMap if present.
Parameters:
  key - key for which mapping should be removed previous value associated with specified key, or nullif there was no mapping for key. A null return canalso indicate that the map previously associatednull with the specified key.
throws:
  ClassCastException - key cannot be compared with the keyscurrently in the map.
throws:
  NullPointerException - key is null and this map usesnatural order, or its comparator does not toleratenull keys.



removeEntry
public Object removeEntry(Object key, Object value)(Code)



size
public int size()(Code)
Returns the number of key-value mappings in this map. the number of key-value mappings in this map.



values
public Collection values()(Code)
Returns a collection view of the values contained in this map. The collection's iterator will return the values in the order that their corresponding keys appear in the tree. The collection is backed by this TreeMap instance, so changes to this map are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding mapping from the map through the Iterator.remove, Collection.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations. a collection view of the values contained in this map.



Fields inherited from com.jofti.util.AbstractMap
final protected static int defaultCapacity(Code)(Java Doc)
final protected static double defaultMaxLoadFactor(Code)(Java Doc)
final protected static double defaultMinLoadFactor(Code)(Java Doc)
protected int distinct(Code)(Java Doc)
protected int highWaterMark(Code)(Java Doc)
protected int lowWaterMark(Code)(Java Doc)
protected double maxLoadFactor(Code)(Java Doc)
protected double minLoadFactor(Code)(Java Doc)

Methods inherited from com.jofti.util.AbstractMap
protected int chooseGrowCapacity(int size, double minLoad, double maxLoad)(Code)(Java Doc)
protected int chooseHighWaterMark(int capacity, double maxLoad)(Code)(Java Doc)
protected int chooseLowWaterMark(int capacity, double minLoad)(Code)(Java Doc)
protected int chooseMeanCapacity(int size, double minLoad, double maxLoad)(Code)(Java Doc)
protected int chooseShrinkCapacity(int size, double minLoad, double maxLoad)(Code)(Java Doc)
abstract public void clear()(Code)(Java Doc)
abstract public void ensureCapacity(int minCapacity)(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
protected int nextPrime(int desiredCapacity)(Code)(Java Doc)
protected void setUp(int initialCapacity, double minLoadFactor, double maxLoadFactor)(Code)(Java Doc)
public int size()(Code)(Java Doc)
abstract public void trimToSize()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.