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


Java TLongArrayList.size方法代码示例

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


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

示例1: findSegmentationIndexes

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
private int[] findSegmentationIndexes(Way way, TLongArrayList segmentationNodeIds) {
	int[] segmentationIndexes = new int[segmentationNodeIds.size() + 2];
	int pos = 0;
	segmentationIndexes[pos++] = 0; // first node index (start node)
	segmentationIndexes[pos++] = way.getWayNodes().size() - 1; // last node index (end node)
	
	int i=0;
	for (WayNode node : way.getWayNodes()) {
		long nodeId = node.getNodeId();
		if (segmentationNodeIds.contains(nodeId)) {
			segmentationIndexes[pos++] = i; // index of a segmentation node
		}
		i++;
	}
	
	Arrays.sort(segmentationIndexes);
	
	return segmentationIndexes;
}
 
开发者ID:graphium-project,项目名称:graphium,代码行数:20,代码来源:SegmentationWaySink.java

示例2: 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();
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:26,代码来源:RemoteIdService.java

示例3: minBlockVector

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static TLongArrayList minBlockVector(TIntArrayList matrixIndexes,
                                            TLongArrayList vectorValues)
{
    TLongArrayList output = new TLongArrayList(vectorValues.size());
    output.fill(0, vectorValues.size(), NO_VALUE);
    int max = matrixIndexes.size() / 2;
    for (int i = 0; i < max; i++) {
        int matrixElementRow = matrixIndexes.getQuick(2 * i);
        int matrixElementColumn = matrixIndexes.getQuick(2 * i + 1);
        long val = vectorValues.getQuick(matrixElementColumn);
        long currentVal = output.getQuick(matrixElementRow);
        if (val != NO_VALUE && (val < currentVal || currentVal == NO_VALUE)) {
            output.setQuick(matrixElementRow, val);
        }
    }
    return output;
}
 
开发者ID:placeiq,项目名称:piqconnect,代码行数:18,代码来源:IterationStage1.java

示例4: feedBatch

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
private TLongArrayList feedBatch() {
  TLongArrayList handles = new TLongArrayList(512);
  while (handleIterator.hasNext()) {
    handles.add(handleIterator.next());
    if (batchSize <= handles.size()) {
      break;
    }
  }
  return handles;
}
 
开发者ID:pingcap,项目名称:tikv-client-lib-java,代码行数:11,代码来源:IndexScanIterator.java

示例5: filterByElementId

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
 * Filters feature by element ID and element type
 * 
 * @param feature
 * @return TRUE if no filter is set or if featureId is included in filter.
 *         FALSE if filter is set and featureId is not included in filter
 */
private boolean filterByElementId(IVgiFeature feature) {
	TLongArrayList filterList = new TLongArrayList();
	if (feature.getVgiGeometryType().equals(VgiGeometryType.POINT)) {
		filterList = filterNodeId;
	} else if (feature.getVgiGeometryType().equals(VgiGeometryType.LINE)) {
		filterList = filterWayId;
	} else if (feature.getVgiGeometryType().equals(VgiGeometryType.RELATION)) {
		filterList = filterRelationId;
	}

	if (filterList == null) {
		return true;
	}

	do {
		if (filterIdPointer == filterList.size()) {
			/** End of filter list */
			return false;
		} else if (filterList.get(filterIdPointer) == feature.getOid()) {
			/** Feature ID member of filter list > PROCESS this operation */
			return true;
		} else if (filterList.get(filterIdPointer) > feature.getOid()) {
			/** Feature ID NO member of filter list > SKIP this operation */
			return false;
		}
		/** Current Filter ID is too low > NEXT filter feature id */
		filterIdPointer++;
	} while (true);
}
 
开发者ID:SGroe,项目名称:vgi-analytics-framework,代码行数:37,代码来源:VgiOperationPbfReaderImpl.java

示例6: getHours

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static TIntArrayList getHours(TLongArrayList t){
		TIntArrayList hour= new TIntArrayList(t.size());
	
	for(int i=0; i<t.size();i++)
		hour.add( (int) (t.getQuick(i)/3600000L) );
	
	return hour;
}
 
开发者ID:PortfolioEffect,项目名称:PE-HFT-Java,代码行数:9,代码来源:Util.java

示例7: getMillisecFromHourStart

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static TIntArrayList getMillisecFromHourStart(TLongArrayList t){
		TIntArrayList hour= new TIntArrayList(t.size());
	
	for(int i=0; i<t.size();i++)
		hour.add( (int) (t.getQuick(i)%3600000L) );
	
	return hour;
}
 
开发者ID:PortfolioEffect,项目名称:PE-HFT-Java,代码行数:9,代码来源:Util.java

