Examples of IntArrayStack


Examples of com.gs.collections.impl.stack.mutable.primitive.IntArrayStack

        return this.delegate.collectFloat(floatFunction, target);
    }

    public ImmutableIntStack collectInt(final IntFunction<? super T> intFunction)
    {
        final IntArrayStack result = new IntArrayStack();
        this.delegate.forEach(new Procedure<T>()
        {
            public void value(T each)
            {
                result.push(intFunction.intValueOf(each));
            }
        });
        return result.toImmutable();
    }
View Full Code Here

Examples of com.gs.collections.impl.stack.mutable.primitive.IntArrayStack

        return this.delegate.collectFloat(floatFunction, target);
    }

    public MutableIntStack collectInt(final IntFunction<? super T> intFunction)
    {
        final IntArrayStack result = new IntArrayStack();
        this.delegate.forEach(new Procedure<T>()
        {
            public void value(T each)
            {
                result.push(intFunction.intValueOf(each));
            }
        });
        return result;
    }
View Full Code Here

Examples of org.parboiled.common.IntArrayStack

        return ix2 + original - adapted;
    }

    protected char[] buildBuffer2() {
        StringBuilder sb = new StringBuilder();
        IntArrayStack previousLevels = new IntArrayStack();
        IntArrayStack newlines = new IntArrayStack();
        IntArrayStack newlines2 = new IntArrayStack();
        int length = buffer.length;
        int currentLevel = 0;
        int cursor = 0;
        previousLevels.push(0);

        // consume inital indent
        loop1:
        while (cursor < length) {
            switch (buffer[cursor]) {
                case ' ':
                    cursor++;
                    currentLevel++;
                    break;
                case '\t':
                    cursor++;
                    currentLevel = ((currentLevel / tabStop) + 1) * tabStop;
                    break;
                default:
                    break loop1;
            }
        }
        int indexDelta = currentLevel;

        // transform all other input
        while (cursor < length) {
            char c = buffer[cursor++];
            sb.append(c);
            if (c != '\n') continue;

            newlines.push(cursor - 1);
            newlines2.push(cursor - indexDelta - 1);

            // consume line indent
            int indent = 0;
            loop2:
            while (cursor < length) {
                switch (buffer[cursor]) {
                    case ' ':
                        cursor++;
                        indexDelta++;
                        indent++;
                        break;
                    case '\t':
                        cursor++;
                        indexDelta++;
                        indent = ((indent / tabStop) + 1) * tabStop;
                        break;
                    default:
                        break loop2;
                }
            }

            // generate INDENTS/DEDENTS
            if (indent > currentLevel) {
                previousLevels.push(currentLevel);
                currentLevel = indent;
                sb.append(Chars.INDENT);
                indexDelta--;
            } else {
                while (indent < currentLevel && indent <= previousLevels.peek()) {
                    currentLevel = previousLevels.pop();
                    sb.append(Chars.DEDENT);
                    indexDelta--;
                }
            }
        }

        // make sure to close all remaining indentation scopes
        if (previousLevels.size() > 1) {
            sb.append('\n');
            newlines.push(cursor);
            newlines2.push(cursor - indexDelta);
            while (previousLevels.size() > 1) {
                previousLevels.pop();
                sb.append(Chars.DEDENT);
            }
        }

        this.newlines = new int[newlines.size()];
        newlines.getElements(this.newlines, 0);

        this.newlines2 = new int[newlines2.size()];
        newlines2.getElements(this.newlines2, 0);

        char[] buffer = new char[sb.length()];
        sb.getChars(0, sb.length(), buffer, 0);

        return buffer;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.