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


Java TObjectIntIterator类代码示例

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


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

示例1: itemizeCandidates

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public void itemizeCandidates() {
	candidates = new THashSet<String>();
	IntCounter<String> counts = new IntCounter<String>();
	for (DataPointWithElements p : mData) {
		
		for (Range fillerSpanRange : p.getOvertFrameElementFillerSpans()) {
			String ss = getSufficientStatistics(p.getParses().getBestParse(), fillerSpanRange);
			counts.increment(ss);
		}
	}
	
	for (TObjectIntIterator<String> iter = counts.getIterator(); iter.hasNext();) {
		iter.advance();
		if (iter.value()>=mMinCount)
			candidates.add(iter.key());
	}
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:18,代码来源:CandidateFrameElementFilters.java

示例2: invert

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * If {@code this} is an {@link IntCounterMap} of the form <code> { a => { b => c } } </code>,
 * returns a new {@link IntCounterMap} of the form <code> { b => { a => c } } </code>.
 */
public IntCounterMap<L,K> invert() {
	IntCounterMap<L,K> invertedMap = new IntCounterMap<L,K>();
	for (Map.Entry<K,IntCounter<L>> item : this.entrySet()) {
		K key1 = item.getKey();
		IntCounter<L> counter = item.getValue();
		for (TObjectIntIterator<L> iter = counter.getIterator();
				iter.hasNext();) {
			iter.advance();
			L key2 = iter.key();
			int value = iter.value();
			invertedMap.set(key2, key1, value);
		}
	}
	return invertedMap;
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:20,代码来源:IntCounterMap.java

示例3: filteredKeys

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * @param valueThreshold
 * @return Set of keys whose corresponding value equals or exceeds the given threshold
 */
public Set<T> filteredKeys(int valueThreshold) {
	Set<T> result = new THashSet<T>();
	for (TObjectIntIterator<T> iter = getIterator();
			iter.hasNext();) {
		iter.advance();
		T key = iter.key();
		int value = getT(key);
		if (value >= valueThreshold) {
			result.add(key);
		}
	}
	if (containsKey(null) && getT(null) >= valueThreshold)
		result.add(null);
	return result;
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:20,代码来源:IntCounter.java

示例4: filter

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * @param valueThreshold
 * @return New IntCounter containing only entries whose value equals or exceeds the given threshold
 */
public IntCounter<T> filter(int valueThreshold) {
	IntCounter<T> result = new IntCounter<T>();
	for (TObjectIntIterator<T> iter = getIterator();
			iter.hasNext();) {
		iter.advance();
		T key = iter.key();
		int value = getT(key);
		if (value >= valueThreshold) {
			result.set(key, value);
		}
	}
	int nullValue = getT(null);
	if (containsKey(null) && nullValue >= valueThreshold)
		result.set(null, nullValue);
	return result;
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:21,代码来源:IntCounter.java

示例5: low

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * This function computes the operation low_A(j) as described in the paper. Note that if
 * the chain is empty (for example the column contains only zeros), then this function
 * returns null.
 * 
 * @param <X> the underlying type of the basis elements in the chain
 * @param chain the chain
 * @param comparator the comparator to use
 * @return the lowest element in the chain
 */
public static <X> X low(IntSparseFormalSum<X> chain, Comparator<X> comparator) {

	X maxObject = null;

	if (chain == null) {
		//System.out.println("stop");
		return null;
	}

	for (TObjectIntIterator<X> iterator = chain.iterator(); iterator.hasNext(); ) {
		iterator.advance();
		if (maxObject == null || comparator.compare(iterator.key(), maxObject) > 0) {
			maxObject = iterator.key();
		}
	}

	return maxObject;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:29,代码来源:BasisTrackingUtility.java

示例6: multiply

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * This function performs matrix multiplication. The matrix is represented by a sparse set of sparse columns. In other
 * words, this function computes the linear combination of the columns in the specified map with coefficients given by the
 * vector v. In the matrix m, the keys represent the column labels, and the values are the columns at that particular index.
 * 
 * @param <X>
 * @param <Y>
 * @param m the matrix as a list of columns
 * @param v the vector
 * @param field the field over which to perform the computations
 * @return the matrix vector product
 */
public static <X, Y> IntSparseFormalSum<Y> multiply(Map<X, IntSparseFormalSum<Y>> m, IntSparseFormalSum<X> v, IntAbstractField field) {
	IntSparseFormalSum<Y> result = new IntSparseFormalSum<Y>();
	IntAlgebraicFreeModule<Y> YChainModule = new IntAlgebraicFreeModule<Y>(field);

	for (TObjectIntIterator<X> iterator = v.iterator(); iterator.hasNext(); ) {
		iterator.advance();

		int coefficient = iterator.value();
		X object = iterator.key();
		IntSparseFormalSum<Y> column = m.get(object);
		if (column != null) {
			YChainModule.accumulate(result, column, coefficient);
		}
	}

	return result;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:30,代码来源:BasisTrackingUtility.java

示例7: computeBoundary

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * This function computes the boundary of a given chain, by linear extension.
 * 
 * @param <X>
 * @param chain the chain to compute the boundary of
 * @param chainModule the module that performs the computations
 * @return the boundary of the given chain
 */
public static <X extends PrimitiveBasisElement> IntSparseFormalSum<X> computeBoundary(IntSparseFormalSum<X> chain, IntAlgebraicFreeModule<X> chainModule) {
	IntSparseFormalSum<X> result = new IntSparseFormalSum<X>();

	if (chain == null) {
		System.out.println("null chain");
	}
	
	for (TObjectIntIterator<X> iterator = chain.iterator(); iterator.hasNext(); ) {
		iterator.advance();

		IntSparseFormalSum<X> boundary = createNewSum(iterator.key().getBoundaryCoefficients(), iterator.key().getBoundaryArray());
		chainModule.accumulate(result, boundary, iterator.value());
	}

	return result;
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:25,代码来源:BasisTrackingUtility.java

示例8: getFirstGradedProjectionMap

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public static <U extends PrimitiveBasisElement, V extends ObjectObjectPair<U, U>> ObjectObjectFunction<IntSparseFormalSum<V>, IntSparseFormalSum<U>> getFirstGradedProjectionMap(final IntAlgebraicFreeModule<U> chainModule, final IntAlgebraicFreeModule<V> dummy) {
	return new ObjectObjectFunction<IntSparseFormalSum<V>, IntSparseFormalSum<U>>() {

		public IntSparseFormalSum<U> evaluate(IntSparseFormalSum<V> chain) {

			if (chain.isEmpty()) {
				return chainModule.createNewSum();
			}

			int dimension = 0;

			{
				TObjectIntIterator<V> iterator = chain.iterator();

				if (iterator.hasNext()) {
					iterator.advance();
					dimension = iterator.key().getFirst().getDimension() + iterator.key().getSecond().getDimension();	
				}
			}

			return SimplexStreamUtility.filterByDimension(SimplexStreamUtility.projectFirst(chain, chainModule), dimension);
		}

	};
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:26,代码来源:InducedHomologyMappingUtility.java

示例9: getSecondGradedProjectionMap

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public static <U extends PrimitiveBasisElement, V extends ObjectObjectPair<U, U>> ObjectObjectFunction<IntSparseFormalSum<V>, IntSparseFormalSum<U>> getSecondGradedProjectionMap(final IntAlgebraicFreeModule<U> chainModule, final IntAlgebraicFreeModule<V> dummy) {
	return new ObjectObjectFunction<IntSparseFormalSum<V>, IntSparseFormalSum<U>>() {

		public IntSparseFormalSum<U> evaluate(IntSparseFormalSum<V> chain) {

			if (chain.isEmpty()) {
				return chainModule.createNewSum();
			}

			int dimension = 0;

			{
				TObjectIntIterator<V> iterator = chain.iterator();

				if (iterator.hasNext()) {
					iterator.advance();
					dimension = iterator.key().getFirst().getDimension() + iterator.key().getSecond().getDimension();	
				}
			}

			return SimplexStreamUtility.filterByDimension(SimplexStreamUtility.projectSecond(chain, chainModule), dimension);
		}

	};
}
 
开发者ID:appliedtopology,项目名称:javaplex,代码行数:26,代码来源:InducedHomologyMappingUtility.java

示例10: removeFeatures

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
    int shift = 0;
    int lastGoodFeature = 0;
    int totalFeatures = _featuresMap.size();
    TIntIntHashMap featuresRemap = new TIntIntHashMap();
    while (removedFeatures.hasNext()) {
        int removedFeature = removedFeatures.next();
        while (lastGoodFeature < removedFeature) {
            featuresRemap.put(lastGoodFeature, lastGoodFeature - shift);
            ++lastGoodFeature;
        }
        lastGoodFeature = removedFeature + 1;
        int removedFeaturePosition = removedFeature - shift;
        _featuresMap.remove(_featuresRMap.get(removedFeaturePosition));
        _featuresRMap.remove(removedFeaturePosition);
        ++shift;
    }

    while (lastGoodFeature < totalFeatures) {
        featuresRemap.put(lastGoodFeature, lastGoodFeature - shift);
        ++lastGoodFeature;
    }

    TObjectIntIterator<String> mapIter = _featuresMap.iterator();
    while (mapIter.hasNext()) {
        mapIter.advance();
        int value = mapIter.value();
        int newvalue = featuresRemap.get(value);
        mapIter.setValue(newvalue);
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:32,代码来源:TroveFeaturesDB.java

示例11: cloneDB

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public IFeatureDB cloneDB() {
    TroveFeaturesDB featuresDB = new TroveFeaturesDB();
    featuresDB._name = new String(_name);

    TObjectIntIterator<String> iterator = _featuresMap.iterator();
    while (iterator.hasNext()) {
        iterator.advance();
        featuresDB._featuresMap.put(iterator.key(), iterator.value());
    }

    featuresDB._featuresRMap = (Vector<String>) _featuresRMap.clone();

    return featuresDB;
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:16,代码来源:TroveFeaturesDB.java

示例12: toString

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public String toString() {
  StringBuffer buffer = new StringBuffer();
  for( TObjectIntIterator<T> iter = myNumbers.iterator(); iter.hasNext(); ) {
    iter.advance();
    buffer.append(Integer.toString(iter.value()) + ": " + iter.key().toString() + "\n");
  }
  return buffer.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:Enumerator.java

示例13: buildFlags

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public static int buildFlags(GrModifierList modifierList) {
  int flags = 0;
  final TObjectIntIterator<String> iterator = GrModifierListImpl.NAME_TO_MODIFIER_FLAG_MAP.iterator();
  while (iterator.hasNext()) {
    iterator.advance();
    if (modifierList.hasExplicitModifier(iterator.key())) {
      flags |= iterator.value();
    }
  }
  return flags;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GrModifierListStub.java

示例14: getAggregateHistogram

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
/**
 * If {@code this} is a {@link IntCounterMap} of the form <code> { a => { b => c } } </code>,
 * returns a new {@link IntCounterMap} of the form <code> { b => {c => # } } </code>
 * where for every {@code b}, {@code #} is the number of {@code a}'s for which {@code this[a][b]==c }
 */
public IntCounterMap<L,Integer> getAggregateHistogram() {
	IntCounterMap<L,Integer> aggregateHistogram = new IntCounterMap<L,Integer>();
	for (IntCounter<L> counter : this.values()) {
		for (TObjectIntIterator<L> iter = counter.getIterator();
				iter.hasNext();) {
			iter.advance();
			L key = iter.key();
			int value = iter.value();
			aggregateHistogram.increment(key, value);
		}
	}
	return aggregateHistogram;
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:19,代码来源:IntCounterMap.java

示例15: incrementAllBy

import gnu.trove.TObjectIntIterator; //导入依赖的package包/类
public void incrementAllBy(int delta) {
	for (TObjectIntIterator<T> iter = getIterator();
			iter.hasNext();) {
		iter.advance();
		this.incrementBy(iter.key(), delta);
	}
}
 
开发者ID:Noahs-ARK,项目名称:semafor-semantic-parser,代码行数:8,代码来源:IntCounter.java


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