本文整理汇总了Java中gnu.trove.list.array.TLongArrayList类的典型用法代码示例。如果您正苦于以下问题:Java TLongArrayList类的具体用法?Java TLongArrayList怎么用?Java TLongArrayList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TLongArrayList类属于gnu.trove.list.array包,在下文中一共展示了TLongArrayList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateAllReduceFactors
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
@Override
public void calculateAllReduceFactors(final TLongObjectMap<TLongArrayList> nodeSegmentTable,
final TLongObjectMap<ISegment> segmentsTable,
final TLongSet relevantLinks,
TLongObjectMap<IPixelCut> pixelCuts) {
TLongObjectMap<IRenderingSegment> renderingResults = new TLongObjectHashMap<>();
nodeSegmentTable.forEachEntry((nodeId, segmentIds) -> {
if (segmentIds.size() > 1) {
ISegment[] segments = new ISegment[segmentIds.size()];
for (int i = 0; i < segmentIds.size(); i++) {
segments[i] = segmentsTable.get(segmentIds.get(i));
}
investigateNode(nodeId, renderingResults, segments);
}
return true;
});
adaptPixelCuts(pixelCuts, renderingResults);
}
示例2: WaySink
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
public WaySink(TLongObjectHashMap<List<WayRef>> wayRefs, TLongObjectHashMap<NodeCoord> nodes,
TLongObjectHashMap<List<IWaySegment>> segmentedWaySegments, TLongObjectHashMap<List<Relation>> wayRelations,
BlockingQueue<IWaySegment> waysQueue) {
this.wayRefs = wayRefs;
this.nodes = nodes;
this.wayRelations = wayRelations;
this.segmentedWaySegments = segmentedWaySegments;
for (long nodeId : wayRefs.keys()) {
List<WayRef> wayRefList = wayRefs.get(nodeId);
for (WayRef wayRef : wayRefList) {
if (wayRef.getType() == 2) {
if (waysToSegment.get(wayRef.getWayId()) == null) {
waysToSegment.put(wayRef.getWayId(), new TLongArrayList(new long[] {nodeId}));
} else {
waysToSegment.get(wayRef.getWayId()).add(nodeId);
}
}
}
}
this.waysQueue = waysQueue;
this.connectionsBuilder = new ConnectionsBuilder();
}
示例3: SegmentationWaySink
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
public SegmentationWaySink(TLongObjectHashMap<List<WayRef>> wayRefs, TLongObjectHashMap<List<Relation>> wayRelations,
BlockingQueue<IWaySegment> waysQueue) {
this.wayRefs = wayRefs;
this.wayRelations = wayRelations;
for (long nodeId : wayRefs.keys()) {
List<WayRef> wayRefList = wayRefs.get(nodeId);
for (WayRef wayRef : wayRefList) {
if (wayRef.getType() == 2) {
if (waysToSegment.get(wayRef.getWayId()) == null) {
waysToSegment.put(wayRef.getWayId(), new TLongArrayList(new long[] {nodeId}));
} else {
waysToSegment.get(wayRef.getWayId()).add(nodeId);
}
}
}
}
this.waysQueue = waysQueue;
connectionsBuilder = new ConnectionsBuilder();
}
示例4: 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;
}
示例5: toSegmentRing
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
public ChainOfNodes toSegmentRing() {
if (this.segments.isEmpty()) {
return new ChainOfNodes(new TLongArrayList());
}
int len = this.getLengthNonEmpty();
TLongList ids = new TLongArrayList(len);
for (int i = 0; i < this.segments.size(); i++) {
WaySegment segment = this.segments.get(i);
OsmWay way = segment.getWay();
for (int k = 0; k < way.getNumberOfNodes(); k++) {
if (k > 0 || i == 0) {
ids.add(segment.getNodeId(k));
}
}
}
return new ChainOfNodes(ids);
}
示例6: 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);
}
}
}
示例7: 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();
}
示例8: 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;
}
示例9: 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();
}
示例10: 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();
}
示例11: deleteByGlobalId
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
public static void deleteByGlobalId(final ODLDatastore<? extends ODLTable> ds, boolean useTransaction, long...ids){
if(useTransaction){
ds.startTransaction();
}
try {
// split by table id
TIntObjectMap<TLongArrayList> byTable =splitGlobalIdsByTable(ids);
byTable.forEachEntry(new TIntObjectProcedure<TLongArrayList>() {
@Override
public boolean execute(int tableId, TLongArrayList rowIds) {
ODLTable table = ds.getTableByImmutableId(tableId);
if(table!=null){
deleteById(table, rowIds.toArray());
}
return true;
}
});
}finally{
if(useTransaction){
ds.endTransaction();
}
}
}
示例12: 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);
}
示例13: TLongArrayStack
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
/**
* Creates a new <code>TLongArrayStack</code> instance that is
* a copy of the instanced passed to us.
*
* @param stack the instance to copy
*/
public TLongArrayStack( TLongStack stack ) {
if ( stack instanceof TLongArrayStack ) {
TLongArrayStack array_stack = ( TLongArrayStack ) stack;
this._list = new TLongArrayList( array_stack._list );
} else {
throw new UnsupportedOperationException( "Only support TLongArrayStack" );
}
}
示例14: readExternal
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
public void readExternal( ObjectInput in )
throws IOException, ClassNotFoundException {
// VERSION
in.readByte();
// LIST
_list = ( TLongArrayList ) in.readObject();
}
示例15: calculatePixelCutOffset
import gnu.trove.list.array.TLongArrayList; //导入依赖的package包/类
private TLongObjectMap<IPixelCut> calculatePixelCutOffset(IImportConfig config,
TLongSet linkIdsEnqueued,
TLongObjectMap<IGipLink> links){
log.info("phase pixel cut calculation ....");
TLongObjectMap<IPixelCut> renderingResultPerSegment = new TLongObjectHashMap<>();
final TLongObjectHashMap<TLongArrayList> nodeLinksConnectionTable = new TLongObjectHashMap<>();
log.info("Link Ids Queued size: " + linkIdsEnqueued.size());
GipLinkFilter filter = new GipLinkFilter(config.getMaxFrc(),config.getMinFrc(),config.getIncludedGipIds(),
config.getExcludedGipIds(),config.isEnableSmallConnections());
TLongSet filteredLinks = filter.filter(links);
linkIdsEnqueued.forEach(value -> {
//enqued Gip Links that after they have been filtered.
if (filteredLinks.contains(value)) {
IGipLink link = links.get(value);
if (link != null) {
if (link.getFromNodeId() != 0) {
if (!nodeLinksConnectionTable.containsKey(link.getFromNodeId())) {
nodeLinksConnectionTable.put(link.getFromNodeId(), new TLongArrayList());
}
nodeLinksConnectionTable.get(link.getFromNodeId()).add(link.getId());
}
if (link.getToNodeId() != 0) {
if (!nodeLinksConnectionTable.containsKey(link.getToNodeId())) {
nodeLinksConnectionTable.put(link.getToNodeId(), new TLongArrayList());
}
nodeLinksConnectionTable.get(link.getToNodeId()).add(link.getId());
}
}
}
return true;
});
log.info("Filtered Links Size " + filteredLinks.size());
renderingResultPerSegment = new TLongObjectHashMap<>();
IRenderingCalculator renderingCalculator = new RenderingCalculatorImpl();
renderingCalculator.calculateAllReduceFactors(nodeLinksConnectionTable, adaptSegments(links), filteredLinks, renderingResultPerSegment);
log.info("Rendering result size " + renderingResultPerSegment.size());
return renderingResultPerSegment;
}