You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/03/18 22:35:13 UTC

svn commit: r1579055 - /felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java

Author: pderop
Date: Tue Mar 18 21:35:13 2014
New Revision: 1579055

URL: http://svn.apache.org/r1579055
Log:
added this event for bundle events

Added:
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java?rev=1579055&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/impl/BundleEventImpl.java Tue Mar 18 21:35:13 2014
@@ -0,0 +1,40 @@
+package dm.impl;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+
+public class BundleEventImpl extends EventImpl implements Comparable {
+    final Bundle m_bundle;
+    final BundleEvent m_event;
+    
+    public BundleEventImpl(Bundle bundle, BundleEvent event) {
+        m_bundle = bundle;
+        m_event = event;
+    }
+    
+    public Bundle getBundle() {
+        return m_bundle;
+    }
+    
+    public BundleEvent getBundleEvent() {
+        return m_event;
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof BundleEventImpl) {
+            return getBundle().getBundleId() == ((BundleEventImpl) obj).getBundle().getBundleId();
+        }
+        return false;
+    }
+    
+    @Override
+    public int hashCode() {
+        return getBundle().hashCode();
+    }
+
+    @Override
+    public int compareTo(Object b) {
+        return Long.compare(getBundle().getBundleId(), ((BundleEventImpl) b).getBundle().getBundleId());
+    }
+}