本文整理汇总了Java中gnu.trove.procedure.TIntProcedure类的典型用法代码示例。如果您正苦于以下问题:Java TIntProcedure类的具体用法?Java TIntProcedure怎么用?Java TIntProcedure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TIntProcedure类属于gnu.trove.procedure包,在下文中一共展示了TIntProcedure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
@Override
public String toString() {
final StringBuilder buf = new StringBuilder( "{" );
forEachValue( new TIntProcedure() {
private boolean first = true;
public boolean execute( int value ) {
if ( first ) {
first = false;
} else {
buf.append( ", " );
}
buf.append( value );
return true;
}
} );
buf.append( "}" );
return buf.toString();
}
示例2: testGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testGrep() {
int element_count = 20;
TIntList a = new TIntOffheapArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.grep( new TIntProcedure() {
@Override
public boolean execute( int value ) {
return value > 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例3: testInverseGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testInverseGrep() {
int element_count = 20;
TIntList a = new TIntOffheapArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.inverseGrep( new TIntProcedure() {
@Override
public boolean execute( int value ) {
return value <= 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例4: testForEachDescending
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testForEachDescending() {
int element_count = 20;
TIntList a = new TIntOffheapArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
class ForEach implements TIntProcedure {
TIntList built = new TIntOffheapArrayList();
@Override
public boolean execute( int value ) {
built.add( value );
return true;
}
}
ForEach foreach = new ForEach();
a.forEachDescending( foreach );
}
示例5: testGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testGrep() {
int element_count = 20;
TIntList a = new TIntArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.grep( new TIntProcedure() {
@Override
public boolean execute( int value ) {
return value > 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例6: testInverseGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testInverseGrep() {
int element_count = 20;
TIntList a = new TIntArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.inverseGrep( new TIntProcedure() {
@Override
public boolean execute( int value ) {
return value <= 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例7: testGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testGrep() {
int element_count = 20;
TIntList a = new TIntLinkedList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.grep( new TIntProcedure() {
@Override
public boolean execute( int value ) {
return value > 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例8: testInverseGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testInverseGrep() {
int element_count = 20;
TIntList a = new TIntLinkedList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.inverseGrep( new TIntProcedure() {
@Override
public boolean execute( int value ) {
return value <= 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例9: toString
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
@Override
public String toString() {
final StringBuilder buf = new StringBuilder( "{" );
forEachValue( new TIntProcedure() {
private boolean first = true;
@Override
public boolean execute( int value ) {
if ( first ) {
first = false;
} else {
buf.append( ", " );
}
buf.append( value );
return true;
}
} );
buf.append( "}" );
return buf.toString();
}
示例10: nearestNUnsorted
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
/**
* @see com.infomatiq.jsi.SpatialIndex#nearestNUnsorted(Point, TIntProcedure, int, float)
*/
@Override
public void nearestNUnsorted(Point p, TIntProcedure v, int count,
float furthestDistance) {
// This implementation is designed to give good performance
// where
// o N is high (100+)
// o The results do not need to be sorted by distance.
//
// Uses a priority queue as the underlying data structure.
//
// The behaviour of this algorithm has been carefully designed to
// return exactly the same items as the the original version (nearestN_orig), in particular,
// more than N items will be returned if items N and N+x have the
// same priority.
this.createNearestNDistanceQueue(p, count, furthestDistance);
while (this.distanceQueue.size() > 0) {
v.execute(this.distanceQueue.getValue());
this.distanceQueue.pop();
}
}
示例11: intersects
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
/**
* Recursively searches the tree for all intersecting entries.
* Immediately calls execute() on the passed IntProcedure when
* a matching entry is found.
* <p>
* TODO rewrite this to be non-recursive? Make sure it
* doesn't slow it down.
*/
private boolean intersects(Rectangle r, TIntProcedure v, Node n) {
for (int i = 0; i < n.entryCount; i++) {
if (Rectangle.intersects(r.minX, r.minY, r.maxX, r.maxY,
n.entriesMinX[i], n.entriesMinY[i], n.entriesMaxX[i],
n.entriesMaxY[i])) {
if (n.isLeaf()) {
if (!v.execute(n.ids[i])) {
return false;
}
} else {
Node childNode = this.getNode(n.ids[i]);
if (!this.intersects(r, v, childNode)) {
return false;
}
}
}
}
return true;
}
示例12: testGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testGrep() {
int element_count = 20;
TIntList a = new TIntLinkedList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.grep( new TIntProcedure() {
public boolean execute( int value ) {
return value > 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例13: testInverseGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testInverseGrep() {
int element_count = 20;
TIntList a = new TIntLinkedList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.inverseGrep( new TIntProcedure() {
public boolean execute( int value ) {
return value <= 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例14: testGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testGrep() {
int element_count = 20;
TIntList a = new TIntArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.grep( new TIntProcedure() {
public boolean execute( int value ) {
return value > 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}
示例15: testInverseGrep
import gnu.trove.procedure.TIntProcedure; //导入依赖的package包/类
public void testInverseGrep() {
int element_count = 20;
TIntList a = new TIntArrayList();
for ( int i = 1; i < element_count; i++ ) {
a.add( i );
}
TIntList grepped = a.inverseGrep( new TIntProcedure() {
public boolean execute( int value ) {
return value <= 10;
}
} );
for ( int i = 0; i < grepped.size(); i++ ) {
int expected = i + 11;
assertEquals( expected, grepped.get( i ) );
}
}