Java 类gnu.trove.map.hash.TIntIntHashMap 实例源码

项目:metanome-algorithms    文件:PartialOrder.java   
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());

}
项目:metanome-algorithms    文件:PartialOrder.java   
public PartialOrder(DifferenceSets differenceSets, long columnIndexToSkip) {
    TIntIntHashMap orderMap = new TIntIntHashMap();

    for (DifferenceSet differenceSet : differenceSets) {
        // increase the cover count for set columns
        long bitIndex = columnIndexToSkip;
        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());

}
项目:xcc    文件:TwoAddrInstructionPass.java   
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));
}
项目:xcc    文件:RegAllocSimple.java   
/**
 * 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;
}
项目:Avaritiaddons    文件:TileEntityExtremeAutoCrafter.java   
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;
        }
    }
}
项目:TopPI    文件:ExplorationStep.java   
/**
 * 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);
}
项目:TopPI    文件:DistCache.java   
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;
}
项目:TopPI    文件:PerItemTopKCollector.java   
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;
}
项目:dkpro-jwpl    文件:DumpVersionTroveIntKey.java   
@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();
}
项目:dkpro-jwpl    文件:DumpVersionJDKGeneric.java   
@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();
}
项目:lodreclib    文件:TextFileUtils.java   
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();
    }

}
项目:lodreclib    文件:PropertyIndexedItemTree.java   
@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);
    }
}
项目:lodreclib    文件:ItemPathExtractorWorker.java   
/**
 * 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;
}
项目:SRLParser    文件:Evaluator.java   
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];
}
项目:SRLParser    文件:DependencyPipe.java   
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();
}
项目:wikit    文件:FactorGraph.java   
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()
 }
项目:wikit    文件:MultinomialHMM.java   
private void recacheStateTopicDistribution(int state, TIntIntHashMap topicCounts) {
int[] currentStateTopicCounts = stateTopicCounts[state];
double[][] currentStateCache = topicLogGammaCache[state];
double[] cache;

for (int topic: topicCounts.keys()) {
    cache = currentStateCache[topic];

    cache[0] = 0.0;
    for (int i=1; i < cache.length; i++) {
                   cache[i] =
                       cache[ i-1 ] +
                       Math.log( alpha[topic] + i - 1 + 
              currentStateTopicCounts[topic] );
    }

}

docLogGammaCache[state][0] = 0.0;
for (int i=1; i < docLogGammaCache[state].length; i++) {
               docLogGammaCache[state][i] =
                   docLogGammaCache[state][ i-1 ] +
                   Math.log( alphaSum + i - 1 + 
              stateTopicTotals[state] );
}
   }
项目:wikit    文件:LDAHyper.java   
private void initializeForTypes (Alphabet alphabet) {
    if (this.alphabet == null) {
        this.alphabet = alphabet;
        this.numTypes = alphabet.size();
        this.typeTopicCounts = new TIntIntHashMap[numTypes];
        for (int fi = 0; fi < numTypes; fi++) 
            typeTopicCounts[fi] = new TIntIntHashMap();
        this.betaSum = beta * numTypes;
    } else if (alphabet != this.alphabet) {
        throw new IllegalArgumentException ("Cannot change Alphabet.");
    } else if (alphabet.size() != this.numTypes) {
        this.numTypes = alphabet.size();
        TIntIntHashMap[] newTypeTopicCounts = new TIntIntHashMap[numTypes];
        for (int i = 0; i < typeTopicCounts.length; i++)
            newTypeTopicCounts[i] = typeTopicCounts[i];
        for (int i = typeTopicCounts.length; i < numTypes; i++)
            newTypeTopicCounts[i] = new TIntIntHashMap();
        // TODO AKM July 18:  Why wasn't the next line there previously?
        // this.typeTopicCounts = newTypeTopicCounts;
        this.betaSum = beta * numTypes;
    }   // else, nothing changed, nothing to be done
}
项目:wikit    文件:NPTopicModel.java   
/** @param alpha this parameter balances the local document topic counts with 
 *                the global distribution over topics.
 *  @param gamma this parameter is the weight on a completely new, never-before-seen topic
 *                in the global distribution.
 *  @param beta  this parameter controls the variability of the topic-word distributions
 */
