本文整理汇总了Java中gnu.trove.list.array.TLongArrayList.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java TLongArrayList.toArray方法的具体用法?Java TLongArrayList.toArray怎么用?Java TLongArrayList.toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.list.array.TLongArrayList
的用法示例。
在下文中一共展示了TLongArrayList.toArray方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
* TODO may be request n - something new ids instead of looping...
*/
@Override
public synchronized long[] next( final int n )
{
int m = 0;
TLongArrayList ids = new TLongArrayList();
do
{
final long end1 = Math.min( end, next + n - ids.size() );
final long[] someIds =
LongStream.range(
next,
end1 ).toArray();
ids.add( someIds );
if ( end1 < end )
next = end1;
else
update();
}
while ( ids.size() < n );
return ids.toArray();
}
示例2: find
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
@Override
public long[] find(int tableId, int col, Object value) {
TLongArrayList ret = new TLongArrayList();
TLongHashSet hashset = new TLongHashSet();
for(int dsIndex = 0; dsIndex<length;dsIndex++){
ODLTableReadOnly table = (ODLTableReadOnly)stores.get(dsIndex).getTableByImmutableId(tableId);
if(table!=null){
long[] result = table.find(col, value);
int n = result.length;
for(int i=0;i<n;i++){
long id = result[i];
if(hashset.contains(id)==false){
hashset.add(id);
ret.add(id);
}
}
}
}
return ret.toArray();
}
示例3: find
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
* Find all row ids with the value or return an empty collection
* if none found.
* @param table
* @param colIndx
* @param value
* @return
*/
public static long[] find(ODLTableReadOnly table,int colIndx, Object value){
TLongArrayList ret = new TLongArrayList();
ODLColumnType colType = table.getColumnType(colIndx);
Object converted = ColumnValueProcessor.convertToMe(colType,value);
if(value!=null && converted==null){
// doesn't convert to the column type...
return ret.toArray();
}
int nr = table.getRowCount();
for(int row =0 ; row< nr;row++){
Object compare = table.getValueAt(row, colIndx);
if(ColumnValueProcessor.isEqual(compare, converted)){
ret.add(table.getRowId(row));
}
}
return ret.toArray();
}
示例4: getRowIds
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public long [] getRowIds(boolean selectedOnly){
ODLTableReadOnly table = getTable();
int n = table.getRowCount();
TLongArrayList tmp = new TLongArrayList();
for(int row = 0 ; row < n ; row++){
if(!selectedOnly || selectionManager.isRowSelected(row)){
tmp.add(table.getRowId(row));
}
}
return tmp.toArray();
}
示例5: getRowIds
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public long [] getRowIds(boolean selectedOnly){
TLongArrayList ret = new TLongArrayList();
for(int i =0 ; i < tabbedPane.getTabCount() ; i++){
ret.addAll(((SingleTableTab)tabbedPane.getComponentAt(i)).getRowIds(selectedOnly));
}
return ret.toArray();
}
示例6: find
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
@Override
public long[] find(int tableId, int col, Object value) {
FilteredTable table = tablesById.get(tableId);
if(table==null){
return null;
}
ODLTableReadOnly src = getSourceTable(tableId);
if(table.size() < 10 || src==null){
// may be more efficient not use the index as its unfiltered
return TableUtils.find(getTableByImmutableId(tableId), col, value);
}else{
// get unfiltered ids matching the value
long[] unfiltered = src.find(col, value);
// filter them
int n = unfiltered.length;
TLongArrayList ret = new TLongArrayList();
for(int i =0 ; i<n;i++){
if(table.contains(unfiltered[i])){
ret.add(unfiltered[i]);
}
}
return ret.toArray();
}
}
示例7: find
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
* Find all row ids with the value or return an empty collection
* if none found, using the index if available
* @param table
* @param colIndx
* @param value
* @return
*/
long[] find(ODLTableReadOnly table,int colIndx, Object value){
updateState(table, colIndx);
if(state == IndexState.PENDING){
// active the hashmap
buildHashmap(table, colIndx);
state = IndexState.ACTIVE;
}
long[] ret =null;
if(state == IndexState.ACTIVE){
// convert the search value to the type and standardise if its a string
ODLColumnType colType = table.getColumnType(colIndx);
Object converted = ColumnValueProcessor.convertToMe(colType,value);
if(colType == ODLColumnType.STRING && converted!=null){
converted = Strings.std(converted.toString());
}
// only search if the value converts to the column type
if((value!=null && converted==null)==false){
TLongArrayList list = index.get(converted);
if(list!=null){
ret = list.toArray();
}else{
return new long[0];
}
}
}
else{
ret = TableUtils.find(table, colIndx, value);
}
if(ret==null){
// create default object
ret = new long[0];
}
return ret;
}
示例8: getProviders
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
* Returns the list of process IDs that have the flow with the given ID as
* product output or waste input.
*/
public long[] getProviders(long flowId) {
TLongArrayList list = providerMap.get(flowId);
if (list == null)
return new long[0];
return list.toArray();
}
示例9: Position
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public Position(Portfolio portfolio, String assetName, TIntArrayList quantity, TLongArrayList timeMillSec) {
this( portfolio, assetName, quantity.toArray(), timeMillSec.toArray());
}
示例10: buildIndex
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
private static long[] buildIndex() throws IOException {
final TLongArrayList aIds = new TLongArrayList(46000000);
final TLongArrayList aoffsets = new TLongArrayList(46000000);
final File input = new File("/Volumes/My Book/flickr46m-id2farm-server-secret.map");
final DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(input)));
try {
int offset = 0;
for (int i = 0;; i++) {
if (i % 1000000 == 0)
System.out.println(i);
final long currentOffset = offset;
final long id = dis.readLong();
offset += 8;
dis.readInt();
offset += 4;
dis.readInt();
offset += 4;
final int len = dis.readUnsignedShort();
final byte[] tmp = new byte[len];
dis.readFully(tmp);
offset += len + 2;
aIds.add(id);
aoffsets.add(currentOffset);
}
} catch (final EOFException e) {
dis.close();
}
final long[] ids = aIds.toArray();
final long[] offsets = aoffsets.toArray();
ArrayUtils.parallelQuicksortAscending(ids, offsets);
final long[] indexedOffsets = new long[indexes.length];
for (int i = 0; i < indexedOffsets.length; i++) {
final long indexedId = indexes[i];
if (i % 1000000 == 0)
System.out.println(i);
indexedOffsets[i] = offsets[Arrays.binarySearch(ids, indexedId)];
}
return indexedOffsets;
}
示例11: writeIndex
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
* Create and write an index index based on the input Cassandra Index.db file. Read the Index.db and generate chunks
* (splits) based on the configured chunk size.
*
* @param fileSystem Hadoop file system.
* @param sstablePath SSTable Index.db.
* @throws IOException
*/
public static void writeIndex(final FileSystem fileSystem, final Path sstablePath) throws IOException {
final Configuration configuration = fileSystem.getConf();
final long splitSize = configuration.getLong(HadoopSSTableConstants.HADOOP_SSTABLE_SPLIT_MB,
HadoopSSTableConstants.DEFAULT_SPLIT_MB) * 1024 * 1024;
final Closer closer = Closer.create();
final Path outputPath = sstablePath.suffix(SSTABLE_INDEX_SUFFIX);
final Path inProgressOutputPath = sstablePath.suffix(SSTABLE_INDEX_IN_PROGRESS_SUFFIX);
boolean success = false;
try {
final FSDataOutputStream os = closer.register(fileSystem.create(inProgressOutputPath));
final TLongArrayList splitOffsets = new TLongArrayList();
long currentStart = 0;
long currentEnd = 0;
final IndexOffsetScanner index = closer.register(new IndexOffsetScanner(sstablePath, fileSystem));
while (index.hasNext()) {
// NOTE: This does not give an exact size of this split in bytes but a rough estimate.
// This should be good enough since it's only used for sorting splits by size in hadoop land.
while (currentEnd - currentStart < splitSize && index.hasNext()) {
currentEnd = index.next();
splitOffsets.add(currentEnd);
}
// Record the split
final long[] offsets = splitOffsets.toArray();
os.writeLong(offsets[0]); // Start
os.writeLong(offsets[offsets.length - 1]); // End
// Clear the offsets
splitOffsets.clear();
if (index.hasNext()) {
currentStart = index.next();
currentEnd = currentStart;
splitOffsets.add(currentStart);
}
}
success = true;
} finally {
closer.close();
if (!success) {
fileSystem.delete(inProgressOutputPath, false);
} else {
fileSystem.rename(inProgressOutputPath, outputPath);
}
}
}
示例12: getSelectableIdsWithinPixelRectangle
import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
@Override
public long[] getSelectableIdsWithinPixelRectangle(Rectangle screenCoordinatesRectangle) {
TLongArrayList within = DatastoreRenderer.getWithinRectangle(filtered!=null? filtered.activeFiltered:null, createImmutableConverter(), screenCoordinatesRectangle, true);
return within.toArray();
}