Java Code Examples for gnu.trove.iterator.TObjectIntIterator#value()
The following examples show how to use
gnu.trove.iterator.TObjectIntIterator#value() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractAttributeClustering.java From JedAIToolkit with Apache License 2.0 | 6 votes |
private void buildAttributeModels(int datasetId, List<EntityProfile> profiles) { attrNameIndex = new TObjectIntHashMap<>(); profiles.forEach((profile) -> { profile.getAttributes().forEach((attribute) -> { attrNameIndex.putIfAbsent(attribute.getName(), attrNameIndex.size() + 1); }); }); int currentAttributes = attrNameIndex.size(); attributeModels[datasetId] = new ITextModel[currentAttributes]; final TObjectIntIterator<String> it = attrNameIndex.iterator(); while (it.hasNext()) { it.advance(); attributeModels[datasetId][it.value() - 1] = RepresentationModel.getModel(datasetId, repModel, simMetric, it.key()); } profiles.forEach((profile) -> { profile.getAttributes().forEach((attribute) -> { updateModel(datasetId, attribute); }); }); for (int i = 0; i < currentAttributes; i++) { attributeModels[datasetId][i].finalizeModel(); } }
Example 2
Source File: Term.java From ontopia with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 3
Source File: Term.java From ontopia with Apache License 2.0 | 6 votes |
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); } }
Example 4
Source File: Train.java From Signals with GNU General Public License v3.0 | 5 votes |
public boolean updatePositions(NetworkState<TPos> state){ if(!railLinkHolds.isEmpty()) { TObjectIntIterator<TPos> iterator = railLinkHolds.iterator(); while(iterator.hasNext()) { iterator.advance(); if(iterator.value() == 1) { iterator.remove(); } else { iterator.setValue(iterator.value() - 1); } } } return false; }