public NPTopicModel (double alpha, double gamma, double beta) {

    this.data = new ArrayList<TopicAssignment>();
    this.topicAlphabet = AlphabetFactory.labelAlphabetOfSize(1);

    this.alpha = alpha;
    this.gamma = gamma;
    this.beta = beta;
    this.random = new Randoms();

    tokensPerTopic = new TIntIntHashMap();
    docsPerTopic = new TIntIntHashMap();

    formatter = NumberFormat.getInstance();
    formatter.setMaximumFractionDigits(5);

    logger.info("Non-Parametric LDA");
}
项目:wikit    文件:FeatureDocFreqPipe.java   
public Instance pipe(Instance instance) {

    TIntIntHashMap localCounter = new TIntIntHashMap();

    if (instance.getData() instanceof FeatureSequence) {

        FeatureSequence features = (FeatureSequence) instance.getData();

        for (int position = 0; position < features.size(); position++) {
            localCounter.adjustOrPutValue(features.getIndexAtPosition(position), 1, 1);
        }

    }
    else {
        throw new IllegalArgumentException("Looking for a FeatureSequence, found a " + 
                                           instance.getData().getClass());
    }

    for (int feature: localCounter.keys()) {
        counter.increment(feature);
    }

    numInstances++;

    return instance;
}
项目:openimaj    文件:HandWritingNeuralNetSANDIA.java   
/**
 * @throws IOException
 *             Load X input and y output from {@link #INPUT_LOCATION} and
 *             {@link #OUTPUT_LOCATION}
 */
public HandWritingNeuralNetSANDIA() throws IOException {
    final BufferedReader xReader = new BufferedReader(new InputStreamReader(
            HandWritingNeuralNetSANDIA.class.getResourceAsStream(INPUT_LOCATION)));
    final BufferedReader yReader = new BufferedReader(new InputStreamReader(
            HandWritingNeuralNetSANDIA.class.getResourceAsStream(OUTPUT_LOCATION)));
    this.xVals = fromCSV(xReader, 5000);
    this.yVals = fromCSV(yReader, 5000);

    examples = new TIntIntHashMap();
    this.tests = new TIntObjectHashMap<List<IndependentPair<Vector, Vector>>>();
    prepareDataCollection();
    learnNeuralNet();
    testNeuralNet();
    // new HandWritingInputDisplay(xVals);
}
项目:openimaj    文件:UniformRandomAnnotator.java   
@Override
public void train(List<? extends Annotated<OBJECT, ANNOTATION>> data) {
    final HashSet<ANNOTATION> annotationsSet = new HashSet<ANNOTATION>();
    final TIntIntHashMap nAnnotationCounts = new TIntIntHashMap();
    int maxVal = 0;

    for (final Annotated<OBJECT, ANNOTATION> sample : data) {
        final Collection<ANNOTATION> annos = sample.getAnnotations();
        annotationsSet.addAll(annos);
        nAnnotationCounts.adjustOrPutValue(annos.size(), 1, 1);

        if (annos.size() > maxVal)
            maxVal = annos.size();
    }

    annotations = new ArrayList<ANNOTATION>(annotationsSet);

    rnd = new Uniform(0, annotations.size() - 1, new MersenneTwister());

    numAnnotations.train(data);
}
项目:openimaj    文件:PriorChooser.java   
@Override
public <O, A> void train(List<? extends Annotated<O, A>> data) {
    TIntIntHashMap nAnnotationCounts = new TIntIntHashMap();
    int maxVal = 0;

    for (Annotated<O, A> sample : data) {
        Collection<A> annos = sample.getAnnotations();

        nAnnotationCounts.adjustOrPutValue(annos.size(), 1, 1);

        if (annos.size()>maxVal) maxVal = annos.size();
    }

    //build distribution and rng for the number of annotations
    double [] distr = new double[maxVal+1];
    for (int i=0; i<=maxVal; i++) 
        distr[i] = nAnnotationCounts.get(i);
    numAnnotations = new EmpiricalWalker(distr, Empirical.NO_INTERPOLATION, new MersenneTwister());
}
项目:openimaj    文件:ClusterAnalyserUtils.java   
/**
 * @param is
 * @param invCor
 * @return the cluster with the maximum
 */
