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


Java TLongArrayList.add方法代码示例

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


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

示例1: closeUnclosedRingWithStraightLine

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static void closeUnclosedRingWithStraightLine(
        Collection<ChainOfWays> rings) {
    for (ChainOfWays ring : rings) {
        if (!ring.isClosed()) {
            logger.debug("unclosed ring with " + ring.getSegments().size()
                    + " segments");
            List<WaySegment> segments = ring.getSegments();
            WaySegment rs1 = segments.get(0);
            WaySegment rs2 = segments.get(segments.size() - 1);

            long n1 = rs1.getNodeId(0);
            long n2 = rs2.getNodeId(rs2.getNumberOfNodes() - 1);

            TLongArrayList ids = new TLongArrayList();
            ids.add(n1);
            ids.add(n2);
            OsmWay filler = new Way(0L, ids);
            ring.addWay(filler);
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:22,代码来源:RelationUtil.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: 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();
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:23,代码来源:UnionDecorator.java

示例4: 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();
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:29,代码来源:TableUtils.java

示例5: computeValueVTs

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/**
 * Given an LLVM IR type, compute a sequence of
 * EVTs that represent all the individual underlying
 * non-aggregate types that comprise it.
 *
 * If Offsets is non-null, it points to a vector to be filled in
 * with the in-memory offsets of each of the individual values.
 * @param tli
 * @param ty
 * @param valueVTs
 * @param offsets
 * @param startingOffset
 */
static void computeValueVTs(TargetLowering tli, Type ty, ArrayList<EVT> valueVTs,
        TLongArrayList offsets, long startingOffset)
{
    if (ty instanceof StructType)
    {
        StructType st = (StructType)ty;
        TargetData.StructLayout layout = tli.getTargetData().getStructLayout(st);
        for (int i = 0, e = st.getNumOfElements(); i < e; i++)
        {
            computeValueVTs(tli, st.getElementType(i), valueVTs, offsets,
                    startingOffset+layout.getElementOffset(i));;
        }
        return;
    }
    if (ty instanceof ArrayType)
    {
        ArrayType at = (ArrayType)ty;
        Type eltTy = at.getElementType();
        long eltSize = tli.getTargetData().getTypeAllocSize(eltTy);
        for(long i = 0, e = at.getNumElements(); i < e; i++)
        {
            computeValueVTs(tli, eltTy, valueVTs, offsets, startingOffset+i*eltSize);;
        }
        return;
    }
    if (ty.equals(LLVMContext.VoidTy))
        return;
    // Non-aggragate type
    valueVTs.add(tli.getValueType(ty));
    if (offsets != null)
        offsets.add(startingOffset);
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:46,代码来源:FunctionLoweringInfo.java

示例6: 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

示例7: findRelatedOperations

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
private void findRelatedOperations() {
	
	/** Create relatedFeatureList which includes nodes which have been added to ways */
	Map<Long, List<IVgiOperation>> childElementList = new HashMap<Long, List<IVgiOperation>>();
	TLongArrayList featureIdList = new TLongArrayList();
	for (IVgiFeature feature : featureList) {
		if (!feature.getVgiGeometryType().equals(VgiGeometryType.LINE)) continue;
		featureIdList.add(feature.getOid());
		for (IVgiOperation operation : feature.getOperationList()) {
			if (!operation.getVgiOperationType().equals(VgiOperationType.OP_ADD_NODE)) continue;
			if (!childElementList.containsKey(operation.getRefId())) {
				childElementList.put(operation.getRefId(), null);
			}
		}
	}
	
	/** Return if no child elements have been found */
	if (childElementList.size() == 0) return;

	/** Find related features */
	IVgiPipeline pipeline = ctx.getBean("vgiRelatedFeaturePipeline", IVgiPipeline.class);
	
	RelatedVgiOperationFinderConsumer consumer = ctx.getBean("relatedVgiOperationFinderConsumer", RelatedVgiOperationFinderConsumer.class);
	consumer.setChildElementList(childElementList);
	consumer.setFeatureList(featureList);
	
	pipeline.setFilterNodeId(new TLongArrayList());
	pipeline.setFilterWayId(featureIdList);
	pipeline.setFilterRelationId(new TLongArrayList());
	pipeline.start();
}
 
开发者ID:SGroe,项目名称:vgi-analytics-framework,代码行数:32,代码来源:VgiAnalysisConsumer.java

示例8: outline2dCircleInPlaneXZ

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
/** returns a list of packed block position x & z OFFSETS with the given radius */
public static TLongList outline2dCircleInPlaneXZ(int radius) 
{
    TLongArrayList result = new TLongArrayList( (int) (2 * radius * 3.2));

    // uses midpoint circle algorithm
    if (radius > 0)
    {

        int x = radius;
        int z = 0;
        int err = 0;

        while (x >= z) 
        {

            result.add(PackedBlockPos.pack(x, 0, z)); // Octant 1
            result.add(PackedBlockPos.pack(z, 0, x)); // Octant 2
            result.add(PackedBlockPos.pack(-x, 0, z)); // Octant 3
            result.add(PackedBlockPos.pack(-z, 0, x)); // Octant 4
            result.add(PackedBlockPos.pack(-x, 0, -z)); // Octant 5
            result.add(PackedBlockPos.pack(-z, 0, -x)); // Octant 6
            result.add(PackedBlockPos.pack(x, 0, -z)); // Octant 7
            result.add(PackedBlockPos.pack(z, 0, -x)); // Octant 8

            if(err <= 0)
            {
                z += 1;
                err += 2 * z + 1;
            }
            if(err > 0)
            {
                x -= 1;
                err -= 2*x + 1;
            }
        }
    }

    return result;
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:41,代码来源:Useful.java

示例9: createPQADCNN

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static void createPQADCNN() throws IOException {
	final File input = new File("/Volumes/My Book/flickr46m-vlad64-pca128-pq16x8-indexer-mirflickr25k-sift1x.dat");

	final DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(input)));

	final VLADIndexerData indexer = VLADIndexerData.read(new File(
			"/Users/jsh2/vlad64-pca128-pq16x8-indexer-mirflickr25k-sift1x.dat"));
	final IncrementalFloatADCNearestNeighbours nn = new IncrementalFloatADCNearestNeighbours(
			indexer.getProductQuantiser(), 128,
			46000000);
	final TLongArrayList indexes = new TLongArrayList(46000000);
	try {
		final float[] farr = new float[128];

		for (int x = 0;; x++) {
			if (x % 100000 == 0)
				System.out.println(x);

			final long id = dis.readLong();

			for (int i = 0; i < 128; i++) {
				farr[i] = dis.readFloat();
			}

			nn.add(farr);
			indexes.add(id);
		}
	} catch (final EOFException e) {
		dis.close();
	}

	IOUtils.writeBinary(new File(
			"/Volumes/My Book/flickr46m-vlad64-pca128-pq16x8-indexer-mirflickr25k-sift1x-pqadcnn.dat"), nn);
	IOUtils.writeToFile(indexes, new File(
			"/Volumes/My Book/flickr46m-vlad64-pca128-pq16x8-indexer-mirflickr25k-sift1x-pqadcnn-indexes.dat"));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:37,代码来源:FlickrIndexer.java

示例10: 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();
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:14,代码来源:ODLGridTable.java

示例11: getWithinRectangle

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static TLongArrayList getWithinRectangle(Iterable<? extends DrawableObject> pnts, LatLongToScreen converter, Rectangle selRectOnScreen, boolean filterUnselectable) {
	List<DrawableObject> list = getObjectsWithinRectangle(pnts, converter, selRectOnScreen,filterUnselectable);
	TLongArrayList ret = new TLongArrayList(list.size());
	for (DrawableObject obj : list) {
		ret.add(obj.getGlobalRowId());
	}
	return ret;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:9,代码来源:DatastoreRenderer.java

示例12: 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();
	}

}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:28,代码来源:RowFilterDecorator.java

示例13: switchDefaultProviders

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
private void switchDefaultProviders() {
	log.trace("update default providers");
	dest.getEntityFactory().getCache().evictAll();
	TLongArrayList exchangeIds = new TLongArrayList();
	TLongArrayList providerIds = new TLongArrayList();
	TLongLongIterator it = oldProviderMap.iterator();
	while (it.hasNext()) {
		it.advance();
		long exchangeId = it.key();
		long newId = srcDestIdMap.get(it.value());
		exchangeIds.add(exchangeId);
		providerIds.add(newId);
	}
	updateDefaultProviders(exchangeIds, providerIds);
}
 
开发者ID:GreenDelta,项目名称:olca-modules,代码行数:16,代码来源:ProcessImport.java

示例14: splitHandlesByRegionTest

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
@Test
public void splitHandlesByRegionTest() throws Exception {
  final long tableId = 1;
  TLongArrayList handles = new TLongArrayList();
  handles.add(new long[] {
      1, 5, 4, 3, 10, 2, 100, 101, 99, 88, -1, -255, -100, -99, -98, Long.MIN_VALUE, 8960, 8959, 19999, 15001
  });

  MockRegionManager mgr = new MockRegionManager(ImmutableList.of(
      keyRangeByHandle(tableId, null, Status.EQUAL, -100L, Status.EQUAL),
      keyRangeByHandle(tableId, -100L, Status.EQUAL, 10L, Status.GREATER),
      keyRangeByHandle(tableId, 10L, Status.GREATER, 50L, Status.EQUAL),
      keyRangeByHandle(tableId, 50L, Status.EQUAL, 100L, Status.GREATER),
      keyRangeByHandle(tableId, 100L, Status.GREATER, 9000L, Status.LESS),
      keyRangeByHandle(tableId, 0x2300L /*8960*/, Status.LESS, 16000L, Status.EQUAL),
      keyRangeByHandle(tableId, 16000L, Status.EQUAL, null, Status.EQUAL)
  ));

  RangeSplitter s = RangeSplitter.newSplitter(mgr);
  List<RangeSplitter.RegionTask> tasks = s.splitHandlesByRegion(tableId, handles);

  // [-INF, -100): [Long.MIN_VALUE, Long.MIN_VALUE + 1), [-255, -254)
  assertEquals(tasks.get(0).getRegion().getId(), 0);
  assertEquals(tasks.get(0).getRanges().size(), 2);
  assertEquals(tasks.get(0).getRanges().get(0), keyRangeByHandle(tableId, Long.MIN_VALUE, Long.MIN_VALUE + 1));
  assertEquals(tasks.get(0).getRanges().get(1), keyRangeByHandle(tableId, -255L, -254L));

  // [-100, 10.x): [-100, -97), [-1, 0), [1, 6), [10, 11)
  assertEquals(tasks.get(1).getRegion().getId(), 1);
  assertEquals(tasks.get(1).getRanges().size(), 4);
  assertEquals(tasks.get(1).getRanges().get(0), keyRangeByHandle(tableId, -100L, -97L));
  assertEquals(tasks.get(1).getRanges().get(1), keyRangeByHandle(tableId, -1L, 0L));
  assertEquals(tasks.get(1).getRanges().get(2), keyRangeByHandle(tableId, 1L, 6L));
  assertEquals(tasks.get(1).getRanges().get(3), keyRangeByHandle(tableId, 10L, 11L));

  // [10.x, 50): empty
  // [50, 100.x): [88, 89) [99, 101)
  assertEquals(tasks.get(2).getRegion().getId(), 3);
  assertEquals(tasks.get(2).getRanges().size(), 2);
  assertEquals(tasks.get(2).getRanges().get(0), keyRangeByHandle(tableId, 88L, 89L));
  assertEquals(tasks.get(2).getRanges().get(1), keyRangeByHandle(tableId, 99L, 101L));

  // [100.x, less than 8960): [101, 102) [8959, 8960)
  assertEquals(tasks.get(3).getRegion().getId(), 4);
  assertEquals(tasks.get(3).getRanges().size(), 2);
  assertEquals(tasks.get(3).getRanges().get(0), keyRangeByHandle(tableId, 101L, 102L));
  assertEquals(tasks.get(3).getRanges().get(1), keyRangeByHandle(tableId, 8959L, 8960L));

  // [less than 8960, 16000): [9000, 9001), [15001, 15002)
  assertEquals(tasks.get(4).getRegion().getId(), 5);
  assertEquals(tasks.get(4).getRanges().size(), 2);
  assertEquals(tasks.get(4).getRanges().get(0), keyRangeByHandle(tableId, 8960L, 8961L));
  assertEquals(tasks.get(4).getRanges().get(1), keyRangeByHandle(tableId, 15001L, 15002L));

  // [16000, INF): [19999, 20000)
  assertEquals(tasks.get(5).getRegion().getId(), 6);
  assertEquals(tasks.get(5).getRanges().size(), 1);
  assertEquals(tasks.get(5).getRanges().get(0), keyRangeByHandle(tableId, 19999L, 20000L));
}
 
开发者ID:pingcap,项目名称:tikv-client-lib-java,代码行数:60,代码来源:RangeSplitterTest.java

示例15: read

import gnu.trove.list.array.TLongArrayList; //导入方法依赖的package包/类
public static InMemoryListDataSet read(OsmIterator iterator,
                                       boolean keepNodeTags, boolean keepWayTags, boolean keepRelationTags)
        throws IOException {
    InMemoryListDataSet dataSet = new InMemoryListDataSet();

    List<OsmNode> nodes = dataSet.getNodes();
    List<OsmWay> ways = dataSet.getWays();
    List<OsmRelation> relations = dataSet.getRelations();

    if (iterator.hasBounds()) {
        dataSet.setBounds(iterator.getBounds());
    }

    while (iterator.hasNext()) {
        EntityContainer container = iterator.next();
        switch (container.getType()) {
            case Node:
                OsmNode node = (OsmNode) container.getEntity();
                if (!keepNodeTags) {
                    node = new Node(node.getId(), node.getLongitude(),
                            node.getLatitude());
                }
                nodes.add(node);
                break;
            case Way:
                OsmWay way = (OsmWay) container.getEntity();
                if (!keepWayTags) {
                    TLongArrayList ids = new TLongArrayList();
                    for (int i = 0; i < way.getNumberOfNodes(); i++) {
                        ids.add(way.getNodeId(i));
                    }
                    way = new Way(way.getId(), ids);
                }
                ways.add(way);
                break;
            case Relation:
                OsmRelation relation = (OsmRelation) container.getEntity();
                if (!keepRelationTags) {
                    List<OsmRelationMember> members = new ArrayList<>();
                    for (int i = 0; i < relation.getNumberOfMembers(); i++) {
                        members.add(relation.getMember(i));
                    }
                    relation = new Relation(relation.getId(), members);
                }
                relations.add(relation);
                break;
        }
    }

    return dataSet;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:52,代码来源:ListDataSetLoader.java


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