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


Java TFloatList.size方法代码示例

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


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

示例1: equals

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean equals( Object other ) {
    if ( other == this ) {
        return true;
    }
    if ( !( other instanceof TFloatList ) ) return false;

    TFloatList that = ( TFloatList )other;
    if ( size() != that.size() ) return false;

    for( int i = 0; i < size(); i++ ) {
        if ( get( i ) != that.get( i ) ) {
            return false;
        }
    }
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:TFloatLinkedList.java

示例2: set

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
public void set(final TFloatList value) {
    final Command command = new Command(Command.SETALL, (short) value.size());
    commands.add(command);
    ++baselineCommandCount;

    //Is this the best way to do this?
    v.clear();
    v.addAll(value);

    for (int i = 0, size = value.size(); i < size; ++i) {
        final Command subCommand = new Command(Command.SET, (short) i, value.get(i));
        commands.add(subCommand);
        ++baselineCommandCount;
    }

    touch();
    onChanged();
}
 
开发者ID:bacta,项目名称:pre-cu,代码行数:19,代码来源:AutoDeltaFloatVector.java

示例3: createVertexBuffer

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
private static FloatBuffer createVertexBuffer(TFloatList vertices, TFloatList texcoord0, TFloatList texcoord1, TFloatList normals, TFloatList colors, int vertexCount, boolean hasTexCoord0, boolean hasTexCoord1, boolean hasNormal, boolean hasColor, int vertSize) {
    FloatBuffer vertexBuffer;
    vertexBuffer = BufferUtils.createFloatBuffer(vertSize * vertexCount);
    int texCoord0Size = (hasTexCoord0) ? TEX_COORD_0_SIZE : 0;
    int texCoord1Size = (hasTexCoord1) ? TEX_COORD_1_SIZE : 0;
    int normalSize = (hasNormal) ? NORMAL_SIZE : 0;
    int colorSize = (hasColor) ? COLOR_SIZE : 0;
    int uv1 = 0, uv2 = 0, n = 0, c = 0;
    for (int v = 0; v < vertices.size(); v += 3) {
        vertexBuffer.put(vertices.get(v)).put(vertices.get(v + 1)).put(vertices.get(v + 2));
        for (int i = 0; i < texCoord0Size; ++i) {
            vertexBuffer.put(texcoord0.get(uv1 + i));
        }
        for (int i = 0; i < texCoord1Size; ++i) {
            vertexBuffer.put(texcoord1.get(uv2 + i));
        }
        for (int i = 0; i < normalSize; ++i) {
            vertexBuffer.put(normals.get(n + i));
        }
        for (int i = 0; i < colorSize; ++i) {
            vertexBuffer.put(colors.get(c + i));
        }
        uv1 += texCoord0Size;
        uv2 += texCoord1Size;
        n += normalSize;
        c += colorSize;
    }
    vertexBuffer.flip();
    return vertexBuffer;
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:31,代码来源:Mesh.java

示例4: load

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
@Override
public Mesh load(AssetUri uri, InputStream stream, List<URL> urls) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

    List<Vector3f> rawVertices = Lists.newArrayList();
    List<Vector3f> rawNormals = Lists.newArrayList();
    List<Vector2f> rawTexCoords = Lists.newArrayList();
    List<Tuple3i[]> rawIndices = Lists.newArrayList();

    // Gather data
    readMeshData(reader, rawVertices, rawNormals, rawTexCoords, rawIndices);

    // Process data
    TFloatList vertices = new TFloatArrayList();
    TFloatList texCoord0 = new TFloatArrayList();
    TFloatList normals = new TFloatArrayList();
    TIntList indices = new TIntArrayList();

    // Determine face format;
    if (rawIndices.size() == 0) {
        throw new IOException("No index data");
    }

    processData(rawVertices, rawNormals, rawTexCoords, rawIndices, vertices, texCoord0, normals, indices);

    if (normals.size() != vertices.size() || texCoord0.size() / 2 != vertices.size() / 3) {
        throw new IOException("Mixed face format");
    }

    return Mesh.buildMesh(uri, vertices, texCoord0, null, normals, null, indices);
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:32,代码来源:ObjMeshLoader.java

示例5: returnAsString

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
private String[] returnAsString(TFloatList fs)
{
	int n = fs.size();
	String[] asString = new String[n];
	for(int i=0; i < n; ++i)
		asString[i] = String.valueOf(fs.get(i));
	return asString;
}
 
开发者ID:powerdata,项目名称:com.powerdata.openpa,代码行数:9,代码来源:PFlowPsmModelBldr.java

示例6: buildMesh

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
public static Mesh buildMesh(TFloatList vertices, TFloatList texCoord0, TFloatList texCoord1, TFloatList normals, TFloatList colors, TIntList indices) {

        int vertexCount = vertices.size() / VERTEX_SIZE;
        boolean hasTexCoord0 = texCoord0 != null && texCoord0.size() / TEX_COORD_0_SIZE == vertexCount;
        boolean hasTexCoord1 = texCoord1 != null && texCoord1.size() / TEX_COORD_1_SIZE == vertexCount;
        boolean hasNormals = normals != null && normals.size() / NORMAL_SIZE == vertexCount;
        boolean hasColors = colors != null && colors.size() / COLOR_SIZE == vertexCount;

        int vertSize = VERTEX_SIZE + (hasTexCoord0 ? TEX_COORD_0_SIZE : 0) + (hasTexCoord1 ? TEX_COORD_1_SIZE : 0) + (hasNormals ? NORMAL_SIZE : 0) + (hasColors ? COLOR_SIZE : 0);
        FloatBuffer vertexBuffer = createVertexBuffer(vertices, texCoord0, texCoord1, normals, colors, vertexCount, hasTexCoord0, hasTexCoord1, hasNormals, hasColors, vertSize);

        IntBuffer indexBuffer = BufferUtils.createIntBuffer(indices.size());
        TIntIterator iterator = indices.iterator();
        while (iterator.hasNext()) {
            indexBuffer.put(iterator.next());
        }
        indexBuffer.flip();

        Mesh mesh = new Mesh();
        mesh.vertices = vertices;
        mesh.texCoord0 = texCoord0;
        mesh.texCoord1 = texCoord1;
        mesh.normals = normals;
        mesh.colors = colors;
        mesh.indices = indices;
        mesh.indexCount = indices.size();
        mesh.aabb = calculateAABB(vertices, vertexCount);

        mesh.vboVertexBuffer = VertexBufferObjectManager.getInstance().getVboId();
        VertexBufferObjectManager.getInstance().bufferVboData(mesh.vboVertexBuffer, vertexBuffer, GL15.GL_STATIC_DRAW);
        mesh.vboIndexBuffer = VertexBufferObjectManager.getInstance().getVboId();
        VertexBufferObjectManager.getInstance().bufferVboElementData(mesh.vboIndexBuffer, indexBuffer, GL15.GL_STATIC_DRAW);

        mesh.stride = vertSize * 4;
        mesh.vertexOffset = 0;
        int offset = VERTEX_SIZE;

        if (hasTexCoord0) {
            mesh.hasTexCoord0 = hasTexCoord0;
            mesh.texCoord0Offset = 4 * offset;
            offset += TEX_COORD_0_SIZE;
        }
        if (hasTexCoord1) {
            mesh.hasTexCoord1 = hasTexCoord1;
            mesh.texCoord1Offset = 4 * offset;
            offset += TEX_COORD_1_SIZE;
        }
        if (hasNormals) {
            mesh.hasNormal = hasNormals;
            mesh.normalOffset = 4 * offset;
            offset += NORMAL_SIZE;
        }
        if (hasColors) {
            mesh.hasColor = hasColors;
            mesh.colorOffset = 4 * offset;
            offset += COLOR_SIZE;
        }

        indexBuffer.flip();
        return mesh;
    }
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:62,代码来源:Mesh.java

示例7: renderBatch

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
private void renderBatch(TFloatList vertexData, TIntList indexData) {
    if (vertexData.size() == 0 || indexData.size() == 0) return;

    PerformanceMonitor.startActivity("BatchRenderMesh");
    FloatBuffer vertexBuffer = BufferUtils.createFloatBuffer(vertexData.size());
    vertexBuffer.put(vertexData.toArray());
    vertexBuffer.flip();
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, batchVertexBuffer);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertexBuffer, GL15.GL_DYNAMIC_DRAW);

    IntBuffer indexBuffer = BufferUtils.createIntBuffer(indexData.size());
    indexBuffer.put(indexData.toArray());
    indexBuffer.flip();
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, batchIndexBuffer);
    GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indexBuffer, GL15.GL_DYNAMIC_DRAW);

    glPushMatrix();

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);

    //GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, batchVertexBuffer);
    //GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, batchIndexBuffer);

    glVertexPointer(Mesh.VERTEX_SIZE, GL11.GL_FLOAT, 15 * 4, 0);
    GL13.glClientActiveTexture(GL13.GL_TEXTURE0);
    glTexCoordPointer(Mesh.TEX_COORD_0_SIZE, GL11.GL_FLOAT, 15 * 4, 4 * 3);
    GL13.glClientActiveTexture(GL13.GL_TEXTURE1);
    glTexCoordPointer(Mesh.TEX_COORD_1_SIZE, GL11.GL_FLOAT, 15 * 4, 4 * 5);
    glColorPointer(Mesh.COLOR_SIZE, GL11.GL_FLOAT, 15 * 4, 4 * 11);
    glNormalPointer(GL11.GL_FLOAT, 15 * 4, 4 * 8);

    GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, indexData.size(), indexData.size(), GL_UNSIGNED_INT, 0);

    glDisableClientState(GL_NORMAL_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    glDisableClientState(GL_VERTEX_ARRAY);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
    glPopMatrix();
    PerformanceMonitor.endActivity();
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:47,代码来源:MeshRenderer.java

示例8: FloatStatistics

import gnu.trove.list.TFloatList; //导入方法依赖的package包/类
public FloatStatistics(TFloatList list) {
    int n = list.size();

    float min = Float.MAX_VALUE, max = Float.MIN_VALUE;
    float total = 0;
    float totalSq = 0;

    TFloatIterator itr = list.iterator();
    for (; itr.hasNext();) {
        float f = itr.next();

        min = Math.min(min, f);
        max = Math.max(max, f);

        total += f;
        totalSq += f * f;
    }


    float rank10 = 10f / 100f * (n - 1);
    int rI10 = (int) rank10;
    float rF10 = rank10 - rI10;
    float percentile10;

    float rank90 = 90f / 100f * (n - 1);
    int rI90 = (int) rank90;
    float rF90 = rank90 - rI90;
    float percentile90;

    if (n > 1) {
        percentile10 =
                (1 - rF10) * list.get(rI10) + rF10 * list.get(rI10 + 1);
        percentile90 =
                (1 - rF90) * list.get(rI90) + rF90 * list.get(rI90 + 1);
    } else {
        percentile10 = total;
        percentile90 = total;
    }

    init(n,
         min, max,
         total, totalSq,
         percentile10,
         percentile90);
}
 
开发者ID:thorinii,项目名称:PacAndroid,代码行数:46,代码来源:StatCalculator.java


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