本文整理汇总了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);
}
示例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);
}
示例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));
}