Java 类gnu.trove.iterator.TLongIntIterator 实例源码

项目:SRLParser    文件:Alphabet.java   
public Alphabet(Alphabet a)
{
    numEntries = a.numEntries;
    map = new TLongIntHashMap(numEntries);      
    for (TLongIntIterator iter = a.map.iterator(); iter.hasNext();) {
        iter.advance();
        map.put(iter.key(), iter.value());
    }
}
项目:G    文件:GraphWriter.java   
public static void saveLongIntDictionary(LongIntDict dict, String fileName) throws IOException {
    long time = System.currentTimeMillis();
    TLongIntIterator iter = dict.getIterator();
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(fileName))));
    String newLine = "";
    while (iter.hasNext()) {
        iter.advance();
        newLine = "" + iter.key() + "\t" + iter.value();
        bw.write(newLine);
        bw.newLine();
    }
    bw.flush();
    bw.close();
    logger.info(((System.currentTimeMillis() - time) / 1000d) + "s");
}
项目:G    文件:LongIntDict.java   
public synchronized TIntLongMap  getInverted(){
    TIntLongMap inverted=TCollections.synchronizedMap(new TIntLongHashMap());

    TLongIntIterator iter = this.getIterator();
    while (iter.hasNext()) {
        iter.advance();
        inverted.put(iter.value(), iter.key());         
    }

    return inverted;
}
项目:G    文件:LongIntDict.java   
public TLongIntIterator getIterator(){
    return this.map.iterator();
}
项目:pre-cu    文件:AutoDeltaLongIntMap.java   
public TLongIntIterator iterator() {
    return container.iterator();
}
项目:it.cnr.isti.vir    文件:LSHHammingLongs_Archive.java   
public String toString()  {
        StringBuilder tStr = new StringBuilder();

//      tStr.append("- buckets\n");
//      for ( int i=0; i<tables.length; i++ ) {
//          
//          tStr.append(gs[i]);
//          
//          int sum = 0;
//          for ( int j=0; j<tables[i].length; j++ ) {
//              
//              if (tables[i][j]==null) continue;
//              tStr.append(tables[i][j].size() + " ");
//              sum+=tables[i][j].size();
//              
//              
//          }
//          tStr.append("\t[" + sum + "]\n");
//          
//          
//      }

        tStr.append( "- nBuckets:\t" );
        for ( int i=0; i<ls.length; i++ ) {
            if ( i>0 ) tStr.append(", ");
            tStr.append( ls[i].getNumberOfBuckets() );
        }
        tStr.append("\n");

        long nNotNulls = 0;
        int maxN = -1;
        int maxID1 = -1;
        long maxID2 = -1;
        long sum =0;
        for ( int i1=0; i1<ls.length; i1++ ) {
            //for ( int i2=0; i2<ls[i1].nh; i2++ ) {
            for ( TLongIntIterator it = ls[i1].bSize.iterator(); it.hasNext();  ) { 
                it.advance();
                int csize = it.value();
                if ( csize > 0 ) {
                    nNotNulls += 1;
                    int size = csize;
                    sum += size;
                    if ( size > maxN ) {
                        maxN=size;
                        maxID1=i1;
                        maxID2=it.key();
                    }
                }

            }
        }


        tStr.append("- nObjs\t" + (sum / (double) ls.length) + "\n");

        tStr.append("- notNullBuckets\t" + nNotNulls + "\n");

        tStr.append("- avgNotNullBucketSize\t" + sum/(double) nNotNulls + "\n");

        tStr.append("- biggestBucket\t" + maxN + "\t" + "(" + maxID1 + "," + maxID2 +")");

        //      try {
//          tStr.append("- sizeInBytes\t" + this.getDataSizeInBytes() + "\n");
//          tStr.append("- nObjects\t" + this.getNObjs() + "\n");
//      } catch (IOException e) {
//          // TODO Auto-generated catch block
//          e.printStackTrace();
//      }



        return tStr.toString();
    }