Package com.aptana.shared_core.string

Examples of com.aptana.shared_core.string.FastStringBuffer$BackwardCharIterator


    private String getShortMessageStr() {
        Object msg = getShortMessage();
        if (msg instanceof Object[]) {
            Object[] msgs = (Object[]) msg;
            FastStringBuffer buffer = new FastStringBuffer();
            for (Object o : msgs) {
                buffer.append(o.toString());
            }
            return buffer.toString();
        } else {
            return msg.toString();
        }
    }
View Full Code Here


            if (countPercS == o.length) {
                return com.aptana.shared_core.string.StringUtils.format(typeStr, o);

            } else if (countPercS == 1) {
                //if we have only 1, all parameters should be concatenated in a single string
                FastStringBuffer buf = new FastStringBuffer();
                for (int i = 0; i < o.length; i++) {
                    buf.append(o[i].toString());
                    if (i != o.length - 1) {
                        buf.append(" ");
                    }
                }
                shortMessage = buf.toString();

            } else {
                throw new AssertionError("The number of %s is not the number of passed parameters nor 1");
            }
        }
View Full Code Here

        return scopeType;
    }

    @Override
    public String toString() {
        FastStringBuffer buffer = new FastStringBuffer();
        buffer.append("ScopeItem (type:");
        buffer.append(Scope.getScopeTypeStr(scopeType));
        buffer.append(")\n");
        for (Map.Entry<String, List<Found>> entry : m.entrySet()) {
            buffer.append(entry.getKey());
            buffer.append(": contains ");
            buffer.append(entry.getValue().toString());
            buffer.append("\n");
        }
        return buffer.toString();
    }
View Full Code Here

                    Log.log(stdErr);
                }

                monitor.setTaskName("Getting coverage info...(please wait, this could take a while)");
                monitor.worked(1);
                FastStringBuffer tempBuf = new FastStringBuffer();
                for (String str : StringUtils.splitInLines(stdOut)) {
                    analyzeReadLine(monitor, str.trim(), tempBuf);
                }

                monitor.setTaskName("Finished");
View Full Code Here

            this.wasResolved = wasResolved;
        }

        @Override
        public String toString() {
            FastStringBuffer buffer = new FastStringBuffer();
            buffer.append("ImportInfo(");
            buffer.append(" Resolved:");
            buffer.append(wasResolved);
            if (wasResolved) {
                buffer.append(" Rep:");
                buffer.append(rep);
                buffer.append(" Mod:");
                buffer.append(mod != null ? mod.getName() : "null");
            }
            buffer.append(")");
            return buffer.toString();
        }
View Full Code Here

        return scope.peek();
    }

    @Override
    public String toString() {
        FastStringBuffer buffer = new FastStringBuffer();
        buffer.append("Scope: ");
        for (ScopeItems item : scope) {
            buffer.append("\n");
            buffer.appendObject(item);

        }
        return buffer.toString();
    }
