felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r448932 - /incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
Date Fri, 22 Sep 2006 13:51:58 GMT
Author: rickhall
Date: Fri Sep 22 06:51:57 2006
New Revision: 448932

URL: http://svn.apache.org/viewvc?view=rev&rev=448932
Log:
Added toString() method for pretty printing.

Modified:
    incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java

Modified: incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java?view=diff&rev=448932&r1=448931&r2=448932
==============================================================================
--- incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
(original)
+++ incubator/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
Fri Sep 22 06:51:57 2006
@@ -26,6 +26,7 @@
     private boolean m_isLowInclusive = false;
     private Version m_high = null;
     private boolean m_isHighInclusive = false;
+    private String m_toString = null;
 
     public VersionRange(Version low, boolean isLowInclusive,
         Version high, boolean isHighInclusive)
@@ -94,5 +95,26 @@
         {
             return new VersionRange(new Version(range), true, null, false);
         }
+    }
+
+    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 ? ')' : ']');
+            }
+            else
+            {
+                m_toString = m_low.toString();
+            }
+        }
+        return m_toString;
     }
 }



Mime
View raw message