本文整理汇总了Java中gnu.trove.map.hash.TIntIntHashMap类的典型用法代码示例。如果您正苦于以下问题:Java TIntIntHashMap类的具体用法?Java TIntIntHashMap怎么用?Java TIntIntHashMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TIntIntHashMap类属于gnu.trove.map.hash包,在下文中一共展示了TIntIntHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PartialOrder
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
public PartialOrder(DifferenceSets differenceSets) {
TIntIntHashMap orderMap = new TIntIntHashMap();
for (DifferenceSet differenceSet : differenceSets) {
// increase the cover count for set columns
long bitIndex = 0;
while (bitIndex < differenceSet.getNumberOfColumns()) {
long currentNextSetBit = differenceSet.nextSetBit(bitIndex);
if (currentNextSetBit != -1) {
bitIndex = currentNextSetBit + 1;
orderMap.putIfAbsent((int) currentNextSetBit, 0);
orderMap.increment((int) currentNextSetBit);
} else {
bitIndex = differenceSet.getNumberOfColumns();
}
}
}
for (Integer index : orderMap.keys()) {
this.add(new CoverOrder(index, orderMap.get(index)));
}
Collections.sort(this, Collections.reverseOrder());
}
示例2: notUseAfterLastDef
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
private boolean notUseAfterLastDef(int reg,
MachineBasicBlock mbb,
int dist,
TIntIntHashMap distanceMap,
OutParamWrapper<Integer> lastDef)
{
lastDef.set(0);
int lastUse = dist;
for (DefUseChainIterator itr = mri.getRegIterator(reg); itr.hasNext();)
{
MachineOperand mo = itr.getOpearnd();
MachineInstr mi = itr.getMachineInstr();
if (!mi.getParent().equals(mbb))
continue;
if (!distanceMap.containsKey(mi.index()))
continue;
if (mo.isUse() && distanceMap.get(mi.index()) < lastUse)
lastUse = distanceMap.get(mi.index());
if (mo.isDef() && distanceMap.get(mi.index()) > lastDef.get())
lastDef.set(distanceMap.get(mi.index()));
itr.next();
}
return (!(lastUse > lastDef.get() && lastUse < dist));
}
示例3: runOnMachineFunction
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
/**
* This method must be overridded by concrete subclass for performing
* desired machine code transformation or analysis.
*
* @param mf
* @return
*/
@Override
public boolean runOnMachineFunction(MachineFunction mf)
{
this.mf = mf;
tm = mf.getTarget();
regInfo = tm.getRegisterInfo();
instrInfo = tm.getInstrInfo();
stackSlotForVirReg = new TIntIntHashMap();
regUsed = new BitMap();
regClassIdx = new TObjectIntHashMap<>();
for (MachineBasicBlock mbb : mf.getBasicBlocks())
allocateBasicBlock(mbb);
stackSlotForVirReg.clear();
return true;
}
示例4: cleanInput
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
private void cleanInput()
{
final TIntIntMap patternMap = new TIntIntHashMap(this.patternMap);
for (int i = 0; i < 81 && !patternMap.isEmpty(); i++) {
final ItemStack itemStack = itemStacks[i];
final int key = MetaItem.get(itemStack);
if (patternMap.containsKey(key)) {
final int total = patternMap.get(key);
final int dif = MathHelper.clamp_int(total, 1, itemStack.stackSize);
if (!itemStack.getItem().hasContainerItem(itemStack))
itemStack.stackSize -= dif;
if (dif - total == 0)
patternMap.remove(key);
else
patternMap.put(key, total - dif);
if (itemStack.stackSize == 0)
itemStacks[i] = null;
}
}
}
示例5: ExplorationStep
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
/**
* Start exploration on an abstract dataset
*/
public ExplorationStep(int minimumSupport, int k, Iterable<TransactionReader> source) {
this.core_item = Integer.MAX_VALUE;
this.selectChain = null;
Holder<int[]> renamingHolder = new Holder<int[]>();
DenseCounters firstCounter = new DenseCounters(minimumSupport, source.iterator(), renamingHolder);
this.counters = firstCounter;
TransactionsRenamingDecorator filtered = new TransactionsRenamingDecorator(source.iterator(), renamingHolder.value);
this.dataset = new Dataset(this.counters, filtered, this.counters.getMinSupport(),
this.counters.getMaxFrequent());
this.candidates = this.counters.getExtensionsIterator();
this.failedFPTests = new TIntIntHashMap();
this.datasetProvider = new DatasetProvider(this);
ExplorationStep.findUnclosedInsertionBound(firstCounter.getSupportCounts(), minimumSupport + k);
}
示例6: readIntIntMap
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
private static TIntIntMap readIntIntMap(URI[] files, Configuration conf, String token, int size) throws IOException {
TIntIntMap map = new TIntIntHashMap(size, Constants.DEFAULT_LOAD_FACTOR, -1, -1);
for (URI file : files) {
if (file.getPath().contains(token)) {
SequenceFile.Reader reader = new SequenceFile.Reader(conf, Reader.file(new Path(file)));
IntWritable key = new IntWritable();
IntWritable value = new IntWritable();
while (reader.next(key, value)) {
map.put(key.get(), value.get());
}
reader.close();
}
}
return map;
}
示例7: getTopKBounds
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
public final TIntIntMap getTopKBounds() {
final TIntIntMap output = new TIntIntHashMap(this.topK.size());
this.topK.forEachEntry(new TIntObjectProcedure<PatternWithFreq[]>() {
@Override
public boolean execute(int k, PatternWithFreq[] v) {
int s;
PatternWithFreq p = v[v.length - 1];
if (p == null) {
s = -1;
} else if (p.isClosed()) {
s = p.getSupportCount() + 1;
} else {
s = p.getSupportCount();
}
output.put(k, s);
return true;
}
});
return output;
}
示例8: initialize
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
@Override
public void initialize(Timestamp timestamp) {
this.timestamp = Revision.compressTime(timestamp.getTime());
/**
* filled in revisions
*/
pageIdRevMap = new HashMap<Integer, Long>();
textIdPageIdMap = new TIntIntHashMap();
/**
* filled in pages
*/
pPageIdNameMap = new HashMap<Integer, String>();
pNamePageIdMap = new TIntIntHashMap();
cNamePageIdMap = new TIntIntHashMap();
rPageIdNameMap = new HashMap<Integer, String>();
/**
* filled in categories
*/
disambiguations = new TIntHashSet();
}
示例9: initialize
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
@Override
public void initialize(Timestamp timestamp) {
this.timestamp = Revision.compressTime(timestamp.getTime());
/**
* filled in revisions
*/
pageIdRevMap = new HashMap<Integer, Long>();
textIdPageIdMap = new TIntIntHashMap();
/**
* filled in pages
*/
pPageIdNameMap = new HashMap<Integer, String>();
pNamePageIdMap = new HashMap<KeyType, Integer>();
cNamePageIdMap = new HashMap<KeyType, Integer>();
rPageIdNameMap = new HashMap<Integer, String>();
/**
* filled in categories
*/
disambiguations = new TIntHashSet();
}
示例10: loadInputMetadataID
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
public static void loadInputMetadataID(String metadata_file_index, String input_uri,
TIntIntHashMap input_metadata_id){
TObjectIntHashMap<String> metadata_index = new TObjectIntHashMap<String>();
loadIndex(metadata_file_index, metadata_index);
try{
BufferedReader br = new BufferedReader(new FileReader(input_uri));
String line = null;
while((line=br.readLine()) != null){
String[] vals = line.split("\t");
if(metadata_index.containsKey(vals[1]));
input_metadata_id.put(Integer.parseInt(vals[0]), metadata_index.get(vals[1]));
}
br.close();
}
catch(Exception e){
e.printStackTrace();
}
}
示例11: addBranches
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
@Override
public void addBranches(String key, int value){
if (!this.branches.containsKey(key))
this.branches.put(key, new TIntIntHashMap());
if(this.branches.get(key)!=null){
if(this.branches.get(key).containsKey(value)){
if(this.branches.get(key).get(value) < Integer.MAX_VALUE)
this.branches.get(key).adjustValue(value, 1);
}
else
this.branches.get(key).put(value, 1);
}
else{
TIntIntHashMap tmp = new TIntIntHashMap();
tmp.put(value, 1);
this.branches.put(key, tmp);
}
}
示例12: ItemPathExtractorWorker
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
/**
* Constuctor
*/
public ItemPathExtractorWorker(SynchronizedCounter counter,
TObjectIntHashMap<String> path_index, TIntObjectHashMap<String> inverse_path_index,
ItemTree main_item, ArrayList<ItemTree> items, TIntObjectHashMap<String> props_index, boolean inverseProps,
TextFileManager textWriter, StringFileManager pathWriter, boolean select_top_path,
TIntIntHashMap input_metadata_id, boolean computeInversePaths,
TIntObjectHashMap<TIntHashSet> items_link){
this.counter = counter;
this.path_index = path_index;
this.main_item = main_item;
this.items = items;
this.props_index = props_index;
this.inverseProps = inverseProps;
this.textWriter = textWriter;
this.pathWriter = pathWriter;
this.select_top_path = select_top_path;
this.input_metadata_id = input_metadata_id;
this.computeInversePaths = computeInversePaths;
this.items_link = items_link;
this.inverse_path_index = inverse_path_index;
}
示例13: Evaluator
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
public Evaluator(Options options, DependencyPipe pipe)
{
uas = las = tot = 0;
corr = totp = totg = 0;
whole = nsents = 0;
vis = 0;
learnLabel = options.learnLabel;
numArgs = pipe.smnFactory.numSemanticLabels;
argLabels = pipe.args;
timeStamps = new int[numArgs];
argFreqCnts = new int[numArgs];
argAppearCnts = new int[numArgs];
goldlengthCounts = new TIntIntHashMap();
predlengthCounts = new TIntIntHashMap();
corrPL = new int[15];
totPL = new int[15];
corrGL = new int[15];
totGL = new int[15];
}
示例14: dumpPathStats
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
private void dumpPathStats(TObjectIntHashMap<String> pathCounts,
TIntIntHashMap pathlengthCounts) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter("path.info"));
for (int length : pathlengthCounts.keys()) {
writer.write(""+length);
writer.write("\t");
writer.write(""+pathlengthCounts.get(length));
writer.write("\n");
}
for (Object obj : pathCounts.keys()) {
String key = (String) obj;
writer.write(key);
writer.write("\t");
writer.write(""+pathCounts.get(key));
writer.write("\n");
}
writer.close();
}
示例15: removeFromVariableCaches
import gnu.trove.map.hash.TIntIntHashMap; //导入依赖的package包/类
private void removeFromVariableCaches (Variable victim)
{
Set survivors = new THashSet(variablesSet ());
survivors.remove (victim);
int vi = 0;
TIntIntHashMap dict = new TIntIntHashMap (survivors.size ());
// dict.setDefaultValue (-1); No longer supported, but this.getIndex() written to avoid need for this.
my2global = new int[survivors.size ()];
for (Iterator it = survivors.iterator (); it.hasNext();) {
Variable var = (Variable) it.next ();
int gvi = var.getIndex ();
dict.put (gvi, vi);
my2global [vi] = gvi;
}
projectionMap = dict;
numNodes--; // do this at end b/c it affects getVertexSet()
}