aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/poifs
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2015-09-12 18:45:07 +0000
committerAndreas Beeker <kiwiwings@apache.org>2015-09-12 18:45:07 +0000
commitfbcf869f48e696a28ea364b8ff394476a96cdd21 (patch)
tree636ea213a2b2f8c826ee4ba8f1ac650d918869e3 /src/java/org/apache/poi/poifs
parentf580fb0d728ad52873fb28be121e436f92fadfbb (diff)
downloadpoi-fbcf869f48e696a28ea364b8ff394476a96cdd21.tar.gz
poi-fbcf869f48e696a28ea364b8ff394476a96cdd21.zip
fix eclipse warning - mostly generics cosmetics
close resources in tests junit4 conversions convert spreadsheet based formular test to junit parameterized tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1702659 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs')
-rw-r--r--src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java b/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java
index 86a40c131c..1ea85f7c81 100644
--- a/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java
+++ b/src/java/org/apache/poi/poifs/eventfilesystem/POIFSReaderRegistry.java
@@ -36,20 +36,20 @@ class POIFSReaderRegistry
{
// the POIFSReaderListeners who listen to all POIFSReaderEvents
- private Set omnivorousListeners;
+ private Set<POIFSReaderListener> omnivorousListeners;
// Each mapping in this Map has a key consisting of a
// POIFSReaderListener and a value cosisting of a Set of
// DocumentDescriptors for the documents that POIFSReaderListener
// is interested in; used to efficiently manage the registry
- private Map selectiveListeners;
+ private Map<POIFSReaderListener, Set<DocumentDescriptor>> selectiveListeners;
// Each mapping in this Map has a key consisting of a
// DocumentDescriptor and a value consisting of a Set of
// POIFSReaderListeners for the document matching that
// DocumentDescriptor; used when a document is found, to quickly
// get the listeners interested in that document
- private Map chosenDocumentDescriptors;
+ private Map<DocumentDescriptor,Set<POIFSReaderListener>> chosenDocumentDescriptors;
/**
* Construct the registry
@@ -57,9 +57,9 @@ class POIFSReaderRegistry
POIFSReaderRegistry()
{
- omnivorousListeners = new HashSet();
- selectiveListeners = new HashMap();
- chosenDocumentDescriptors = new HashMap();
+ omnivorousListeners = new HashSet<POIFSReaderListener>();
+ selectiveListeners = new HashMap<POIFSReaderListener, Set<DocumentDescriptor>>();
+ chosenDocumentDescriptors = new HashMap<DocumentDescriptor,Set<POIFSReaderListener>>();
}
/**
@@ -79,13 +79,13 @@ class POIFSReaderRegistry
// not an omnivorous listener (if it was, this method is a
// no-op)
- Set descriptors = ( Set ) selectiveListeners.get(listener);
+ Set<DocumentDescriptor> descriptors = selectiveListeners.get(listener);
if (descriptors == null)
{
// this listener has not registered before
- descriptors = new HashSet();
+ descriptors = new HashSet<DocumentDescriptor>();
selectiveListeners.put(listener, descriptors);
}
DocumentDescriptor descriptor = new DocumentDescriptor(path,
@@ -97,14 +97,14 @@ class POIFSReaderRegistry
// this listener wasn't already listening for this
// document -- add the listener to the set of
// listeners for this document
- Set listeners =
- ( Set ) chosenDocumentDescriptors.get(descriptor);
+ Set<POIFSReaderListener> listeners =
+ chosenDocumentDescriptors.get(descriptor);
if (listeners == null)
{
// nobody was listening for this document before
- listeners = new HashSet();
+ listeners = new HashSet<POIFSReaderListener>();
chosenDocumentDescriptors.put(descriptor, listeners);
}
listeners.add(listener);
@@ -141,31 +141,30 @@ class POIFSReaderRegistry
* @return an Iterator POIFSReaderListeners; may be empty
*/
- Iterator getListeners(final POIFSDocumentPath path, final String name)
+ Iterator<POIFSReaderListener> getListeners(final POIFSDocumentPath path, final String name)
{
- Set rval = new HashSet(omnivorousListeners);
- Set selectiveListeners =
- ( Set ) chosenDocumentDescriptors.get(new DocumentDescriptor(path,
- name));
+ Set<POIFSReaderListener> rval = new HashSet<POIFSReaderListener>(omnivorousListeners);
+ Set<POIFSReaderListener> selectiveListenersInner =
+ chosenDocumentDescriptors.get(new DocumentDescriptor(path, name));
- if (selectiveListeners != null)
+ if (selectiveListenersInner != null)
{
- rval.addAll(selectiveListeners);
+ rval.addAll(selectiveListenersInner);
}
return rval.iterator();
}
private void removeSelectiveListener(final POIFSReaderListener listener)
{
- Set selectedDescriptors = ( Set ) selectiveListeners.remove(listener);
+ Set<DocumentDescriptor> selectedDescriptors = selectiveListeners.remove(listener);
if (selectedDescriptors != null)
{
- Iterator iter = selectedDescriptors.iterator();
+ Iterator<DocumentDescriptor> iter = selectedDescriptors.iterator();
while (iter.hasNext())
{
- dropDocument(listener, ( DocumentDescriptor ) iter.next());
+ dropDocument(listener, iter.next());
}
}
}
@@ -173,7 +172,7 @@ class POIFSReaderRegistry
private void dropDocument(final POIFSReaderListener listener,
final DocumentDescriptor descriptor)
{
- Set listeners = ( Set ) chosenDocumentDescriptors.get(descriptor);
+ Set<POIFSReaderListener> listeners = chosenDocumentDescriptors.get(descriptor);
listeners.remove(listener);
if (listeners.size() == 0)