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


Java TIntProcedure类代码示例

本文整理汇总了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();
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:21,代码来源:TObjectIntHashMap.java

示例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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TPrimitiveOffheapArrayListTest.java

示例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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TPrimitiveOffheapArrayListTest.java

示例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 );
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:22,代码来源:TPrimitiveOffheapArrayListTest.java

示例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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TPrimitiveArrayListTest.java

示例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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TPrimitiveArrayListTest.java

示例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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TPrimitiveLinkedListTest.java

示例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 ) );
    }
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TPrimitiveLinkedListTest.java

示例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();
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:22,代码来源:TObjectIntHashMap.java

示例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();
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:25,代码来源:RTree.java

示例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;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:28,代码来源:RTree.java

示例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 ) );
    }
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:19,代码来源:TPrimitiveLinkedListTest.java

示例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 ) );
    }
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:19,代码来源:TPrimitiveLinkedListTest.java

示例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 ) );
    }
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:19,代码来源:TPrimitiveArrayListTest.java

示例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 ) );
    }
}
 
开发者ID:leventov,项目名称:trove-over-koloboke-compile,代码行数:19,代码来源:TPrimitiveArrayListTest.java


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