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


java.lang.Object
   org.apache.commons.collections.bag.AbstractMapBag

All known Subclasses:   org.apache.commons.collections.bag.HashBag,  org.apache.commons.collections.bag.TreeBag,
AbstractMapBag
abstract public class AbstractMapBag implements Bag(Code)
Abstract implementation of the Bag interface to simplify the creation of subclass implementations.

Subclasses specify a Map implementation to use as the internal storage. 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 3.0 (previously DefaultMapBag v2.0)
version:
   $Revision: 219131 $ $Date: 2005-07-15 00:11:12 +0100 (Fri, 15 Jul 2005) $
author:
   Chuck Burdick
author:
   Michael A. Smith
author:
   Stephen Colebourne
author:
   Janek Bogucki
author:
   Steve Clark


Inner Class :static class BagIterator implements Iterator
Inner Class :protected static class MutableInteger


Constructor Summary
protected  AbstractMapBag()
     Constructor needed for subclass serialisation.
protected  AbstractMapBag(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, incrementing its count in the underlying map.
public  booleanadd(Object object, int nCopies)
     Adds a new element to the bag, incrementing its count in the map.
public  booleanaddAll(Collection coll)
     Invokes AbstractMapBag.add(Object) for each element in the given collection.
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.
 booleancontainsAll(Bag other)
     Returns true if the bag contains all elements in the given collection, respecting cardinality.
protected  voiddoReadObject(Map map, ObjectInputStream in)
     Read the map in using a custom routine.
protected  voiddoWriteObject(ObjectOutputStream out)
     Write the map out using a custom routine.
public  booleanequals(Object object)
     Compares this Bag to another.
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()
     Gets a hash code for the Bag compatible with the definition of equals.
public  booleanisEmpty()
     Returns true if the underlying map is empty.
public  Iteratoriterator()
     Gets an iterator over the bag elements.
public  booleanremove(Object object)
     Removes all copies of the specified object from the bag.
public  booleanremove(Object object, int nCopies)
     Removes a specified number of copies of an object from the bag.
public  booleanremoveAll(Collection coll)
     Removes objects from the bag according to their count in the specified collection.
public  booleanretainAll(Collection coll)
     Remove any members of the bag that are not in the given bag, respecting cardinality.
 booleanretainAll(Bag other)
     Remove any members of the bag that are not in the given bag, respecting cardinality.
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
AbstractMapBag
protected AbstractMapBag()(Code)
Constructor needed for subclass serialisation.



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




Method Detail
add
public boolean add(Object object)(Code)
Adds a new element to the bag, 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, 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 AbstractMapBag.add(Object) for each element in the given collection.
Parameters:
  coll - the collection to add true if this call changed the bag



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
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



doReadObject
protected void doReadObject(Map map, ObjectInputStream in) throws IOException, ClassNotFoundException(Code)
Read the map in using a custom routine.
Parameters:
  map - the map to use
Parameters:
  in - the input stream
throws:
  IOException -
throws:
  ClassNotFoundException -



doWriteObject
protected void doWriteObject(ObjectOutputStream out) throws IOException(Code)
Write the map out using a custom routine.
Parameters:
  out - the output stream
throws:
  IOException -



equals
public boolean equals(Object object)(Code)
Compares this Bag to another. This Bag equals another Bag if it contains the same number of occurrences of the same elements.
Parameters:
  object - the Bag to compare to true if equal



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. the map being used by the Bag



hashCode
public int hashCode()(Code)
Gets a hash code for the Bag compatible with the definition of equals. The hash code is defined as the sum total of a hash code for each element. The per element hash code is defined as (e==null ? 0 : e.hashCode()) ^ noOccurances). This hash code is compatible with the Set interface. the hash code of the Bag



isEmpty
public boolean isEmpty()(Code)
Returns true if the underlying map is empty. true if bag is empty



iterator
public Iterator iterator()(Code)
Gets an iterator over the bag elements. Elements present in the Bag more than once will be returned repeatedly. the iterator



remove
public boolean remove(Object object)(Code)
Removes all copies of the specified object from the bag.
Parameters:
  object - the object to remove true if the bag changed



remove
public boolean remove(Object object, int nCopies)(Code)
Removes a specified number of copies of an object from the bag.
Parameters:
  object - the object to remove
Parameters:
  nCopies - the number of copies to remove true if the bag changed



removeAll
public boolean removeAll(Collection coll)(Code)
Removes objects from the bag according to their count in the specified collection.
Parameters:
  coll - the collection to use true if the bag changed



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
boolean retainAll(Bag other)(Code)
Remove any members of the bag that are not in the given bag, respecting cardinality.
See Also:   AbstractMapBag.retainAll(Collection)
Parameters:
  other - the bag to retain true if this call changed the collection



size
public int size()(Code)
Returns the number of elements in this bag. current size of the 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.