[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[imp-commit] r22955 - in trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts: . impl impl/fast

Author: jvinju
Date: 2012-01-06 04:31:56 -0500 (Fri, 06 Jan 2012)
New Revision: 22955

Modified:
   trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/IString.java
   trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/StringValue.java
   trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/fast/StringValue.java
Log:
added substring(int start)

Modified: trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/IString.java
===================================================================
--- trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/IString.java	2012-01-06 09:31:41 UTC (rev 22954)
+++ trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/IString.java	2012-01-06 09:31:56 UTC (rev 22955)
@@ -41,11 +41,17 @@
      *  
      * @param start the inclusive start index
      * @param end   the exclusive end index
-     * @return
      */
     IString substring(int start, int end);
     
     /**
+     * Computes a substring
+     *  
+     * @param start the inclusive start index
+     */
+    IString substring(int start);
+    
+    /**
      * Compares two strings lexicographically
      * @param other
      * @return -1 if receiver is less than other, 0 is receiver is equal, 1 if receiver is larger

Modified: trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/StringValue.java
===================================================================
--- trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/StringValue.java	2012-01-06 09:31:41 UTC (rev 22954)
+++ trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/StringValue.java	2012-01-06 09:31:56 UTC (rev 22955)
@@ -80,6 +80,10 @@
 	public IString substring(int start, int end) {
 		 return new StringValue(fValue.substring(fValue.offsetByCodePoints(0, start),fValue.offsetByCodePoints(0, end)));
 	}
+	
+	public IString substring(int start) {
+		 return new StringValue(fValue.substring(fValue.offsetByCodePoints(0, start)));
+	}
 
 	public int charAt(int index) {
 		return codePointAt(fValue, index);

Modified: trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/fast/StringValue.java
===================================================================
--- trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/fast/StringValue.java	2012-01-06 09:31:41 UTC (rev 22954)
+++ trunk/org.eclipse.imp.pdb.values/src/org/eclipse/imp/pdb/facts/impl/fast/StringValue.java	2012-01-06 09:31:56 UTC (rev 22955)
@@ -98,6 +98,10 @@
 		 return new StringValue(value.substring(value.offsetByCodePoints(0, start),value.offsetByCodePoints(0, end)));
 	}
 
+	public IString substring(int start) {
+		 return new StringValue(value.substring(value.offsetByCodePoints(0, start)));
+	}
+	
 	public int charAt(int index) {
 		return codePointAt(value, index);
 	}