public static IntIntPair findMaxClassCount(int[] is, Map<Integer, Integer> invCor) {
    TIntIntHashMap classCounts = new TIntIntHashMap();
    int max = 0;
    int c = 0;
    for (int i : is) {
        Integer c_i = invCor.get(i);
        if(c_i == null) continue;
        int count = classCounts.adjustOrPutValue(c_i, 1, 1);
        if(count > max){
            max = count;
            c = c_i;
        }
    }
    return IntIntPair.pair(c, max);
}
项目:fnlp    文件:Similarity.java   
public  void similarity() throws InterruptedException { 
    System.out.println("相似度");
    ThreadPoolExecutor pool = new ThreadPoolExecutor(numThreads, numThreads, 1000,
            TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(capacity ));
    similarityMap = new TIntIntHashMap[docs.size()];

    Iterator<Entry<String, TIntArrayList>> iterator = 
            locationMap.entrySet().iterator();


    while(iterator.hasNext()) {
        if(pool.getQueue().remainingCapacity()==0){
            Thread.sleep(10);
            continue;
        }
        Entry<String, TIntArrayList> entry = iterator.next();

        TIntArrayList al = entry.getValue();
        CalcSimilarity cs = new CalcSimilarity(al);
        pool.execute(cs);
    }
    while(pool.getActiveCount()>0){
        Thread.sleep(10);
    }
    pool.shutdown();
}
项目:lodreclib    文件:TextFileUtils.java   
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();
    }

}
项目:lodreclib    文件:PropertyIndexedItemTree.java   
@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);
    }
}
项目:lodreclib    文件:ItemPathExtractorWorker.java   
/**
 * 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;
}
项目:LaToe    文件:DumpVersionTroveIntKey.java   
@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();
}
项目:LaToe    文件:DumpVersionJDKGeneric.java   
@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();
}
项目:jlcm    文件:ExplorationStep.java   
/**
 * Start exploration on a dataset contained in a file.
 * 
 * @param minimumSupport
 * @param path
 *            to an input file in ASCII format. Each line should be a
 *            transaction containing space-separated item IDs.
 */
