Java Doc for DefaultMapBag.java in  » Library » Apache-common-Collections » org » apache » commons » collections » 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 » Library » Apache common Collections » org.apache.commons.collections 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.collections.DefaultMapBag

All known Subclasses:   org.apache.commons.collections.TreeBag,  org.apache.commons.collections.HashBag,
DefaultMapBag
abstract public class DefaultMapBag implements Bag(Code)
A skeletal implementation of the Bag interface to minimize the effort required for target implementations. Subclasses need only to call setMap(Map) in their constructor (or invoke the Map constructor) specifying a map instance that will be used to store the contents of the bag.

The map will be used to map bag elements to a number; the number represents the number of occurrences of that element in the bag.
since:
   Commons Collections 2.0
version:
   $Revision: 357494 $ $Date: 2005-12-18 19:05:31 +0000 (Sun, 18 Dec 2005) $
author:
   Chuck Burdick
author:
   Michael A. Smith
author:
   Stephen Colebourne
author:
   Janek Bogucki


Inner Class :static class BagIterator implements Iterator


Constructor Summary
public  DefaultMapBag()
     No-argument constructor.
protected  DefaultMapBag(Map map)
     Constructor that assigns the specified Map as the backing store.

Method Summary
public  booleanadd(Object object)
     Adds a new element to the bag by incrementing its count in the underlying map.
public  booleanadd(Object object, int nCopies)
     Adds a new element to the bag by incrementing its count in the map.
public  booleanaddAll(Collection coll)
     Invokes DefaultMapBag.add(Object) for each element in the given collection.
protected  intcalcTotalSize()
    
public  voidclear()
     Clears the bag by clearing the underlying map.
public  booleancontains(Object object)
     Determines if the bag contains the given element by checking if the underlying map contains the element as a key.
public  booleancontainsAll(Collection coll)
     Determines if the bag contains the given elements.
public  booleancontainsAll(Bag other)
     Returns true if the bag contains all elements in the given collection, respecting cardinality.
public  booleanequals(Object object)
     Returns true if the given object is not null, has the precise type of this bag, and contains the same number of occurrences of all the same elements.
public  intgetCount(Object object)
     Returns the number of occurrence of the given element in this bag by looking up its count in the underlying map.
protected  MapgetMap()
     Utility method for implementations to access the map that backs this bag.
public  inthashCode()
     Returns the hash code of the underlying map.
public  booleanisEmpty()
     Returns true if the underlying map is empty.
public  Iteratoriterator()
    
public  booleanremove(Object object)
    
public  booleanremove(Object object, int nCopies)
    
public  booleanremoveAll(Collection coll)
    
public  booleanretainAll(Collection coll)
     Remove any members of the bag that are not in the given bag, respecting cardinality.
public  booleanretainAll(Bag other)
     Remove any members of the bag that are not in the given bag, respecting cardinality.
protected  voidsetMap(Map map)
     Utility method for implementations to set the map that backs this bag.
public  intsize()
     Returns the number of elements in this bag.
public  Object[]toArray()
     Returns an array of all of this bag's elements.
public  Object[]toArray(Object[] array)
     Returns an array of all of this bag's elements.
public  StringtoString()
     Implement a toString() method suitable for debugging.
public  SetuniqueSet()
     Returns an unmodifiable view of the underlying map's key set.


Constructor Detail
DefaultMapBag
public DefaultMapBag()(Code)
No-argument constructor. Subclasses should invoke setMap(Map) in their constructors.



DefaultMapBag
protected DefaultMapBag(Map map)(Code)
Constructor that assigns the specified Map as the backing store. The map must be empty.
Parameters:
  map - the map to assign




Method Detail
add
public boolean add(Object object)(Code)
Adds a new element to the bag by incrementing its count in the underlying map.
Parameters:
  object - the object to add true if the object was not already in the uniqueSet



add
public boolean add(Object object, int nCopies)(Code)
Adds a new element to the bag by incrementing its count in the map.
Parameters:
  object - the object to search for
Parameters:
  nCopies - the number of copies to add true if the object was not already in the uniqueSet



addAll
public boolean addAll(Collection coll)(Code)
Invokes DefaultMapBag.add(Object) for each element in the given collection.
Parameters:
  coll - the collection to add true if this call changed the bag



calcTotalSize
protected int calcTotalSize()(Code)
Actually walks the bag to make sure the count is correct and resets the running total the current total size



clear
public void clear()(Code)
Clears the bag by clearing the underlying map.



contains
public boolean contains(Object object)(Code)
Determines if the bag contains the given element by checking if the underlying map contains the element as a key.
Parameters:
  object - the object to search for true if the bag contains the given element



containsAll
public boolean containsAll(Collection coll)(Code)
Determines if the bag contains the given elements.
Parameters:
  coll - the collection to check against true if the Bag contains all the collection



containsAll
public boolean containsAll(Bag other)(Code)
Returns true if the bag contains all elements in the given collection, respecting cardinality.
Parameters:
  other - the bag to check against true if the Bag contains all the collection



equals
public boolean equals(Object object)(Code)
Returns true if the given object is not null, has the precise type of this bag, and contains the same number of occurrences of all the same elements.
Parameters:
  object - the object to test for equality true if that object equals this bag



getCount
public int getCount(Object object)(Code)
Returns the number of occurrence of the given element in this bag by looking up its count in the underlying map.
Parameters:
  object - the object to search for the number of occurrences of the object, zero if not found



getMap
protected Map getMap()(Code)
Utility method for implementations to access the map that backs this bag. Not intended for interactive use outside of subclasses.



hashCode
public int hashCode()(Code)
Returns the hash code of the underlying map. the hash code of the underlying map



isEmpty
public boolean isEmpty()(Code)
Returns true if the underlying map is empty. true if there are no elements in this bag



iterator
public Iterator iterator()(Code)



remove
public boolean remove(Object object)(Code)



remove
public boolean remove(Object object, int nCopies)(Code)



removeAll
public boolean removeAll(Collection coll)(Code)



retainAll
public boolean retainAll(Collection coll)(Code)
Remove any members of the bag that are not in the given bag, respecting cardinality.
Parameters:
  coll - the collection to retain true if this call changed the collection



retainAll
public boolean retainAll(Bag other)(Code)
Remove any members of the bag that are not in the given bag, respecting cardinality.
See Also:   DefaultMapBag.retainAll(Collection)
Parameters:
  other - the bag to retain true if this call changed the collection



setMap
protected void setMap(Map map)(Code)
Utility method for implementations to set the map that backs this bag. Not intended for interactive use outside of subclasses.



size
public int size()(Code)
Returns the number of elements in this bag. the number of elements in this bag



toArray
public Object[] toArray()(Code)
Returns an array of all of this bag's elements. an array of all of this bag's elements



toArray
public Object[] toArray(Object[] array)(Code)
Returns an array of all of this bag's elements.
Parameters:
  array - the array to populate an array of all of this bag's elements



toString
public String toString()(Code)
Implement a toString() method suitable for debugging. a debugging toString



uniqueSet
public Set uniqueSet()(Code)
Returns an unmodifiable view of the underlying map's key set. the set of unique elements in this bag



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.