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

项目:trove-3.0.3    文件:TObjectPrimitiveHashMapTest.java   
public void testIteratorRemoval2() {
    int element_count = 10000;
    int remaining = element_count / 2;

    TObjectIntHashMap<String> map =
            new TObjectIntHashMap<String>( element_count, 0.5f, Integer.MIN_VALUE );

    for ( int pass = 0; pass < 10; pass++ ) {
        Random r = new Random();
        for ( int i = 0; i <= element_count; i++ ) {
            map.put( String.valueOf( r.nextInt() ), i );
        }

        TObjectIntIterator iterator = map.iterator();
        while ( map.size() > remaining && iterator.hasNext() ) {
            iterator.advance();
            iterator.remove();
        }
    }
}
项目:DynamicSurroundings    文件:SoundManagerReplacement.java   
@SubscribeEvent(priority = EventPriority.LOW)
public void diagnostics(final DiagnosticEvent.Gather event) {
    final TObjectIntHashMap<String> counts = new TObjectIntHashMap<String>();

    final Iterator<Entry<String, ISound>> iterator = this.playingSounds.entrySet().iterator();
    while (iterator.hasNext()) {
        Entry<String, ISound> entry = iterator.next();
        ISound isound = entry.getValue();
        counts.adjustOrPutValue(isound.getSound().getSoundLocation().toString(), 1, 1);
    }

    final ArrayList<String> results = new ArrayList<String>();
    final TObjectIntIterator<String> itr = counts.iterator();
    while (itr.hasNext()) {
        itr.advance();
        results.add(String.format(TextFormatting.GOLD + "%s: %d", itr.key(), itr.value()));
    }
    Collections.sort(results);
    event.output.addAll(results);

}
项目:DynamicSurroundings    文件:AreaSoundEffectHandler.java   
private static void getBiomeSounds(@Nonnull final TObjectFloatHashMap<SoundEffect> result) {
    // Need to collect sounds from all the applicable biomes
    // along with their weights.
    final TObjectIntIterator<BiomeInfo> info = AreaSurveyHandler.getBiomes().iterator();
    while (info.hasNext()) {
        info.advance();
        final List<SoundEffect> bs = new ArrayList<SoundEffect>();
        info.key().findSoundMatches(bs);
        for (final SoundEffect sound : bs) {
            final int w = info.value();
            result.adjustOrPutValue(sound, w, w);
        }
    }

    // Scale the volumes in the resulting list based on the weights
    final int area = AreaSurveyHandler.getBiomeArea();
    final TObjectFloatIterator<SoundEffect> itr = result.iterator();
    while (itr.hasNext()) {
        itr.advance();
        final float scale = 0.1F + 0.9F * ((float) itr.value() / (float) area);
        itr.setValue(scale);
    }
}
项目:trove-over-koloboke-compile    文件:TObjectPrimitiveHashMapTest.java   
public void testIteratorRemoval2() {
    int element_count = 10000;
    int remaining = element_count / 2;

    TObjectIntMap<String> map = withExpectedSizeAndNoEntryValue( element_count, Integer.MIN_VALUE );

    for ( int pass = 0; pass < 10; pass++ ) {
        Random r = new Random();
        for ( int i = 0; i <= element_count; i++ ) {
            map.put( String.valueOf( r.nextInt() ), i );
        }

        TObjectIntIterator iterator = map.iterator();
        while ( map.size() > remaining && iterator.hasNext() ) {
            iterator.advance();
            iterator.remove();
        }
    }
}
项目:lodreclib    文件:TopItemPathExtractorWorker.java   
/**
 * Get string path from index
 * @param     index  index of the string path
 * @return    string path
 */
public String getPathFromIndex(int index){

    synchronized(path_index){

        TObjectIntIterator<String> it = path_index.iterator();
        while(it.hasNext()){
            it.advance();
            if(it.value()==index)
                return (String) it.key();
        }

        return null;
    }

}
项目:gnu.trove    文件:TObjectPrimitiveHashMapTest.java   
public void testIteratorRemoval2() {
    int element_count = 10000;
    int remaining = element_count / 2;

    TObjectIntHashMap<String> map =
            new TObjectIntHashMap<String>( element_count, 0.5f, Integer.MIN_VALUE );

    for ( int pass = 0; pass < 10; pass++ ) {
        Random r = new Random();
        for ( int i = 0; i <= element_count; i++ ) {
            map.put( String.valueOf( r.nextInt() ), i );
        }

        TObjectIntIterator iterator = map.iterator();
        while ( map.size() > remaining && iterator.hasNext() ) {
            iterator.advance();
            iterator.remove();
        }
    }
}
项目:ontopia    文件:Term.java   
/**
 * PUBLIC: Returns the preferred variant of the term. This is a form
 * of the term which actually occurred in the classified content.
 */
