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


Java IntBuffer.put方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:19,代碼來源:LWJGLCursorFactory.java

示例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;
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:17,代碼來源:BufferUtils.java

示例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;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:Mipmaps.java

示例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");
    }

}
 
開發者ID:L2jBrasil,項目名稱:L2jBrasil,代碼行數:38,代碼來源:GeoPathFinding.java

示例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();
   }
 
開發者ID:camilne,項目名稱:open-world,代碼行數:13,代碼來源:FrameBuffer.java

示例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;
}
 
開發者ID:Jim00000,項目名稱:Big-Number-Calculation,代碼行數:10,代碼來源:Add.java

示例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;
}
 
開發者ID:ComunityEngine,項目名稱:CommunityEngine-Java,代碼行數:8,代碼來源:Util.java

示例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();
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:13,代碼來源:GenericGeometryGenerator.java

示例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;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:14,代碼來源:FBOGraphics.java


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