felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r917982 - /felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
Date Tue, 02 Mar 2010 11:57:04 GMT
Author: dsavage
Date: Tue Mar  2 11:57:03 2010
New Revision: 917982

URL: http://svn.apache.org/viewvc?rev=917982&view=rev
Log:
Override clone method to perform model specific actions (FELIX-2152) also some minor code
refactoring to move all overridden methods to one block of code

Modified:
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java?rev=917982&r1=917981&r2=917982&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
(original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
Tue Mar  2 11:57:03 2010
@@ -317,39 +317,6 @@
     }
 
 
-    @Override
-    public String toString()
-    {
-        return "SigilBundle["
-            + ( getBundleInfo() == null ? null : ( getBundleInfo().getSymbolicName() + ":"
+ getBundleInfo()
-                .getVersion() ) ) + "]";
-    }
-
-
-    @Override
-    public boolean equals( Object obj )
-    {
-        if ( obj == null )
-            return false;
-        if ( obj == this )
-            return true;
-
-        if ( obj instanceof SigilBundle )
-        {
-            return obj.toString().equals( toString() );
-        }
-
-        return false;
-    }
-
-
-    @Override
-    public int hashCode()
-    {
-        return 31 * toString().hashCode();
-    }
-
-
     public IPath getLicencePathLocation()
     {
         return licencePathLocation;
@@ -436,4 +403,57 @@
         }
         return null;
     }
+    
+    @Override
+    public String toString()
+    {
+        return "SigilBundle["
+            + ( getBundleInfo() == null ? null : ( getBundleInfo().getSymbolicName() + ":"
+ getBundleInfo()
+                .getVersion() ) ) + "]";
+    }
+
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( obj == null )
+            return false;
+        if ( obj == this )
+            return true;
+
+        if ( obj instanceof SigilBundle )
+        {
+            return obj.toString().equals( toString() );
+        }
+
+        return false;
+    }
+
+
+    @Override
+    public int hashCode()
+    {
+        return 31 * toString().hashCode();
+    }
+
+    @Override
+    public SigilBundle clone()
+    {
+        SigilBundle b = (SigilBundle) super.clone();
+        b.bundle = (IBundleModelElement) b.bundle.clone();
+        
+        IPath[] newPaths = new IPath[b.sourcePaths.length];
+        System.arraycopy(b.sourcePaths, 0, newPaths, 0, b.sourcePaths.length);
+        b.sourcePaths = newPaths;
+        
+        String[] tmp = new String[classpath.length];
+        System.arraycopy(b.classpath, 0, tmp, 0, b.classpath.length);
+        b.classpath = tmp;
+        
+        tmp = new String[packages.length];
+        System.arraycopy(b.packages, 0, tmp, 0, b.packages.length);
+        b.packages = tmp;
+
+        return b;
+    }    
 }



Mime
View raw message