public void add( byte[] vals ) { synchronized( mutex ) { list.add( vals ); } } public void add( byte[] vals, int offset, int length ) {
public void add( byte[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } }
@Override public EntityData.Value deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { EntityData.Value.Builder value = EntityData.Value.newBuilder(); if (json.isJsonPrimitive()) { 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 (element.isJsonObject()) { value.addValue((EntityData.Value) context.deserialize(element, EntityData.Value.class)); } 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(); }
/** {@inheritDoc} */ public TByteList grep(TByteProcedure condition) { TByteList ret = new TByteLinkedList(); for (TByteLink l = head; got(l); l = l.getNext()) { if (condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }
/** {@inheritDoc} */ public TByteList inverseGrep(TByteProcedure condition) { TByteList ret = new TByteLinkedList(); for (TByteLink l = head; got(l); l = l.getNext()) { if (!condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }
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(); }
public void add( byte[] vals ) { synchronized( mutex ) { list.add( vals ); } } public void add( byte[] vals, int offset, int length ) {
@Override public void add( byte[] vals ) { synchronized( mutex ) { list.add( vals ); } } @Override
public void add( byte[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } }
public void add( byte[] vals ) { synchronized( mutex ) { list.add( vals ); } } public void add( byte[] vals, int offset, int length ) {
@Override public void add( byte[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } }
public void add( byte[] vals ) { synchronized( mutex ) { list.add( vals ); } } public void add( byte[] vals, int offset, int length ) {
public void add( byte[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } }
public void add( byte[] vals, int offset, int length ) { synchronized( mutex ) { list.add( vals, offset, length ); } }
/** * Add a vertex, specifying its coordinates in fixed-point lat and lon. * @return the index of the new vertex. */ public int addVertexFixed (int fixedLat, int fixedLon) { int vertexIndex = vertexFlags.size(); fixedLats.add(fixedLat); fixedLons.add(fixedLon); vertexFlags.add((byte)0); return vertexIndex; }
/** * Add a vertex, specifying its coordinates in fixed-point lat and lon. * @return the index of the new vertex. */ public int addVertexFixed (int fixedLat, int fixedLon) { int vertexIndex = vertexFlags.size(); fixedLats.add(fixedLat); fixedLons.add(fixedLon); vertexFlags.add((byte)0); return vertexIndex; }
/** {@inheritDoc} */ public TByteList inverseGrep(TByteProcedure condition) { TByteList ret = new TByteLinkedList(); for (TByteLink l = head; got(l); l = l.getNext()) { if (!condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }
/** {@inheritDoc} */ public TByteList grep(TByteProcedure condition) { TByteList ret = new TByteLinkedList(); for (TByteLink l = head; got(l); l = l.getNext()) { if (condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }
/** {@inheritDoc} */ @Override public TByteList inverseGrep(TByteProcedure condition) { TByteList ret = new TByteLinkedList(); for (TByteLink l = head; got(l); l = l.getNext()) { if (!condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }
/** {@inheritDoc} */ @Override public TByteList grep(TByteProcedure condition) { TByteList ret = new TByteLinkedList(); for (TByteLink l = head; got(l); l = l.getNext()) { if (condition.execute(l.getValue())) ret.add(l.getValue()); } return ret; }