public String getPreferredName() {
  if (variants.isEmpty())
    return getStem();
  Variant maxKey = null;
  int maxValue = -1;
  TObjectIntIterator<Variant> iter = variants.iterator();
  while (iter.hasNext()) {
    iter.advance();
    int thisValue = iter.value();
    Variant thisKey = iter.key();
    // select variant with most occurrences, or lowest lexical value if equal for predictability
    if ((thisValue > maxValue) ||
        ((thisValue == maxValue) && (thisKey.getValue().compareTo(maxKey.getValue()) < 0))) {
      maxValue = thisValue;
      maxKey = thisKey;
    }
  }
  return maxKey.getValue();
}
项目:ontopia    文件:Term.java   
protected void merge(Term other) {
  if (other == this) return;

  this.score = this.score + other.score;    
  this.totalOccurrences = this.totalOccurrences + other.totalOccurrences;

  TObjectIntIterator<Variant> iter = other.variants.iterator();
  while (iter.hasNext()) {
    iter.advance();
    Variant key = iter.key();
    int value = iter.value();
    if (this.variants.containsKey(key))
      this.variants.adjustValue(key, value);
    else
      this.variants.put(key, value);
    key.replaceTerm(this);
  }
}
项目:lodreclib    文件:TopItemPathExtractorWorker.java   
/**
 * Get string path from index
 * @param     index  index of the string path
 * @return    string path
 */
public String getPathFromIndex(int index){

    synchronized(path_index){

        TObjectIntIterator<String> it = path_index.iterator();
        while(it.hasNext()){
            it.advance();
            if(it.value()==index)
                return (String) it.key();
        }

        return null;
    }

}
项目:trove    文件:TObjectPrimitiveHashMapTest.java   
public void testIteratorRemoval2() {
    int element_count = 10000;
    int remaining = element_count / 2;

    TObjectIntHashMap<String> map =
            new TObjectIntHashMap<String>( element_count, 0.5f, Integer.MIN_VALUE );

    for ( int pass = 0; pass < 10; pass++ ) {
        Random r = new Random();
        for ( int i = 0; i <= element_count; i++ ) {
            map.put( String.valueOf( r.nextInt() ), i );
        }

        TObjectIntIterator iterator = map.iterator();
        while ( map.size() > remaining && iterator.hasNext() ) {
            iterator.advance();
            iterator.remove();
        }
    }
}
项目:xcc    文件:CodeGenDAGPatterns.java   
/**
 * Find dependent variables within child patterns.
 * @param node
 * @param depVars
 */
