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


Java TLongList类代码示例

本文整理汇总了Java中gnu.trove.list.TLongList的典型用法代码示例。如果您正苦于以下问题:Java TLongList类的具体用法?Java TLongList怎么用?Java TLongList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: subList

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
  public TLongList subList( int begin, int end ) {
  	if ( end < begin ) {
	throw new IllegalArgumentException( "end index " + end +
		" greater than begin index " + begin );
}
if ( begin < 0 ) {
	throw new IndexOutOfBoundsException( "begin index can not be < 0" );
}
if ( end > _data.length ) {
	throw new IndexOutOfBoundsException( "end index < " + _data.length );
}
      TLongArrayList list = new TLongArrayList( end - begin );
      for ( int i = begin; i < end; i++ ) {
      	list.add( _data[ i ] );
      }
      return list;
  }
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:19,代码来源:TLongArrayList.java

示例2: subList

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
public TLongList subList(int begin, int end) {
    if (end < begin) {
        throw new IllegalArgumentException("begin index " + begin +
                " greater than end index " + end);
    }
    if (size < begin) {
        throw new IllegalArgumentException("begin index " + begin +
                " greater than last index " + size);
    }
    if (begin < 0) {
        throw new IndexOutOfBoundsException("begin index can not be < 0");
    }
    if (end > size) {
        throw new IndexOutOfBoundsException("end index < " + size);
    }

    TLongLinkedList ret = new TLongLinkedList();
    TLongLink tmp = getLinkAt(begin);
    for (int i = begin; i < end; i++) {
        ret.add(tmp.getValue()); // copy
        tmp = tmp.getNext();
    }

    return ret;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:27,代码来源:TLongLinkedList.java

示例3: equals

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean equals( Object other ) {
    if ( other == this ) {
        return true;
    }
    if ( !( other instanceof TLongList ) ) return false;

    TLongList that = ( TLongList )other;
    if ( size() != that.size() ) return false;

    for( int i = 0; i < size(); i++ ) {
        if ( get( i ) != that.get( i ) ) {
            return false;
        }
    }
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:TLongLinkedList.java

示例4: subList

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
  @Override
  public TLongList subList( int begin, int end ) {
  	if ( end < begin ) {
	throw new IllegalArgumentException( "end index " + end +
		" greater than begin index " + begin );
}
if ( begin < 0 ) {
	throw new IndexOutOfBoundsException( "begin index can not be < 0" );
}
if ( end > _data.length ) {
	throw new IndexOutOfBoundsException( "end index < " + _data.length );
}
      TLongArrayList list = new TLongArrayList( end - begin );
      for ( int i = begin; i < end; i++ ) {
      	list.add( _data[ i ] );
      }
      return list;
  }
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TLongArrayList.java

示例5: toSegmentRing

import gnu.trove.list.TLongList; //导入依赖的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);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:22,代码来源:ChainOfWays.java

示例6: partitionTimestamps

import gnu.trove.list.TLongList; //导入依赖的package包/类
/**
 * Partition timestamps according to the blocks that they should be in.
 *
 * @param timestamps The complete set of timestamps. Must be unique and
 * ordered.
 * @return A list of timestamp partitions.
 */
private static List<TLongList> partitionTimestamps(TLongList timestamps) {
    if (timestamps.isEmpty()) return emptyList();
    final List<TLongList> partitions = new ArrayList<>();

    TLongList active = new TLongArrayList();
    final TLongIterator tsIter = timestamps.iterator();
    active.add(tsIter.next());

    while (tsIter.hasNext()) {
        final long next = tsIter.next();
        assert next > active.get(active.size() - 1);

        if (next - active.get(active.size() - 1) > Integer.MAX_VALUE || active.size() >= MAX_BLOCK_RECORDS) {
            partitions.add(active);
            active = new TLongArrayList();
        }
        active.add(next);
    }
    partitions.add(active);

    assert partitions.stream().mapToInt(TLongList::size).sum() == timestamps.size();
    return partitions;
}
 
开发者ID:groupon,项目名称:monsoon,代码行数:31,代码来源:ToXdrTables.java

示例7: testLongUnmodifiableEquality

import gnu.trove.list.TLongList; //导入依赖的package包/类
public void testLongUnmodifiableEquality() {
	TLongList list1 = new TLongLinkedList();
	TLongList list2 = new TLongLinkedList();

	assertEquals( list1, list2 );
	assertEquals( list1, TCollections.unmodifiableList( list2 ) );
	assertEquals( TCollections.unmodifiableList( list1 ), list2 );
	assertEquals( TCollections.unmodifiableList( list1 ),
		TCollections.unmodifiableList( list2 ) );

	list1.add( 1 );
	list1.add( 2 );
	list1.add( 3 );

	list2.add( 1 );
	list2.add( 2 );
	list2.add( 3 );

	assertEquals( list1, list2 );
	assertEquals( list1, TCollections.unmodifiableList( list2 ) );
	assertEquals( TCollections.unmodifiableList( list1 ), list2 );
	assertEquals( TCollections.unmodifiableList( list1 ),
		TCollections.unmodifiableList( list2 ) );
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:25,代码来源:TLinkedListTest.java

示例8: testLongUnmodifiableEquality

import gnu.trove.list.TLongList; //导入依赖的package包/类
public void testLongUnmodifiableEquality() {
	TLongList list1 = new TLongArrayList();
	TLongList list2 = new TLongArrayList();

	assertEquals( list1, list2 );
	assertEquals( list1, TCollections.unmodifiableList( list2 ) );
	assertEquals( TCollections.unmodifiableList( list1 ), list2 );
	assertEquals( TCollections.unmodifiableList( list1 ),
		TCollections.unmodifiableList( list2 ) );

	list1.add( 1 );
	list1.add( 2 );
	list1.add( 3 );

	list2.add( 1 );
	list2.add( 2 );
	list2.add( 3 );

	assertEquals( list1, list2 );
	assertEquals( list1, TCollections.unmodifiableList( list2 ) );
	assertEquals( TCollections.unmodifiableList( list1 ), list2 );
	assertEquals( TCollections.unmodifiableList( list1 ),
		TCollections.unmodifiableList( list2 ) );
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:25,代码来源:TArrayListTest.java

示例9: set

import gnu.trove.list.TLongList; //导入依赖的package包/类
public void set(final TLongList value) {
    final Command command = new Command(Command.SETALL, (short) value.size());
    commands.add(command);
    ++baselineCommandCount;

    //Is this the best way to do this?
    v.clear();
    v.addAll(value);

    for (int i = 0, size = value.size(); i < size; ++i) {
        final Command subCommand = new Command(Command.SET, (short) i, value.get(i));
        commands.add(subCommand);
        ++baselineCommandCount;
    }

    touch();
    onChanged();
}
 
开发者ID:bacta,项目名称:pre-cu,代码行数:19,代码来源:AutoDeltaLongVector.java

示例10: grep

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
public TLongList grep( TLongProcedure condition ) {
    TLongArrayList list = new TLongArrayList();
    for ( int i = 0; i < _pos; i++ ) {
        if ( condition.execute( _data[ i ] ) ) {
            list.add( _data[ i ] );
        }
    }
    return list;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:11,代码来源:TLongArrayList.java

示例11: inverseGrep

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
public TLongList inverseGrep( TLongProcedure condition ) {
    TLongArrayList list = new TLongArrayList();
    for ( int i = 0; i < _pos; i++ ) {
        if ( !condition.execute( _data[ i ] ) ) {
            list.add( _data[ i ] );
        }
    }
    return list;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:11,代码来源:TLongArrayList.java

示例12: TLongLinkedList

import gnu.trove.list.TLongList; //导入依赖的package包/类
public TLongLinkedList(TLongList list) {
    no_entry_value = list.getNoEntryValue();
    //
    for (TLongIterator iterator = list.iterator(); iterator.hasNext();) {
        long next = iterator.next();
        add(next);
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:9,代码来源:TLongLinkedList.java

示例13: 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);
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:8,代码来源:TLongLinkedList.java

示例14: grep

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
public TLongList grep(TLongProcedure condition) {
    TLongList ret = new TLongLinkedList();
    for (TLongLink l = head; got(l); l = l.getNext()) {
        if (condition.execute(l.getValue()))
            ret.add(l.getValue());
    }
    return ret;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:10,代码来源:TLongLinkedList.java

示例15: inverseGrep

import gnu.trove.list.TLongList; //导入依赖的package包/类
/** {@inheritDoc} */
public TLongList inverseGrep(TLongProcedure condition) {
    TLongList ret = new TLongLinkedList();
    for (TLongLink l = head; got(l); l = l.getNext()) {
        if (!condition.execute(l.getValue()))
            ret.add(l.getValue());
    }
    return ret;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:10,代码来源:TLongLinkedList.java


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