felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r581718 - /felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/VersionRange.java
Date Wed, 03 Oct 2007 20:42:27 GMT
Author: rickhall
Date: Wed Oct  3 13:42:25 2007
New Revision: 581718

URL: http://svn.apache.org/viewvc?rev=581718&view=rev
Log:
Updated OBR's VersionRange to match the Framework's VersionRange...duplication
is bad. As a result, OBR's VersionRange will now accept whitespace in its
version range. (FELIX-389)

Modified:
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/VersionRange.java

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/VersionRange.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/VersionRange.java?rev=581718&r1=581717&r2=581718&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/VersionRange.java
(original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/VersionRange.java
Wed Oct  3 13:42:25 2007
@@ -26,6 +26,8 @@
     private boolean m_isLowInclusive = false;
     private Version m_high = null;
     private boolean m_isHighInclusive = false;
+    private String m_toString = null;
+    public static final VersionRange infiniteRange = new VersionRange(Version.emptyVersion,
true, null, true);
 
     public VersionRange(Version low, boolean isLowInclusive,
         Version high, boolean isHighInclusive)
@@ -84,8 +86,8 @@
         if (range.indexOf(',') >= 0)
         {
             String s = range.substring(1, range.length() - 1);
-            String vlo = s.substring(0, s.indexOf(','));
-            String vhi = s.substring(s.indexOf(',') + 1, s.length());
+            String vlo = s.substring(0, s.indexOf(',')).trim();
+            String vhi = s.substring(s.indexOf(',') + 1, s.length()).trim();
             return new VersionRange (
                 new Version(vlo), (range.charAt(0) == '['),
                 new Version(vhi), (range.charAt(range.length() - 1) == ']'));
@@ -95,4 +97,26 @@
             return new VersionRange(new Version(range), true, null, false);
         }
     }
-}
\ No newline at end of file
+
+    public String toString()
+    {
+        if (m_toString == null)
+        {
+            if (m_high != null)
+            {
+                StringBuffer sb = new StringBuffer();
+                sb.append(m_isLowInclusive ? '[' : '(');
+                sb.append(m_low.toString());
+                sb.append(',');
+                sb.append(m_high.toString());
+                sb.append(m_isHighInclusive ? ']' : ')');
+                m_toString = sb.toString();
+            }
+            else
+            {
+                m_toString = m_low.toString();
+            }
+        }
+        return m_toString;
+    }
+}



Mime
View raw message