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


Java TLongList.toArray方法代码示例

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


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

示例1: sort

import gnu.trove.list.TLongList; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void sort(int fromIndex, int toIndex) {
    TLongList tmp = subList(fromIndex, toIndex);
    long[] vals = tmp.toArray();
    Arrays.sort(vals);
    set(fromIndex, vals);
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:8,代码来源:TLongLinkedList.java

示例2: sort

import gnu.trove.list.TLongList; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void sort(int fromIndex, int toIndex) {
    TLongList tmp = subList(fromIndex, toIndex);
    long[] vals = tmp.toArray();
    Arrays.sort(vals);
    set(fromIndex, vals);
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:9,代码来源:TLongLinkedList.java

示例3: test

import gnu.trove.list.TLongList; //导入方法依赖的package包/类
@Test
public void test()
{
    TLongList result = Useful.line2dInPlaneXZ(PackedBlockPos.pack(12, 0, -13), PackedBlockPos.pack(-16, 0, 4));
    for(long packedPos : result.toArray())
    {
        System.out.println(PackedBlockPos.getX(packedPos) + "        " + PackedBlockPos.getZ(packedPos));
    }
    
    Vec3d origin;
    Vec3d direction;
    AxisAlignedBB box;
    
    // should not find if behind direction
    origin = new Vec3d(0.5, 0.5, 0.5);
    direction = new Vec3d(2, 2, 2);
    box = new AxisAlignedBB(-1, -1, -1, 0, 0, 0);
    assert(!Useful.doesRayIntersectAABB(origin, direction, box));
    
    //should find if contained
    origin = new Vec3d(0.5, 0.5, 0.5);
    direction = new Vec3d(2, 2, 2);
    box = new AxisAlignedBB(0, 0, 0, 1, 1, 1);
    assert(Useful.doesRayIntersectAABB(origin, direction, box));
    
    //should find directly in front
    origin = new Vec3d(0.5, 0.5, 0.5);
    direction = new Vec3d(2, 2, 2);
    box = new AxisAlignedBB(1, 1, 1, 2, 2, 2);
    assert(Useful.doesRayIntersectAABB(origin, direction, box));
    
    //and should find if much father in front
    origin = new Vec3d(0.5, 0.5, 0.5);
    direction = new Vec3d(2, 2, 2);
    box = new AxisAlignedBB(40, 40, 40, 41, 41, 41);
    assert(Useful.doesRayIntersectAABB(origin, direction, box));
    
    //and should not find if not on line
    origin = new Vec3d(0.5, 0.5, 0.5);
    direction = new Vec3d(2, 2, 2);
    box = new AxisAlignedBB(3, 4, 5, 4, 5, 6);
    assert(!Useful.doesRayIntersectAABB(origin, direction, box));
    
    //real example
    origin = new Vec3d(609.5, 5.5, 770.5);
    direction = new Vec3d(-3.0, 0.0, 3.0);
    box = new AxisAlignedBB(608.9, 5.0, 770.9, 610.1, 6.0, 772.1);
    assert(Useful.doesRayIntersectAABB(origin, direction, box));
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:50,代码来源:UsefulTest.java


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