[Pydev-cvs] org.python.pydev.core/src/org/python/pydev/core ModulesKey.java, 1.5, 1.6 ICodeCompleti
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-05-18 20:02:27
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28562/src/org/python/pydev/core Modified Files: ModulesKey.java ICodeCompletionASTManager.java FullRepIterable.java Log Message: Created structure to help dealing with imports in files, even if the file does not have a correct AST Refactor: Moved methods from FullRepIterable to StringUtils Index: FullRepIterable.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/FullRepIterable.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** FullRepIterable.java 24 Feb 2007 12:39:51 -0000 1.19 --- FullRepIterable.java 18 May 2008 20:02:26 -0000 1.20 *************** *** 4,10 **** package org.python.pydev.core; - import java.util.ArrayList; import java.util.Iterator; /** * iterates through a string so that parts of it are gotten each time in a progressive way based on dots --- 4,11 ---- package org.python.pydev.core; import java.util.Iterator; + import org.python.pydev.core.docutils.StringUtils; + /** * iterates through a string so that parts of it are gotten each time in a progressive way based on dots *************** *** 231,235 **** */ public static boolean containsPart(String foundRep, String nameToFind) { ! String[] strings = dotSplit(foundRep); for (String string : strings) { if(string.equals(nameToFind)){ --- 232,236 ---- */ public static boolean containsPart(String foundRep, String nameToFind) { ! String[] strings = StringUtils.dotSplit(foundRep); for (String string : strings) { if(string.equals(nameToFind)){ *************** *** 239,285 **** return false; } - - /** - * Splits some string given some char - */ - public static String[] split(String string, char toSplit) { - ArrayList<String> ret = new ArrayList<String>(); - int len = string.length(); - - int last = 0; - - char c = 0; - - for (int i = 0; i < len; i++) { - c = string.charAt(i); - if(c == toSplit){ - if(last != i){ - ret.add(string.substring(last, i)); - } - while(c == toSplit && i < len-1){ - i++; - c = string.charAt(i); - } - last = i; - } - } - if(c != toSplit){ - if(last == 0 && len > 0){ - ret.add(string); //it is equal to the original (no dots) - - }else if(last < len){ - ret.add(string.substring(last, len)); - - } - } - return ret.toArray(new String[ret.size()]); - } - - /** - * Splits the string as would string.split("\\."), but without yielding empty strings - */ - public static String[] dotSplit(String string) { - return split(string, '.'); - } --- 240,243 ---- Index: ModulesKey.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ModulesKey.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ModulesKey.java 5 Nov 2007 00:28:56 -0000 1.5 --- ModulesKey.java 18 May 2008 20:02:26 -0000 1.6 *************** *** 9,12 **** --- 9,14 ---- import java.io.Serializable; + import org.python.pydev.core.docutils.StringUtils; + /** * This class defines the key to use for some module. All its operations are based on its name. *************** *** 91,95 **** */ public boolean hasPartStartingWith(String startingWithLowerCase) { ! for (String mod : FullRepIterable.dotSplit(this.name.toLowerCase())) { if(mod.startsWith(startingWithLowerCase)){ return true; --- 93,97 ---- */ public boolean hasPartStartingWith(String startingWithLowerCase) { ! for (String mod : StringUtils.dotSplit(this.name.toLowerCase())) { if(mod.startsWith(startingWithLowerCase)){ return true; Index: ICodeCompletionASTManager.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/ICodeCompletionASTManager.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ICodeCompletionASTManager.java 20 Oct 2007 19:31:39 -0000 1.16 --- ICodeCompletionASTManager.java 18 May 2008 20:02:26 -0000 1.17 *************** *** 81,85 **** /** ! * Returns the imports that start with a given string. The comparisson is not case dependent. Passes all the modules in the cache. * * @param initial: this is the initial module (e.g.: foo.bar) or an empty string. --- 81,85 ---- /** ! * Returns the imports that start with a given string. The comparison is not case dependent. Passes all the modules in the cache. * * @param initial: this is the initial module (e.g.: foo.bar) or an empty string. |