示例8: internalRemove

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
private void internalRemove(long id ,Object value){
	if(value!=null && String.class.isInstance(value)){
		value = Strings.std(value.toString());
	}
	
	TLongArrayList previous = index.get(value);
	if(previous!=null){
		previous.remove(id);
		if(previous.size()==0){
			index.remove(value);
		}
	}
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:14,代码来源:ColumnIndex.java

示例9: write

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
@Override
public int write(IoStats ioStats,
    long txId,
    RowType rowType,
    int estimatedNumberOfRows,
    int estimatedSizeInBytes,
    RawRows rows,
    IndexableKeys indexableKeys,
    TxKeyPointerFpStream stream,
    boolean addToLeapCount,
    boolean hardFsyncBeforeLeapBoundary) throws Exception {

    byte[] lengthBuffer = new byte[8];
    HeapFiler memoryFiler = new HeapFiler((estimatedNumberOfRows * (4 + 1 + 8 + 4)) + estimatedSizeInBytes);
    TLongArrayList offsets = new TLongArrayList();
    rows.consume(row -> {
        offsets.add(memoryFiler.getFilePointer());
        int length = (1 + 8) + row.length;
        UIO.writeInt(memoryFiler, length, "length", lengthBuffer);
        UIO.writeByte(memoryFiler, rowType.toByte(), "rowType");
        UIO.writeLong(memoryFiler, txId, "txId", lengthBuffer);
        memoryFiler.write(row, 0, row.length);
        UIO.writeInt(memoryFiler, length, "length", lengthBuffer);
        return true;
    });

    long l = memoryFiler.length();
    long startFp;
    ioStats.wrote.add(l);
    synchronized (appendOnly.lock()) {
        startFp = appendOnly.length();
        appendOnly.write(memoryFiler.leakBytes(), 0, (int) l);
        appendOnly.flush(false); // TODO expose to config
    }

    TLongIterator iter = offsets.iterator();
    indexableKeys.consume((prefix, key, value, valueTimestamp, valueTombstones, valueVersion)
        -> stream.stream(txId, prefix, key, value, valueTimestamp, valueTombstones, valueVersion, startFp + iter.next()));
    return offsets.size();
}
 
开发者ID:jivesoftware,项目名称:amza,代码行数:41,代码来源:BinaryRowWriter.java

示例10: splitHandlesByRegion

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public List<RegionTask> splitHandlesByRegion(long tableId, TLongArrayList handles) {
  // Max value for current index handle range
  ImmutableList.Builder<RegionTask> regionTasks = ImmutableList.builder();
  handles.sort();

  int startPos = 0;
  TableCodec.DecodeResult decodeResult = new TableCodec.DecodeResult();
  while (startPos < handles.size()) {
    long curHandle = handles.get(startPos);
    byte[] key = TableCodec.encodeRowKeyWithHandleBytes(tableId, curHandle);
    Pair<TiRegion, Metapb.Store> regionStorePair = regionManager.getRegionStorePairByKey(ByteString.copyFrom(key));
    byte[] endKey = regionStorePair.first.getEndKey().toByteArray();
    TableCodec.tryDecodeRowKey(tableId, endKey, decodeResult);
    if (decodeResult.status == Status.MIN) {
      throw new TiClientInternalException("EndKey is less than current rowKey");
    } else if (decodeResult.status == Status.MAX || decodeResult.status == Status.UNKNOWN_INF) {
      createTask(startPos, handles.size(), tableId, handles, regionStorePair, regionTasks);
      break;
    }

    // Region range is a close-open range
    // If region end key match exactly or slightly less than a handle,
    // that handle should be excluded from current region
    // If region end key is greater than the handle, that handle should be included
    long regionEndHandle = decodeResult.handle;
    int pos = handles.binarySearch(regionEndHandle, startPos, handles.size());

    if (pos < 0) {
      // not found in handles, pos is the next greater pos
      // [startPos, pos) all included
      pos = -(pos + 1);
    } else if (decodeResult.status == Status.GREATER) {
      // found handle and then further consider decode status
      // End key decode to a value v: regionEndHandle < v < regionEndHandle + 1
      // handle at pos included
      pos ++;
    }
    createTask(startPos, pos, tableId, handles, regionStorePair, regionTasks);
    // pos equals to start leads to an dead loop
    // startPos and its handle is used for searching region in PD.
    // The returning close-open range should at least include startPos's handle
    // so only if PD error and startPos is not included in current region then startPos == pos
    if (startPos >= pos) {
      throw new TiClientInternalException("searchKey is not included in region returned by PD");
    }
    startPos = pos;
  }
  return regionTasks.build();
}
 
开发者ID:pingcap,项目名称:tikv-client-lib-java,代码行数:50,代码来源:RangeSplitter.java

示例11: readBlock

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
static private void readBlock(
			final String urlString,
			final int[] data,
			final LongMappedAccessData listData ) throws IOException
	{
		final byte[] bytes = new byte[ data.length * 8 ];
		final URL url = new URL( urlString );
		final InputStream in = url.openStream();

		int off = 0, l = 0;
		do
		{
			l = in.read( bytes, off, bytes.length - off );
			off += l;
		}
		while ( l > 0 && off < bytes.length );
		in.close();

		final TLongArrayList idAndOffsetList = new TLongArrayList();
		final LabelMultisetEntryList list = new LabelMultisetEntryList( listData, 0 );
		final LabelMultisetEntry entry = new LabelMultisetEntry( 0, 1 );
		long nextListOffset = 0;
A:		for ( int i = 0, j = -1; i < data.length; ++i )
		{
			final long id =
					( 0xffl & bytes[ ++j ] ) |
					( ( 0xffl & bytes[ ++j ] ) << 8 ) |
					( ( 0xffl & bytes[ ++j ] ) << 16 ) |
					( ( 0xffl & bytes[ ++j ] ) << 24 ) |
					( ( 0xffl & bytes[ ++j ] ) << 32 ) |
					( ( 0xffl & bytes[ ++j ] ) << 40 ) |
					( ( 0xffl & bytes[ ++j ] ) << 48 ) |
					( ( 0xffl & bytes[ ++j ] ) << 56 );

			// does the list [id x 1] already exist?
			for ( int k = 0; k < idAndOffsetList.size(); k += 2 )
			{
				if ( idAndOffsetList.getQuick( k ) == id )
				{
					final long offset = idAndOffsetList.getQuick( k + 1 );
					data[ i ] = ( int ) offset;
					continue A;
				}
			}

			list.createListAt( listData, nextListOffset );
			entry.setId( id );
			list.add( entry );
			idAndOffsetList.add( id );
			idAndOffsetList.add( nextListOffset );
			data[ i ] = ( int ) nextListOffset;
			nextListOffset += list.getSizeInBytes();
		}
	}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:55,代码来源:LabelblkMultisetVolatileArrayLoader.java

示例12: execute

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
@Override
public Object execute(FunctionParameters parameters) {

	if(!checkGroupedByTableExists(parameters)){
		return Functions.EXECUTION_ERROR;
	}

	TLongArrayList srcRowIds = getSourceRows(parameters);
	if (srcRowIds == null || srcRowIds.size()==0) {
		return null;
	}
	
	// get source table
	ODLTableReadOnly srcTable = getSourceTable(parameters);
	if(srcTable==null){
		return Functions.EXECUTION_ERROR;
	}
	
	// execute the child formulae against all rows in this source table, getting geoms and weights
	int nbSrcRows = srcRowIds.size();
	ArrayList<Pair<ODLGeom, Double>> geoms = new ArrayList<>(nbSrcRows);		
	for (int i = 0; i < nbSrcRows; i++) {
		long srcRowId = srcRowIds.get(i);
		if (srcTable.containsRowId(srcRowId)==false) {
			return Functions.EXECUTION_ERROR;
		}
		
		// get geometry
		Object geomVal = executeFunctionOnSourceTable(parameters, srcRowId, child(0));
		if (geomVal == Functions.EXECUTION_ERROR) {
			return Functions.EXECUTION_ERROR;
		}
		ODLGeom geom = (ODLGeom) ColumnValueProcessor.convertToMe(ODLColumnType.GEOM, geomVal);
		if (geom == null) {
			return null;
		}
		
		// get weight
		Object weightVal = executeFunctionOnSourceTable(parameters, srcRowId, child(1));
		if (weightVal == Functions.EXECUTION_ERROR) {
			return Functions.EXECUTION_ERROR;
		}
		Double d=1.0;
		if(weightVal!=null){
			d = (Double)ColumnValueProcessor.convertToMe(ODLColumnType.DOUBLE, weightVal);
			if(d==null){
				return null;
			}
		}
		
		geoms.add(new Pair<ODLGeom, Double>(geom, d));

	}
	
	// get espg code
	Object epsgVal = child(2).execute(parameters);
	if(epsgVal ==  Functions.EXECUTION_ERROR){
		return Functions.EXECUTION_ERROR;
	}

	// allow EPSG to be null, we then do weighted centroid in lat-long coords 
	String epsg = (String) ColumnValueProcessor.convertToMe(ODLColumnType.STRING, epsgVal);		

	return new GeomWeightedCentroid().calculate(geoms, epsg);
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:66,代码来源:FmGroupWeightedCentroid.java


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