View Full Code Here

        }
    }

    @Override
    public List<ModulesKey> getModulesWithToken(String token, IProgressMonitor monitor) {
        FastStringBuffer temp = new FastStringBuffer();
        ArrayList<ModulesKey> ret = new ArrayList<ModulesKey>();
        if (monitor == null) {
            monitor = new NullProgressMonitor();
        }
        if (token == null || token.length() == 0) {
            return ret;
        }

        for (int i = 0; i < token.length(); i++) {
            if (!Character.isJavaIdentifierPart(token.charAt(i))) {
                throw new RuntimeException(com.aptana.shared_core.string.StringUtils.format("Token: %s is not a valid token to search for.", token));
            }
        }
        synchronized (lock) {
            FastStringBuffer bufProgress = new FastStringBuffer();
            //Note that this operation is not as fast as the others, as it relies on a cache that is optimized
            //for space and not for speed (but still, should be faster than having to do a text-search to know the
            //tokens when the cache is available).

            Tuple<List<Tuple<CompleteIndexKey, CompleteIndexValue>>, Collection<CompleteIndexKey>> memoryInfo = completeIndex
                    .getInMemoryInfo();

            long last = System.currentTimeMillis();
            int worked = 0;
            try {
                monitor.beginTask("Get modules with token", memoryInfo.o1.size() + memoryInfo.o2.size());
                for (Tuple<CompleteIndexKey, CompleteIndexValue> tup : memoryInfo.o1) {
                    CompleteIndexKey indexKey = tup.o1;
                    CompleteIndexValue obj = tup.o2;

                    worked++;
                    if (monitor.isCanceled()) {
                        return ret;
                    }
                    long current = System.currentTimeMillis();
                    if (last + 200 < current) {
                        last = current;
                        monitor.setTaskName(bufProgress.clear().append("Searching: ").append(indexKey.key.name)
                                .toString());
                        monitor.worked(worked);
                    }
                    check(indexKey, obj, temp, token, ret);
                }

                for (CompleteIndexKey indexKey : memoryInfo.o2) {
                    worked++;
                    if (monitor.isCanceled()) {
                        return ret;
                    }
                    long current = System.currentTimeMillis();
                    if (last + 200 < current) {
                        last = current;
                        monitor.setTaskName(bufProgress.clear().append("Searching: ").append(indexKey.key.name)
                                .toString());
                        monitor.worked(worked);
                    }
                    check(indexKey, null, temp, token, ret);
                }
View Full Code Here

    private String getIInfoText(IInfo info, String suffix) {
        String path = info.getPath();
        int pathLen;
        if (path != null && (pathLen = path.length()) > 0) {
            int suffixLen = suffix != null ? suffix.length() + 5 : 0;
            FastStringBuffer buf = new FastStringBuffer(info.getDeclaringModuleName(), pathLen + 5 + suffixLen).append(
                    "/").append(path);
            if (suffix != null) {
                return buf.append("   (").append(suffix).append(")").toString();
            }
            return buf.toString();
        }

        String declaringModuleName = info.getDeclaringModuleName();
        if (suffix != null) {
            return new FastStringBuffer(declaringModuleName, suffix.length() + 6).append("   (").append(suffix)
                    .append(")").toString();
        }
        return declaringModuleName;
    }
View Full Code Here

            }
        }

        //The actual values are always recreated lazily (in the case that it's really needed).
        if (obj.entries == null) {
            FastStringBuffer buf;
            ModulesKey key = indexKey.key;
            try {
                if (key instanceof ModulesKeyForZip) {
                    ModulesKeyForZip modulesKeyForZip = (ModulesKeyForZip) key;
                    buf = (FastStringBuffer) FileUtilsFileBuffer.getCustomReturnFromZip(modulesKeyForZip.file,
                            modulesKeyForZip.zipModulePath, FastStringBuffer.class);
                } else {
                    buf = (FastStringBuffer) FileUtils.getFileContentsCustom(key.file, FastStringBuffer.class);
                }
            } catch (Exception e) {
                Log.log(e);
                return;
            }

            HashSet<String> set = new HashSet<String>();
            temp = temp.clear();
            int length = buf.length();
            for (int i = 0; i < length; i++) {
                char c = buf.charAt(i);
                if (Character.isJavaIdentifierStart(c)) {
                    temp.clear();
                    temp.append(c);
                    i++;
                    for (; i < length; i++) {
                        c = buf.charAt(i);
                        if (c == ' ' || c == '\t') {
                            break; //Fast forward through the most common case...
                        }
                        if (Character.isJavaIdentifierPart(c)) {
                            temp.append(c);
View Full Code Here

        try {
            //            Timer timer = new Timer();
            String expected = "-- VERSION_" + AbstractAdditionalTokensInfo.version; //X is the version
            InputStreamReader reader = new InputStreamReader(fileInputStream);
            FastBufferedReader bufferedReader = new FastBufferedReader(reader);
            FastStringBuffer string = bufferedReader.readLine();
            ObjectsPoolMap objectsPoolMap = new ObjectsPool.ObjectsPoolMap();
            if (string != null && string.startsWith("-- VERSION_")) {
                Tuple tupWithResults = new Tuple(new Tuple3(null, null, null), null);
                Tuple3 superTupWithResults = (Tuple3) tupWithResults.o1;
                //tupWithResults.o2 = DiskCache
                if (string.toString().equals(expected)) {
                    //OK, proceed with new I/O format!
                    try {
                        try {
                            FastStringBuffer line;
                            Map<Integer, String> dictionary = null;
                            FastStringBuffer tempBuf = new FastStringBuffer(1024);
                            while ((line = bufferedReader.readLine()) != null) {
                                if (line.startsWith("-- ")) {

                                    if (line.startsWith("-- START TREE 1")) {
                                        superTupWithResults.o1 = TreeIO.loadTreeFrom(bufferedReader, dictionary,
                                                tempBuf.clear(), objectsPoolMap);

                                    } else if (line.startsWith("-- START TREE 2")) {
                                        superTupWithResults.o2 = TreeIO.loadTreeFrom(bufferedReader, dictionary,
                                                tempBuf.clear(), objectsPoolMap);

                                    } else if (line.startsWith("-- START DICTIONARY")) {
                                        dictionary = TreeIO.loadDictFrom(bufferedReader, tempBuf.clear(),
                                                objectsPoolMap);

                                    } else if (line.startsWith("-- START DISKCACHE")) {
                                        tupWithResults.o2 = DiskCache.loadFrom(bufferedReader, objectsPoolMap);
View Full Code Here

TOP

Related Classes of com.aptana.shared_core.string.FastStringBuffer$BackwardCharIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.