Examples of TByteArrayList


Examples of gnu.trove.list.array.TByteArrayList

     * specified capacity.
     *
     * @param capacity the initial depth of the stack
     */
    public TByteArrayStack( int capacity ) {
        _list = new TByteArrayList( capacity );
    }
View Full Code Here

Examples of gnu.trove.list.array.TByteArrayList

     *
     * @param capacity the initial depth of the stack
     * @param no_entry_value value that represents null
     */
    public TByteArrayStack( int capacity, byte no_entry_value ) {
        _list = new TByteArrayList( capacity, no_entry_value );
    }
View Full Code Here

Examples of gnu.trove.list.array.TByteArrayList

     * @param stack the instance to copy
     */
    public TByteArrayStack( TByteStack stack ) {
        if ( stack instanceof TByteArrayStack ) {
            TByteArrayStack array_stack = ( TByteArrayStack ) stack;
            this._list = new TByteArrayList( array_stack._list );
        } else {
            throw new UnsupportedOperationException( "Only support TByteArrayStack" );
        }
    }
View Full Code Here

Examples of gnu.trove.list.array.TByteArrayList

                extractPrimitive(value, json);
            } else if (json.isJsonObject()) {
                extractMap(json, context, value);
            } else if (json.isJsonArray()) {
                JsonArray jsonArray = json.getAsJsonArray();
                TByteList byteList = new TByteArrayList();
                for (JsonElement element : jsonArray) {
                    if (element.isJsonArray()) {
                        value.addValue((EntityData.Value) context.deserialize(element, EntityData.Value.class));
                    } else if (json.isJsonObject()) {
                        extractMap(json, context, value);
                    } else if (element.isJsonPrimitive()) {
                        extractPrimitive(value, element);
                        if (element.getAsJsonPrimitive().isNumber()) {
                            try {
                                byteList.add(element.getAsByte());
                            } catch (NumberFormatException nfe) {
                                byteList.add((byte) 0);
                            }
                        }
                    }
                }
                value.setBytes(ByteString.copyFrom(byteList.toArray()));
            }
            return value.build();
        }
View Full Code Here

Examples of gnu.trove.list.array.TByteArrayList

        return builder.build();
    }

    private static EntityData.RunLengthEncoding8 runLengthEncode8(TeraArray array) {
        EntityData.RunLengthEncoding8.Builder builder = EntityData.RunLengthEncoding8.newBuilder();
        TByteList values = new TByteArrayList(16384);
        byte lastItem = (byte) array.get(0, 0, 0);
        int counter = 0;
        for (int y = 0; y < array.getSizeY(); ++y) {
            for (int z = 0; z < array.getSizeZ(); ++z) {
                for (int x = 0; x < array.getSizeX(); ++x) {
                    byte item = (byte) array.get(x, y, z);
                    if (lastItem != item) {
                        builder.addRunLengths(counter);
                        values.add(lastItem);
                        lastItem = item;
                        counter = 1;
                    } else {
                        counter++;
                    }
                }
            }
        }
        if (lastItem != 0) {
            builder.addRunLengths(counter);
            values.add(lastItem);
        }
        builder.setValues(ByteString.copyFrom(values.toArray()));
        return builder.build();
    }
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.