当前位置: 首页>>代码示例>>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;未经允许,请勿转载。