当前位置: 首页>>代码示例>>Java>>正文


Java IntBuffer.capacity方法代码示例

本文整理汇总了Java中java.nio.IntBuffer.capacity方法的典型用法代码示例。如果您正苦于以下问题:Java IntBuffer.capacity方法的具体用法?Java IntBuffer.capacity怎么用?Java IntBuffer.capacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.nio.IntBuffer的用法示例。


在下文中一共展示了IntBuffer.capacity方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: densePlusSparse

import java.nio.IntBuffer; //导入方法依赖的package包/类
private void densePlusSparse(IntBuffer keys, IntBuffer values) {
  int length = keys.capacity();
  int ov, value, key;
  for (int i = 0; i < length; i++) {
    key = keys.get(i);
    ov = denseRep.get(key);
    value = ov + values.get(i);
    if (ov != 0 && value == 0)
      nnz--;
    denseRep.put(key, value);
  }

  int size = (int)(endCol - startCol);
  if (nnz < threshold * size)
    denseToSparse();
}
 
开发者ID:Tencent,项目名称:angel,代码行数:17,代码来源:ServerArbitraryIntRow.java

示例2: readFrom

import java.nio.IntBuffer; //导入方法依赖的package包/类
static ImageHeader readFrom(IntBuffer buffer) {
    Objects.requireNonNull(buffer);

    if (buffer.capacity() != HEADER_SLOTS) {
        throw new InternalError(
            "jimage header not the correct size: " + buffer.capacity());
    }

    int magic = buffer.get(0);
    int version = buffer.get(1);
    int majorVersion = version >>> 16;
    int minorVersion = version & 0xFFFF;
    int flags = buffer.get(2);
    int resourceCount = buffer.get(3);
    int tableLength = buffer.get(4);
    int locationsSize = buffer.get(5);
    int stringsSize = buffer.get(6);

    return new ImageHeader(magic, majorVersion, minorVersion, flags,
        resourceCount, tableLength, locationsSize, stringsSize);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:ImageHeader.java

示例3: loadInMemoryStorage

import java.nio.IntBuffer; //导入方法依赖的package包/类
@Override
public void loadInMemoryStorage( final ColumnBinary columnBinary , final IMemoryAllocator allocator ) throws IOException{
  for( ColumnBinary childColumnBinary : columnBinary.columnBinaryList ){
    IColumnBinaryMaker maker = FindColumnBinaryMaker.get( childColumnBinary.makerClassName );
    IMemoryAllocator childMemoryAllocator = allocator.getArrayChild( childColumnBinary.rowCount , childColumnBinary.columnType );
    maker.loadInMemoryStorage( childColumnBinary , childMemoryAllocator );
  }

  ICompressor compressor = FindCompressor.get( columnBinary.compressorClassName );
  byte[] decompressBuffer = compressor.decompress( columnBinary.binary , columnBinary.binaryStart , columnBinary.binaryLength );

  IntBuffer buffer = ByteBuffer.wrap( decompressBuffer ).asIntBuffer();
  int length = buffer.capacity();
  int currentIndex = 0;
  for( int i = 0 ; i < length ; i++ ){
    int arrayLength = buffer.get();
    if( arrayLength == 0 ){
      allocator.setNull(i);
    }
    else{
      int start = currentIndex;
      allocator.setArrayIndex( i , start , arrayLength );
      currentIndex += arrayLength;
    }
  }
  allocator.setValueCount( length );
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:28,代码来源:DumpArrayColumnBinaryMaker.java

示例4: ArrayCellManager

import java.nio.IntBuffer; //导入方法依赖的package包/类
public ArrayCellManager( final Spread spread , final IntBuffer buffer ){
  int length = buffer.capacity();
  cellArray = new ICell[length];
  int currentIndex = 0;
  for( int i = 0 ; i < length ; i++ ){
    int arrayLength = buffer.get();
    if( arrayLength != 0 ){
      int start = currentIndex;
      int end = start + arrayLength;
      cellArray[i] = new ArrayCell( new SpreadArrayLink( spread , i , start , end ) );
      currentIndex += arrayLength;
    }
  }
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:15,代码来源:DumpArrayColumnBinaryMaker.java

示例5: densePlusDense

import java.nio.IntBuffer; //导入方法依赖的package包/类
private void densePlusDense(IntBuffer buf) {
  int length = buf.capacity();
  nnz = 0;
  int value;
  for (int i = 0; i < length; i++) {
    value = denseRep.get(i) + buf.get(i);
    if (value != 0) {
      denseRep.put(i, denseRep.get(i) + buf.get(i));
      nnz++;
    }
  }

  if (nnz < threshold)
    denseToSparse();
}
 
开发者ID:Tencent,项目名称:angel,代码行数:16,代码来源:ServerArbitraryIntRow.java

示例6: bufToIntegerString

import java.nio.IntBuffer; //导入方法依赖的package包/类
protected String bufToIntegerString(IntBuffer buf) {
	String str = "";
	for (int i = 0; i < buf.capacity(); i++) {
		str += buf.get(i);
	}

	return str.replaceFirst("[^1-9]*", "");
}
 
开发者ID:Jim00000,项目名称:Big-Number-Calculation,代码行数:9,代码来源:Add.java

示例7: getInt

import java.nio.IntBuffer; //导入方法依赖的package包/类
public int[] getInt(Attribute attrib) {
	int pname = getAttrib(attrib);
	IntBuffer buf = ByteBuffer.allocateDirect(16).order(ByteOrder.nativeOrder()).asIntBuffer();
	gl.glGetIntegerv(pname, buf);

	int[] result = new int[buf.capacity()];
	for(int i = 0; i < result.length; i++)
		result[i] = buf.get();

	return result;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:12,代码来源:JOGLOpenGL.java

示例8: AddVertices

import java.nio.IntBuffer; //导入方法依赖的package包/类
public void AddVertices(FloatBuffer vertices, IntBuffer indices)
{
	shader = new Shader("forward-ambient2");
	material = new Material(new Texture("bricks.jpg"), 1, 8,
			new Texture("bricks_normal.jpg"), new Texture("bricks_disp.png"), 0.03f, -0.5f);
	
	resource = new MeshResource(indices.capacity());
	
	glBindBuffer(GL_ARRAY_BUFFER, resource.GetVbo());
	glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
	
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, resource.GetIbo());
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW);
}
 
开发者ID:RagnarrIvarssen,项目名称:Assimp-Tutorial-LWJGL-3,代码行数:15,代码来源:AnimatedComponent.java

示例9: BufferDirectDictionaryLinkCellManager

import java.nio.IntBuffer; //导入方法依赖的package包/类
public BufferDirectDictionaryLinkCellManager( final ColumnType columnType , final IDicManager dicManager , final IntBuffer dicIndexIntBuffer ){
  this.columnType = columnType;
  this.dicManager = dicManager;
  this.dicIndexIntBuffer = dicIndexIntBuffer;
  indexSize = dicIndexIntBuffer.capacity();
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:7,代码来源:BufferDirectDictionaryLinkCellManager.java


注:本文中的java.nio.IntBuffer.capacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。