Examples of asDoubleBuffer()


Examples of java.nio.ByteBuffer.asDoubleBuffer()

        // 1- Allocate merged time buffer
        if (mergedTimeLength != -1){
            try {
                final ByteBuffer bb=ByteBuffer.allocateDirect(8*(int)mergedTimeLength);
                mergedTimeBuffer=bb.asDoubleBuffer();  
            } catch (OutOfMemoryError e) {
                removeAllElements();
                throw new MergeDataException("Not enought memory to perform the data merge");
            }
            for(int i=0;i<mergedTimeLength;i++){
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

            if (mergedTimeBuffer==null) {
                throw new DataException("Collection time buffer is null, canot create direct buffer for data source " + DataInfo.getId(this));
            }
           
            final ByteBuffer bb=ByteBuffer.allocateDirect(8*mergedTimeBuffer.capacity());
            _values = bb.asDoubleBuffer();

            long trIndex = timeRef.getStartIndex();

            for(long ctIndex=mergedTimeDs.getStartIndex();ctIndex<=mergedTimeDs.getLastIndex();ctIndex++){

View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

                if ((length * 8) > Integer.MAX_VALUE) {
                    throw new IllegalArgumentException(DataInfo.getId(timeSource) + "has too many data:" + length);
                }
                if (length > 10000) { // native allocation
                    final ByteBuffer bb = ByteBuffer.allocateDirect(8 * (int) length);
                    db = bb.asDoubleBuffer();
                } else { // heap allocation
                    db = DoubleBuffer.allocate((int) length);
                }
                // Offset conversion : seconds --> milli seconds
                offset *= 1000;
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

      ja[i] = iter.getDoubleNext();
  }

  public ByteBuffer getDataAsByteBuffer() {
    ByteBuffer bb = ByteBuffer.allocate((int)(8*getSize()));
    DoubleBuffer ib = bb.asDoubleBuffer();
    ib.put( (double[]) get1DJavaArray(double.class)); // make sure its in canonical order
    return bb;
  }

/** Return the element class type */
 
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

            if (out instanceof DataBufferByte) {
                byte[] a = ((DataBufferByte)out).getData();
                flipCopyWithGamma(in, widthStep(), ByteBuffer.wrap(a, start, a.length - start), step, false, gamma, flip);
            } else if (out instanceof DataBufferDouble) {
                double[] a = ((DataBufferDouble)out).getData();
                flipCopyWithGamma(in.asDoubleBuffer(), widthStep()/8, DoubleBuffer.wrap(a, start, a.length - start), step, gamma, flip);
            } else if (out instanceof DataBufferFloat) {
                float[] a = ((DataBufferFloat)out).getData();
                flipCopyWithGamma(in.asFloatBuffer(), widthStep()/4, FloatBuffer.wrap(a, start, a.length - start), step, gamma, flip);
            } else if (out instanceof DataBufferInt) {
                int[] a = ((DataBufferInt)out).getData();
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

            if (in instanceof DataBufferByte) {
                byte[] a = ((DataBufferByte)in).getData();
                flipCopyWithGamma(ByteBuffer.wrap(a, start, a.length - start), step, out, widthStep(), false, gamma, false);
            } else if (in instanceof DataBufferDouble) {
                double[] a = ((DataBufferDouble)in).getData();
                flipCopyWithGamma(DoubleBuffer.wrap(a, start, a.length - start), step, out.asDoubleBuffer(), widthStep()/8, gamma, false);
            } else if (in instanceof DataBufferFloat) {
                float[] a = ((DataBufferFloat)in).getData();
                flipCopyWithGamma(FloatBuffer.wrap(a, start, a.length - start), step, out.asFloatBuffer(), widthStep()/4, gamma, false);
            } else if (in instanceof DataBufferInt) {
                int[] a = ((DataBufferInt)in).getData();
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

          ByteArrayInputStream bis = new ByteArrayInputStream(buf.array());
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_DOUBLE_ARRAY)) {
          arrayStart = this.getHeap().heap[getArrayStartAddress(fs.getAddress())];
          buf = ByteBuffer.allocate(arraySize * 8);
          DoubleBuffer doublebuf = buf.asDoubleBuffer();
          double[] doubleArray = new double[arraySize];
          for (int i = arrayStart; i < arrayStart + arraySize; i++) {
            doubleArray[i - arrayStart] = Double.longBitsToDouble(this.getLongHeap().heap[i]);
          }
          doublebuf.put(doubleArray);
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

            cellGroup = new CellGroup<SecurityDoubleValueCell>(activeRowId);
        }
        String label = dbItem.getKey().getColumnQualifier().toString();
        byte [] valueBytes = dbItem.getValue().get();
        ByteBuffer buffer = ByteBuffer.wrap(valueBytes);
        DoubleBuffer dbBuffer = buffer.asDoubleBuffer();
        double value = valueBytes.length > 0 ? dbBuffer.get() : Defaults.defaultValue(double.class);
        String colVis = dbItem.getKey().getColumnVisibility().toString();
        String colFam = dbItem.getKey().getColumnFamily().toString();
        long timestamp = dbItem.getKey().getTimestamp();
        SecurityDoubleValueCell cell;
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

        assertView("duplicate", b, b.duplicate(), 1);
        assertView("char view", b, b.asCharBuffer(), 2);
        assertView("short view", b, b.asShortBuffer(), 2);
        assertView("int view", b, b.asIntBuffer(), 4);
        assertView("float view", b, b.asFloatBuffer(), 4);
        assertView("double view", b, b.asDoubleBuffer(), 8);
        assertView("long view", b, b.asLongBuffer(), 8);
    }
}
View Full Code Here

Examples of java.nio.ByteBuffer.asDoubleBuffer()

    }
    public void testDoubleBufferPut() {
        final double MAGIC = 1234.5678;
        Memory m = new Memory(8);
        ByteBuffer buf = m.getByteBuffer(0, m.size()).order(ByteOrder.nativeOrder());
        DoubleBuffer db = buf.asDoubleBuffer();
        db.put(MAGIC).flip();
        assertEquals("Int not written to memory", MAGIC, m.getDouble(0), 0d);
    }
    public void testIntBufferGet() {
        final int MAGIC = 0xABEDCF23;
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.