public ExplorationStep(int minimumSupport, String path) {
    this.parent = null;
    this.core_item = Integer.MAX_VALUE;
    this.selectChain = null;
    this.childrenThreshold = minimumSupport;

    FileReader reader = new FileReader(path);
    this.counters = new Counters(minimumSupport, reader);
    reader.close(this.counters.renaming);

    this.pattern = this.counters.closure;

    this.dataset = new Dataset(this.counters, reader);

    this.candidates = this.counters.getExtensionsIterator();

    this.failedFPTests = new TIntIntHashMap();
}
项目:onprom    文件:EfficientHashMap.java   
public EfficientHashMap(int initCapacity){

    map = new TIntIntHashMap(initCapacity);
    collisionMap = new TObjectIntHashMap<String>(initCapacity);
    values = new ArrayList<V>(initCapacity);
    counter = 0;
}
项目:onprom    文件:EfficientHashMap.java   
public EfficientHashMap(){

    map = new TIntIntHashMap();
    collisionMap = new TObjectIntHashMap<String>();
    values = new ArrayList<V>();
    counter = 0;
}
项目:xcc    文件:TwoAddrInstructionPass.java   
private boolean commuteInstruction(
        OutParamWrapper<Integer> mi,
        MachineBasicBlock mbb,
        int regC,
        int dist,
        TIntIntHashMap distanceMap)
{
    MachineInstr newMI = tii.commuteInstruction(mbb.getInstAt(mi.get()));

    if (newMI== null)
    {
        return false;
    }

    if (!newMI.equals(mbb.getInstAt(mi.get())))
    {
        if (lv != null)
            lv.replaceKillInstruction(regC, mbb.getInstAt(mi.get()), newMI);

        mbb.insert(mi.get(), newMI);
        mbb.remove(mi.get());
        mi.set(newMI.index());
        distanceMap.put(newMI.index(), dist);
    }

    return true;
}
项目:xcc    文件:TwoAddrInstructionPass.java   
private boolean isProfitableToCommute(int regB,
        int regC,
        MachineInstr mi,
        MachineBasicBlock mbb,
        int dist,
        TIntIntHashMap distanceMap)
{
    // Determine if it's profitable to commute this two address instruction. In
    // general, we want no uses between this instruction and the definition of
    // the two-address register.
    // e.g.
    // %reg1028<def> = EXTRACT_SUBREG %reg1027<kill>, 1
    // %reg1029<def> = MOV8rr %reg1028
    // %reg1029<def> = SHR8ri %reg1029, 7, %EFLAGS<imp-def,dead>
    // insert => %reg1030<def> = MOV8rr %reg1028
    // %reg1030<def> = ADD8rr %reg1028<kill>, %reg1029<kill>, %EFLAGS<imp-def,dead>
    // In this case, it might not be possible to coalesce the second MOV8rr
    // instruction if the first one is coalesced. So it would be profitable to
    // commute it:
    // %reg1028<def> = EXTRACT_SUBREG %reg1027<kill>, 1
    // %reg1029<def> = MOV8rr %reg1028
    // %reg1029<def> = SHR8ri %reg1029, 7, %EFLAGS<imp-def,dead>
    // insert => %reg1030<def> = MOV8rr %reg1029
    // %reg1030<def> = ADD8rr %reg1029<kill>, %reg1028<kill>, %EFLAGS<imp-def,dead>
    if (!mi.killsRegister(regC))
        return false;

    OutParamWrapper<Integer> x = new OutParamWrapper<>(0);
    if (notUseAfterLastDef(regC, mbb, dist, distanceMap, x))
        return false;

    int lastDefC = x.get();

    x.set(0);
    if (notUseAfterLastDef(regB, mbb, dist, distanceMap, x))
        return false;
    int lastDefB = x.get();

    return lastDefB !=0 && lastDefC != 0 && lastDefC > lastDefB;
}
项目:xcc    文件:TwoAddrInstructionPass.java   
private boolean isProfitableToReMat(int reg,
        TargetRegisterClass rc,
        MachineInstr mi,
        MachineInstr defMI,
        MachineBasicBlock mbb,
        int loc,
        TIntIntHashMap distanceMap)
{
    boolean otherUse = false;
    for (DefUseChainIterator itr = mri.getUseIterator(reg); itr.hasNext(); )
    {
        MachineOperand useMO = itr.getOpearnd();
        MachineInstr useMI = itr.getMachineInstr();
        MachineBasicBlock useBB = useMI.getParent();
        if (useBB.equals(mbb))
        {
            int idx = useMI.index();
            if (distanceMap.containsKey(idx) && distanceMap.get(idx) == loc)
            {
                otherUse = true;
                if (isTwoAddrUse(useMI, reg))
                    return true;
            }
        }
    }

    if (otherUse)
        return false;

    return mbb.equals(defMI.getParent());
}
项目:xcc    文件:EdgeBundles.java   
@Override
public boolean runOnMachineFunction(MachineFunction mf)
{
    this.mf = mf;
    ec = new IntEqClasses(mf.getNumBlockIDs()*2);
    for (MachineBasicBlock mbb : mf.getBasicBlocks())
    {
        int outEdge = mbb.getNumber()*2 + 1;
        // Join the outgoing
        for (Iterator<MachineBasicBlock> itr = mbb.succIterator(); itr.hasNext(); )
        {
            ec.join(outEdge, itr.next().getNumber()*2);
        }
    }
    blocks = new TIntArrayList[getNumBundles()];
    for (int i = 0, e; i < getNumBundles(); i++)
        blocks[i] = new TIntArrayList();

    groupID = new TIntIntHashMap();
    for (int i = 0; i < ec.getNumIds(); i++)
    {
        int leading = ec.findLeader(i);
        if (!groupID.containsKey(leading))
            groupID.put(leading, nextID++);
    }

    for (int i = 0, e = mf.getNumBlockIDs(); i < e; i++)
    {
        int b0 = getBundles(i, false);
        int b1 = getBundles(i, true);
        blocks[b0].add(i);
        if (b1 != b0)
            blocks[b1].add(i);
    }
    nextID = 0;
    return false;
}
项目:xcc    文件:VirtRegMap.java   
public VirtRegMap(MachineFunction mf)
{
    this.mf = mf;
    v2pMap = new TIntIntHashMap();
    v2StackSlotMap = new TIntIntHashMap();
    mi2vMap = new SetMultiMap<>();
}
项目:morpheus-core    文件:SparseArrayOfInts.java   
/**
 * Constructor
 * @param length    the length for this array
 * @param defaultValue  the default value for array
 */
SparseArrayOfInts(int length, Integer defaultValue) {
    super(Integer.class, ArrayStyle.SPARSE, false);
    this.length = length;
    this.defaultValue = defaultValue != null ? defaultValue : 0;
    this.values = new TIntIntHashMap((int)Math.max(length * 0.5, 10d), 0.8f, -1, this.defaultValue);
}
项目:morpheus-core    文件:SparseArrayWithIntCoding.java   
/**
 * Constructor
 * @param length        the length for this array
 * @param defaultValue  the default value for array
 * @param coding        the coding for this array
 */
SparseArrayWithIntCoding(int length, T defaultValue, IntCoding<T> coding) {
    super(coding.getType(), ArrayStyle.SPARSE, false);
    this.length = length;
    this.coding = coding;
    this.defaultValue = defaultValue;
    this.defaultCode = coding.getCode(defaultValue);
    this.codes = new TIntIntHashMap((int)Math.max(length * 0.5, 10d), 0.8f, -1, defaultCode);
}