use of gnu.trove.procedure.TIntDoubleProcedure in project ProPPR by TeamCohen.
the class RedBlueGraph method colorPart.
public TIntDoubleMap colorPart(final Set<String> color, TIntDoubleMap vec) {
final TIntDoubleMap result = new TIntDoubleHashMap();
vec.forEachEntry(new TIntDoubleProcedure() {
@Override
public boolean execute(int k, double v) {
if (color.contains(nodes.getSymbol(k)))
result.put(k, v);
return true;
}
});
return result;
}
use of gnu.trove.procedure.TIntDoubleProcedure in project ProPPR by TeamCohen.
the class LightweightStateGraph method getFeatures.
public Map<Feature, Double> getFeatures(State u, State v) {
int ui = this.nodeTab.getId(u), vi = this.nodeTab.getId(v);
if (!edgeFeatureDict.containsKey(ui))
return DEFAULT_FD;
TIntObjectHashMap<TIntDoubleHashMap> fu = edgeFeatureDict.get(ui);
if (!fu.containsKey(vi))
return DEFAULT_FD;
TIntDoubleHashMap fuvi = fu.get(vi);
final HashMap<Feature, Double> ret = new HashMap<Feature, Double>();
fuvi.forEachEntry(new TIntDoubleProcedure() {
@Override
public boolean execute(int fi, double wt) {
ret.put(featureTab.getSymbol(fi), wt);
return true;
}
});
return ret;
}
Aggregations