private void findDepVars(TreePatternNode node, HashSet<String> depVars)
{
    TObjectIntHashMap<String> depCounts = new TObjectIntHashMap<>();
    for(TObjectIntIterator<String> itr = depCounts.iterator(); itr.hasNext();)
    {
        if (itr.value() > 1)
            depVars.add(itr.key());
    }
}
项目:xcc    文件:AssemblyWriter.java   
public static void writeMDNodes(FormattedOutputStream os,
        TypePrinting printer,
        SlotTracker slotTable)
{
    MDNode[] nodes = new MDNode[slotTable.getMdnMap().size()];
    TObjectIntIterator<Value> itr = slotTable.getMdnMap().iterator();
    while (itr.hasNext())
    {
        nodes[itr.value()] = (MDNode) itr.key();
    }

    for (int i = 0; i < nodes.length; i++)
    {
        os.printf("!%d = metadata ", i);
        MDNode node = nodes[i];
        os.printf("!{");
        for (int j = 0, e = node.getNumOfNode(); j < e; j++)
        {
            Value val = node.getNode(j);
            if (val == null) os.printf("null");
            else if (val instanceof MDNode)
            {
                MDNode n = (MDNode)val;
                os.printf("metadata !%d", slotTable.getMetadataSlot(n));
            }
            else
            {
                printer.print(val.getType(), os);
                os.print(' ');
                writeAsOperandInternal(os, val, printer, slotTable);
            }
            if (j < e-1)
                os.print(", ");
        }
        os.println("}");
    }
}
项目:xcc    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:xcc    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:HCFCore    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:HCFCore    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:HCFCore    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:HCFCore    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:trove-3.0.3    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
@Override
@SuppressWarnings("rawtypes")
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:trove-3.0.3    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
@Override
@SuppressWarnings("rawtypes")
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:easyrec_major    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:easyrec_major    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:trove-over-koloboke-compile    文件:IterationBenchmark.java   
@Override
public void testString_TPrimitiveHashMap() {
    int total = 0;

    for( int i = 0; i < ITERATIONS_STRING; i++ ) {
        TObjectIntIterator<String> iterator = string_t_primitive_map.iterator();
        while( iterator.hasNext() ) {
            iterator.advance();
            total += iterator.key().length();
        }
    }

    int_slot.set( total );
}
项目:trove-over-koloboke-compile    文件:IterationBenchmark.java   
@Override
public void testString_Trove2PrimitiveHashMap() {
    int total = 0;

    for( int i = 0; i < ITERATIONS_STRING; i++ ) {
        gnu.trove.TObjectIntIterator<String> iterator =
            string_t2_primitive_map.iterator();
        while( iterator.hasNext() ) {
            iterator.advance();
            total += iterator.key().length();
        }
    }

    int_slot.set( total );
}
项目:recalot.com    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:recalot.com    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() &&
                 that.containsKey( key ) ) ) {

                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:kelp-additional-kernels    文件:ShortestPathKernel.java   
@Override
public float kernelComputation(DirectedGraphRepresentation exA,
        DirectedGraphRepresentation exB) {

    TObjectIntMap<NodeDistance> labelDistancesA = GraphUtils.getLabelDistances(exA);
    TObjectIntMap<NodeDistance> labelDistancesB = GraphUtils.getLabelDistances(exB);

    float sum = 0;

    TObjectIntMap<NodeDistance> shortest;
    TObjectIntMap<NodeDistance> longest;
    if (labelDistancesA.size() < labelDistancesB.size()) {
        shortest = labelDistancesA;
        longest = labelDistancesB;
    } else {
        shortest = labelDistancesB;
        longest = labelDistancesA;
    }
    for (TObjectIntIterator<NodeDistance> it = shortest.iterator(); it.hasNext();) {
        it.advance();
        float shortestValue = it.value();
        float longestValue = longest.get(it.key());
        sum += shortestValue * longestValue;
    }
    return sum;

}
项目:SRLParser    文件:Dictionary.java   
public Dictionary(Dictionary a)
{
    numEntries = a.numEntries;
    map = new TObjectIntHashMap(numEntries);        
    for (TObjectIntIterator iter = a.map.iterator(); iter.hasNext();) {
        iter.advance();
        map.put(iter.key(), iter.value());
    }
}
项目:gnu.trove    文件:IterationBenchmark.java   
@Override
public void testString_TPrimitiveHashMap() {
    int total = 0;

    for( int i = 0; i < ITERATIONS_STRING; i++ ) {
        TObjectIntIterator<String> iterator = string_t_primitive_map.iterator();
        while( iterator.hasNext() ) {
            iterator.advance();
            total += iterator.key().length();
        }
    }

    int_slot.set( total );
}
项目:gnu.trove    文件:IterationBenchmark.java   
@Override
public void testString_Trove2PrimitiveHashMap() {
    int total = 0;

    for( int i = 0; i < ITERATIONS_STRING; i++ ) {
        gnu.trove.TObjectIntIterator<String> iterator =
            string_t2_primitive_map.iterator();
        while( iterator.hasNext() ) {
            iterator.advance();
            total += iterator.key().length();
        }
    }

    int_slot.set( total );
}
项目:openimaj    文件:KNNAnnotator.java   
@Override
public List<ScoredAnnotation<ANNOTATION>> annotate(final OBJECT object) {
    if (this.nn == null)
        this.nn = new ObjectNearestNeighboursExact<FEATURE>(this.features, this.comparator);

    final TObjectIntHashMap<ANNOTATION> selected = new TObjectIntHashMap<ANNOTATION>();

    final List<FEATURE> queryfv = new ArrayList<FEATURE>(1);
    queryfv.add(this.extractor.extractFeature(object));

    final int[][] indices = new int[1][this.k];
    final float[][] distances = new float[1][this.k];

    this.nn.searchKNN(queryfv, this.k, indices, distances);

    int count = 0;
    for (int i = 0; i < this.k; i++) {
        // Distance check
        if (distances[0][i] > this.threshold) {
            continue;
        }

        final Collection<ANNOTATION> anns = this.annotations.get(indices[0][i]);

        for (final ANNOTATION ann : anns) {
            selected.adjustOrPutValue(ann, 1, 1);
            count++;
        }
    }

    final TObjectIntIterator<ANNOTATION> iterator = selected.iterator();
    final List<ScoredAnnotation<ANNOTATION>> result = new ArrayList<ScoredAnnotation<ANNOTATION>>(selected.size());
    while (iterator.hasNext()) {
        iterator.advance();

        result.add(new ScoredAnnotation<ANNOTATION>(iterator.key(), (float) iterator.value() / (float) count));
    }

    return result;
}
项目:fnlp    文件:LabelAlphabet.java   
/**
 * 得到索引集合
 * @return
 */
public Set<Integer> getIndexSet() {
    Set<Integer> set = new HashSet<Integer>();
    for (TObjectIntIterator<String> it = data.iterator(); it.hasNext();) {
        it.advance();
        set.add(it.value());
    }
    return set;
}
项目:fnlp    文件:LabelAlphabet.java   
public Map<String,Integer> toMap() {
    HashMap<String,Integer> map = new HashMap<String,Integer>();
    for (TObjectIntIterator<String> it = data.iterator(); it.hasNext();) {
        it.advance();
        map.put(it.key(), it.value());
    }
    return map;
}
项目:fnlp    文件:LabelAlphabet.java   
/**
 * 得到标签集合
 */
public Set<String> toSet() {
    Set<String> set = new HashSet<String>();
    for (TObjectIntIterator<String> it = data.iterator(); it.hasNext();) {
        it.advance();
        set.add(it.key());
    }
    return set;
}
项目:fnlp    文件:LabelAlphabet.java   
/**
 * 将标签集合输出为字符串
 */
public String toString() {
    StringBuffer sb = new StringBuffer();
    for (TObjectIntIterator<String> it = data.iterator(); it.hasNext();) {
        it.advance();
        sb.append(it.key());
        sb.append(",");
    }
    return sb.toString();
}
项目:easyrec-PoC    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:easyrec-PoC    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:chinesesegmentor    文件:DATrieFeatureDict.java   
@Override
public TObjectIntIterator<String> iterator() {
  final DatrieIterator iter = datrie.iterator();
  return new TObjectIntIterator<String>() {

    @Override
    public void advance() {
      iter.next();
    }

    @Override
    public boolean hasNext() {
      return iter.hasNext();
    }

    @Override
    public void remove() {
      throw new UnsupportedOperationException();
    }

    @Override
    public String key() {
      return iter.key();
    }

    @Override
    public int setValue(int value) {
      return iter.setValue(value);
    }

    @Override
    public int value() {
      return iter.value();
    }
  };

}
项目:easyrec    文件:TObjectIntHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}
项目:easyrec    文件:TObjectIntCustomHashMap.java   
/**
 * Compares this map with another map for equality of their stored
 * entries.
 *
 * @param other an <code>Object</code> value
 * @return a <code>boolean</code> value
 */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TObjectIntMap ) ) {
        return false;
    }
    TObjectIntMap that = ( TObjectIntMap ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    try {
        TObjectIntIterator iter = this.iterator();
        while ( iter.hasNext() ) {
            iter.advance();
            Object key = iter.key();
            int value = iter.value();
            if ( value == no_entry_value ) {
                if ( !( that.get( key ) == that.getNoEntryValue() && that.containsKey( key ) ) ) {
                    return false;
                }
            } else {
                if ( value != that.get( key ) ) {
                    return false;
                }
            }
        }
    } catch ( ClassCastException ex ) {
        // unused.
    }
    return true;
}