use of gnu.trove.map.hash.TIntIntHashMap in project GDSC-SMLM by aherbert.
the class FilterMolecules method run.
@Override
public void run(String arg) {
SmlmUsageTracker.recordPlugin(this.getClass(), arg);
if (MemoryPeakResults.isMemoryEmpty()) {
IJ.error(TITLE, "No localisations in memory");
return;
}
if (!showDialog()) {
return;
}
// Load the results
MemoryPeakResults results = ResultsManager.loadInputResults(settings.inputOption, false, null, null);
if (MemoryPeakResults.isEmpty(results)) {
IJ.error(TITLE, "No results could be loaded");
return;
}
// Allow reordering when filtering
results = results.copy();
if (settings.removeSingles) {
results.removeIf(p -> p.getId() <= 0);
final TIntIntHashMap count = new TIntIntHashMap(results.size());
results.forEach((PeakResultProcedure) r -> count.adjustOrPutValue(r.getId(), 1, 1));
results.removeIf(p -> count.get(p.getId()) == 1);
if (results.isEmpty()) {
IJ.error(TITLE, "No results after filtering singles");
return;
}
}
switch(settings.filterMode) {
case D:
new FilterDiffusionCoefficient().run(results);
break;
default:
IJ.error(TITLE, "Unknown filter mode: " + settings.filterMode);
}
}
use of gnu.trove.map.hash.TIntIntHashMap in project JGibbLabeledLDA by myleott.
the class LDADataset method setDictionary.
public void setDictionary(Dictionary globalDict) {
lid2gid = new TIntIntHashMap();
this.globalDict = globalDict;
}
use of gnu.trove.map.hash.TIntIntHashMap in project Terasology by MovingBlocks.
the class AwtKeyboardDevice method awtKeyCallback.
/**
* Callback receive key input events.
*/
public void awtKeyCallback(int key, ButtonState state, int location) {
int teraKey;
TIntIntHashMap extraMap = AWT_TO_TERA_EXTRA.get(key);
if (extraMap != null) {
teraKey = extraMap.get(key);
} else {
teraKey = AWT_TO_TERA_MAPPING.get(key);
}
Input input = InputType.KEY.getInput(teraKey);
if (state == ButtonState.DOWN) {
buttonStates.add(teraKey);
} else if (state == ButtonState.UP) {
buttonStates.remove(teraKey);
}
rawKeyQueue.offer(new RawKeyboardAction(input, state));
}
use of gnu.trove.map.hash.TIntIntHashMap in project scheduler by btrplace.
the class Instances method makeVMIndex.
/**
* Make an index revealing the position of each VM in a collection
* of disjoint instances
*
* @param instances the collection to browse. Instances are supposed to be disjoint
* @return the index of every VM. Format {@code VM#id() -> position}
*/
public static TIntIntHashMap makeVMIndex(Collection<Instance> instances) {
TIntIntHashMap index = new TIntIntHashMap();
int p = 0;
for (Instance i : instances) {
Mapping m = i.getModel().getMapping();
for (Node n : m.getOnlineNodes()) {
for (VM v : m.getRunningVMs(n)) {
index.put(v.id(), p);
}
for (VM v : m.getSleepingVMs(n)) {
index.put(v.id(), p);
}
}
for (VM v : m.getReadyVMs()) {
index.put(v.id(), p);
}
p++;
}
return index;
}
use of gnu.trove.map.hash.TIntIntHashMap in project scheduler by btrplace.
the class Instances method makeNodeIndex.
/**
* Make an index revealing the position of each node in a collection
* of disjoint instances
*
* @param instances the collection to browse. Instances are supposed to be disjoint
* @return the index of every node. Format {@code Node#id() -> position}
*/
public static TIntIntHashMap makeNodeIndex(Collection<Instance> instances) {
TIntIntHashMap index = new TIntIntHashMap();
int p = 0;
for (Instance i : instances) {
Mapping m = i.getModel().getMapping();
for (Node n : m.getOfflineNodes()) {
index.put(n.id(), p);
}
for (Node n : m.getOnlineNodes()) {
index.put(n.id(), p);
}
p++;
}
return index;
}
Aggregations