本文整理汇总了Java中java.nio.IntBuffer.put方法的典型用法代码示例。如果您正苦于以下问题:Java IntBuffer.put方法的具体用法?Java IntBuffer.put怎么用?Java IntBuffer.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.nio.IntBuffer
的用法示例。
在下文中一共展示了IntBuffer.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: T_short_filter_3
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Test
public void T_short_filter_3() throws IOException{
List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
dic.add( new ShortObj( (short) 1000 ) );
dic.add( new ShortObj( (short) 2000 ) );
dic.add( new ShortObj( (short) 3000 ) );
dic.add( new ShortObj( (short) 4000 ) );
dic.add( new ShortObj( (short) 5000 ) );
IntBuffer buffer = IntBuffer.allocate( 100 );
for( int i = 0 ; i < 100 ; i++ ){
buffer.put( i % 5 );
}
ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.SHORT , new TestDicManager( dic ) , buffer );
IFilter filter = new NumberFilter( NumberFilterType.LT , new ShortObj( (short) 2000 ) );
FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
assertEquals( result.size() , 20 );
for( int i = 0,n=0 ; n < 100 ; i++,n+=5 ){
assertEquals( result.get(i) , n );
}
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:22,代码来源:TestBufferDirectSequentialNumberCellIndexShort.java
示例2: convertMask
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer convertMask(int[][] cursorMask)
{
ByteBuffer bb = ByteBuffer.allocateDirect(cursorMask.length*cursorMask[0].length*4);
bb.order(ByteOrder.nativeOrder());
IntBuffer ib = bb.asIntBuffer();
for(int y = cursorMask.length - 1; y >= 0; y--)
{
for(int x = 0; x < cursorMask[0].length; x++)
{
ib.put(cursorMask[y][x]);
}
}
ib.flip();
return ib;
}
示例3: T_int_filter_7
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Test
public void T_int_filter_7() throws IOException{
List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
dic.add( new IntegerObj( 1000 ) );
dic.add( new IntegerObj( 2000 ) );
dic.add( new IntegerObj( 3000 ) );
dic.add( new IntegerObj( 4000 ) );
dic.add( new IntegerObj( 5000 ) );
IntBuffer buffer = IntBuffer.allocate( 100 );
for( int i = 0 ; i < 100 ; i++ ){
buffer.put( i % 5 );
}
ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.INTEGER , new TestDicManager( dic ) , buffer );
IFilter filter = new NumberFilter( NumberFilterType.GE , new LongObj( Long.valueOf( Integer.MAX_VALUE ) + (long)1 ) );
assertEquals( null , index.filter( filter , new boolean[100] ) );
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:18,代码来源:TestBufferDirectSequentialNumberCellIndexInteger.java
示例4: ensureLargeEnough
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer ensureLargeEnough(IntBuffer buffer, int required) {
if (buffer != null) {
buffer.limit(buffer.capacity());
}
if (buffer == null || (buffer.remaining() < required)) {
int position = (buffer != null ? buffer.position() : 0);
IntBuffer newVerts = createIntBuffer(position + required);
if (buffer != null) {
buffer.flip();
newVerts.put(buffer);
newVerts.position(position);
}
buffer = newVerts;
}
return buffer;
}
示例5: makeMipmapBuffers
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer[] makeMipmapBuffers(Dimension[] p_makeMipmapBuffers_0_, int[][] p_makeMipmapBuffers_1_)
{
if (p_makeMipmapBuffers_0_ == null)
{
return null;
}
else
{
IntBuffer[] aintbuffer = new IntBuffer[p_makeMipmapBuffers_0_.length];
for (int i = 0; i < p_makeMipmapBuffers_0_.length; ++i)
{
Dimension dimension = p_makeMipmapBuffers_0_[i];
int j = dimension.width * dimension.height;
IntBuffer intbuffer = GLAllocation.createDirectIntBuffer(j);
int[] aint = p_makeMipmapBuffers_1_[i];
intbuffer.clear();
intbuffer.put(aint);
intbuffer.clear();
aintbuffer[i] = intbuffer;
}
return aintbuffer;
}
}
示例6: T_int_filter_4
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Test
public void T_int_filter_4() throws IOException{
List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
dic.add( new IntegerObj( 1000 ) );
dic.add( new IntegerObj( 2000 ) );
dic.add( new IntegerObj( 3000 ) );
dic.add( new IntegerObj( 4000 ) );
dic.add( new IntegerObj( 5000 ) );
IntBuffer buffer = IntBuffer.allocate( 100 );
for( int i = 0 ; i < 100 ; i++ ){
buffer.put( i % 5 );
}
ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.INTEGER , new TestDicManager( dic ) , buffer );
IFilter filter = new NumberFilter( NumberFilterType.LE , new IntegerObj( 2000 ) );
FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
assertEquals( result.size() , 40 );
for( int i = 0,n=0 ; n < 100 ; i+=2,n+=5 ){
assertEquals( result.get(i) , n );
assertEquals( result.get(i+1) , n+1 );
}
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:23,代码来源:TestBufferDirectSequentialNumberCellIndexInteger.java
示例7: T_byte_filter_5
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Test
public void T_byte_filter_5() throws IOException{
List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
dic.add( new ByteObj( (byte) 10 ) );
dic.add( new ByteObj( (byte) 20 ) );
dic.add( new ByteObj( (byte) 30 ) );
dic.add( new ByteObj( (byte) 40 ) );
dic.add( new ByteObj( (byte) 50 ) );
IntBuffer buffer = IntBuffer.allocate( 100 );
for( int i = 0 ; i < 100 ; i++ ){
buffer.put( i % 5 );
}
ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.BYTE , new TestDicManager( dic ) , buffer );
IFilter filter = new NumberFilter( NumberFilterType.GT , new ByteObj( (byte) 40 ) );
FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
assertEquals( result.size() , 20 );
for( int i = 0,n=0 ; n < 100 ; i++,n+=5 ){
assertEquals( result.get(i) , n+4 );
}
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:22,代码来源:TestBufferDirectSequentialNumberCellIndexByte.java
示例8: T_byte_filter_6
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Test
public void T_byte_filter_6() throws IOException{
List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
dic.add( new ByteObj( (byte) 10 ) );
dic.add( new ByteObj( (byte) 20 ) );
dic.add( new ByteObj( (byte) 30 ) );
dic.add( new ByteObj( (byte) 40 ) );
dic.add( new ByteObj( (byte) 50 ) );
IntBuffer buffer = IntBuffer.allocate( 100 );
for( int i = 0 ; i < 100 ; i++ ){
buffer.put( i % 5 );
}
ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.BYTE , new TestDicManager( dic ) , buffer );
IFilter filter = new NumberFilter( NumberFilterType.GE , new ByteObj( (byte) 40 ) );
FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
assertEquals( result.size() , 40 );
for( int i = 0,n=0 ; n < 100 ; i+=2,n+=5 ){
assertEquals( result.get(i) , n+3 );
assertEquals( result.get(i+1) , n+4 );
}
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:23,代码来源:TestBufferDirectSequentialNumberCellIndexByte.java
示例9: T_float_filter_3
import java.nio.IntBuffer; //导入方法依赖的package包/类
@Test
public void T_float_filter_3() throws IOException{
List<PrimitiveObject> dic = new ArrayList<PrimitiveObject>();
dic.add( new FloatObj( (float) 1.00001 ) );
dic.add( new FloatObj( (float) 2.00001 ) );
dic.add( new FloatObj( (float) 3.00001 ) );
dic.add( new FloatObj( (float) 4.00001 ) );
dic.add( new FloatObj( (float) 5.00001 ) );
IntBuffer buffer = IntBuffer.allocate( 100 );
for( int i = 0 ; i < 100 ; i++ ){
buffer.put( i % 5 );
}
ICellIndex index = new BufferDirectSequentialNumberCellIndex( ColumnType.FLOAT , new TestDicManager( dic ) , buffer );
IFilter filter = new NumberFilter( NumberFilterType.LT , new FloatObj( (float) 2.00001 ) );
FilterdExpressionIndex result = new FilterdExpressionIndex( index.filter( filter , new boolean[100] ) );
assertEquals( result.size() , 20 );
for( int i = 0,n=0 ; n < 100 ; i++,n+=5 ){
assertEquals( result.get(i) , n );
}
}
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:22,代码来源:TestBufferDirectSequentialNumberCellIndexFloat.java
示例10: LoadPathNodeFile
import java.nio.IntBuffer; //导入方法依赖的package包/类
private void LoadPathNodeFile(byte rx,byte ry)
{
String fname = "./data/pathnode/"+rx+"_"+ry+".pn";
short regionoffset = getRegionOffset(rx,ry);
_log.info("PathFinding Engine: - Loading: "+fname+" -> region offset: "+regionoffset+"X: "+rx+" Y: "+ry);
File Pn = new File(fname);
int node = 0,size, index = 0;
try {
// Create a read-only memory-mapped file
FileChannel roChannel = new RandomAccessFile(Pn, "r").getChannel();
size = (int)roChannel.size();
MappedByteBuffer nodes;
if (Config.FORCE_GEODATA) //Force O/S to Loads this buffer's content into physical memory.
//it is not guarantee, because the underlying operating system may have paged out some of the buffer's data
nodes = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, size).load();
else
nodes = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, size);
// Indexing pathnode files, so we will know where each block starts
IntBuffer indexs = IntBuffer.allocate(65536);
while(node < 65536)
{
byte layer = nodes.get(index);
indexs.put(node, index);
node++;
index += layer*10+1;
}
_pathNodesIndex.put(regionoffset, indexs);
_pathNodes.put(regionoffset, nodes);
} catch (Exception e)
{
e.printStackTrace();
_log.warning("Failed to Load PathNode File: "+fname+"\n");
}
}
示例11: drawBuffers
import java.nio.IntBuffer; //导入方法依赖的package包/类
public void drawBuffers() {
bind();
IntBuffer buffer = BufferUtils.createIntBuffer(textureids.size());
for(int i : textureids)
buffer.put(GL30.GL_COLOR_ATTACHMENT0 + i);
buffer.flip();
GL20.glDrawBuffers(buffer);
unbind();
}
示例12: initBuf
import java.nio.IntBuffer; //导入方法依赖的package包/类
protected IntBuffer initBuf(int[] num, int buflen) {
IntBuffer intBuf = IntBuffer.allocate(buflen);
intBuf.position(buflen - num.length);
for (int i = 0; i < buflen; i++)
intBuf.put(i, 0);
intBuf.put(num);
intBuf.rewind();
return intBuf;
}
示例13: flip
import java.nio.IntBuffer; //导入方法依赖的package包/类
public static IntBuffer flip(int[] data) {
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
示例14: intArrayToByteArray
import java.nio.IntBuffer; //导入方法依赖的package包/类
protected byte[] intArrayToByteArray(int[] indices) {
if (indices == null) {
return null;
}
ByteBuffer buffer = ByteBuffer.wrap(new byte[indices.length * 4]);
buffer.order(ByteOrder.LITTLE_ENDIAN);
IntBuffer asIntBuffer = buffer.asIntBuffer();
for (int i : indices) {
asIntBuffer.put(i);
}
return buffer.array();
}
示例15: destroy
import java.nio.IntBuffer; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.Graphics#destroy()
*/
public void destroy() {
super.destroy();
IntBuffer buffer = BufferUtils.createIntBuffer(1);
buffer.put(FBO);
buffer.flip();
EXTFramebufferObject.glDeleteFramebuffersEXT(buffer);
valid = false;
}