當前位置: 首頁>>代碼示例>>Java>>正文


Java DoubleBuffer.rewind方法代碼示例

本文整理匯總了Java中java.nio.DoubleBuffer.rewind方法的典型用法代碼示例。如果您正苦於以下問題:Java DoubleBuffer.rewind方法的具體用法?Java DoubleBuffer.rewind怎麽用?Java DoubleBuffer.rewind使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.nio.DoubleBuffer的用法示例。


在下文中一共展示了DoubleBuffer.rewind方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readPcRasterMapValues

import java.nio.DoubleBuffer; //導入方法依賴的package包/類
public static synchronized void readPcRasterMapValues(Jep jep, String variableName, double[] dest) throws JepException {
    String bufferName = "readPcRasterMapValues" + dest.length;
    Map<Integer, DoubleBuffer> map = readPcRasterMapValuesBuffers.get(jep);
    if (map == null) {
        map = new HashMap<Integer, DoubleBuffer>();
        readPcRasterMapValuesBuffers.put(jep, map);
    }
    DoubleBuffer buffer = map.get(dest.length);
    if (buffer == null) {
        buffer = buffers.get(dest.length);
        if (buffer == null) {
            buffer = createNativeDoubleBuffer(dest.length);
            buffers.put(dest.length, buffer);
        }
        declareDoubleArray(jep, bufferName, buffer);
        map.put(dest.length, buffer);
    }
    jep.eval(bufferName + "[:]=reshape(pcr2numpy(" + variableName + ", 1E31), " + dest.length + ')');
    buffer.rewind();
    buffer.get(dest);
}
 
開發者ID:OpenDA-Association,項目名稱:OpenDA,代碼行數:22,代碼來源:WflowPythonToJavaAdapter.java

示例2: clone

import java.nio.DoubleBuffer; //導入方法依賴的package包/類
/**
 * Creates a new DoubleBuffer with the same contents as the given
 * DoubleBuffer. The new DoubleBuffer is seperate from the old one and
 * changes are not reflected across. If you want to reflect changes,
 * consider using Buffer.duplicate().
 * 
 * @param buf
 *            the DoubleBuffer to copy
 * @return the copy
 */
public static DoubleBuffer clone(DoubleBuffer buf) {
    if (buf == null) {
        return null;
    }
    buf.rewind();

    DoubleBuffer copy;
    if (isDirect(buf)) {
        copy = createDoubleBuffer(buf.limit());
    } else {
        copy = DoubleBuffer.allocate(buf.limit());
    }
    copy.put(buf);

    return copy;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:27,代碼來源:BufferUtils.java

示例3: getCursorPos

import java.nio.DoubleBuffer; //導入方法依賴的package包/類
private Vector2f getCursorPos() {
	DoubleBuffer xpos = BufferUtils.createDoubleBuffer(1);
	DoubleBuffer ypos = BufferUtils.createDoubleBuffer(1);
	xpos.rewind();
	xpos.rewind();
	GLFW.glfwGetCursorPos(window.windowID, xpos, ypos);

	double x = xpos.get();
	double y = ypos.get();

	xpos.clear();
	ypos.clear();
	Vector2f result = new Vector2f((float) x, (float) y);
	return result;
}
 
開發者ID:ComunityEngine,項目名稱:CommunityEngine-Java,代碼行數:16,代碼來源:Camera.java

示例4: createDoubleBuffer

import java.nio.DoubleBuffer; //導入方法依賴的package包/類
/**
 * Create a new DoubleBuffer of an appropriate size to hold the specified
 * number of doubles only if the given buffer if not already the right size.
 * 
 * @param buf
 *            the buffer to first check and rewind
 * @param size
 *            number of doubles that need to be held by the newly created
 *            buffer
 * @return the requested new DoubleBuffer
 */
public static DoubleBuffer createDoubleBuffer(DoubleBuffer buf, int size) {
    if (buf != null && buf.limit() == size) {
        buf.rewind();
        return buf;
    }

    buf = createDoubleBuffer(size);
    return buf;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:21,代碼來源:BufferUtils.java


注:本文中的java.nio.DoubleBuffer.rewind方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。