Examples of TIntIntHashMap


Examples of gnu.trove.TIntIntHashMap

        // did we visit some args(<name>) nodes ?

        if (!context.m_exprIndexToTargetIndex.isEmpty()) {

            TIntIntHashMap sourceToTargetArgIndexes = new TIntIntHashMap();

            int index = 0;

            for (Iterator it = m_expressionInfo.getArgumentNames().iterator(); it.hasNext(); index++) {

                String adviceParamName = (String) it.next();

                //look for adviceParamName in the expression name and get its index

                int exprArgIndex = ArgsIndexVisitor.getExprArgIndex(m_expression, adviceParamName);

                if (exprArgIndex < 0) {

                    //param of advice not found in pc signature - f.e. "joinPoint"

                    continue;

                }

                int adviceArgIndex = m_expressionInfo.getArgumentIndex(adviceParamName);

                int targetArgIndex = context.m_exprIndexToTargetIndex.get(exprArgIndex);

                //                System.out.println(" transitive arg" + adviceArgIndex + " " + adviceParamName + " -> " + exprArgIndex

                // + " -> " + targetArgIndex);

                sourceToTargetArgIndexes.put(adviceArgIndex, targetArgIndex);

            }

            context.m_exprIndexToTargetIndex = sourceToTargetArgIndexes;
View Full Code Here

Examples of gnu.trove.TIntIntHashMap

        Boolean match = new Boolean(expression.match(context));

        // update the context mapping from this last visit
        // did we visit some args(<name>) nodes ?
        if (!context.m_exprIndexToTargetIndex.isEmpty()) {
            TIntIntHashMap sourceToTargetArgIndexes = new TIntIntHashMap();
            int index = 0;
            for (Iterator it = m_expressionInfo.getArgumentNames().iterator(); it.hasNext(); index++) {
                String adviceParamName = (String) it.next();
                //look for adviceParamName in the expression name and get its index
                int exprArgIndex = ArgsIndexVisitor.getExprArgIndex(m_expression, adviceParamName);
                if (exprArgIndex < 0) {
                    //param of advice not found in pc signature - f.e. "joinPoint"
                    continue;
                }
                int adviceArgIndex = m_expressionInfo.getArgumentIndex(adviceParamName);
                int targetArgIndex = context.m_exprIndexToTargetIndex.get(exprArgIndex);
                //                System.out.println(" transitive arg" + adviceArgIndex + " " + adviceParamName + " -> " + exprArgIndex
                // + " -> " + targetArgIndex);
                sourceToTargetArgIndexes.put(adviceArgIndex, targetArgIndex);
            }
            context.m_exprIndexToTargetIndex = sourceToTargetArgIndexes;

            //debug:
            //            if (m_expressionInfo.m_isAdviceBindingWithArgs) {
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

        }
        if (isContiguous)
            return g;       

        // Map the vertices to a contiguous range
        TIntIntMap vMap = new TIntIntHashMap(g.order());
        int j = 0;
        for (int i : g.vertices())
            vMap.put(i, j++);
       
        Graph<E> copy = g.copy(Collections.<Integer>emptySet());
        for (int i = 0; i < order; ++i)
            copy.add(i);
        for (E e : g.edges())
            copy.add(e.<E>clone(vMap.get(e.from()), vMap.get(e.to())));
       
        return copy;
    }   
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

     *
     * @param length the length of this vector
     */
    public SparseHashIntegerVector(int length) {
        this.length = length;
        map = new TIntIntHashMap();
        magnitude = -1;
    }
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

    public SparseHashIntegerVector(IntegerVector values) {
        length = values.length();
        magnitude = -1;
        if (values instanceof SparseHashIntegerVector) {
            SparseHashIntegerVector v = (SparseHashIntegerVector)values;
            map = new TIntIntHashMap(v.map);
        }
        else if (values instanceof SparseVector) {
            int[] nonZeros = ((SparseVector) values).getNonZeroIndices();
            map = new TIntIntHashMap(nonZeros.length);
            for (int index : nonZeros)
                map.put(index, values.get(index));
        } else {
            map = new TIntIntHashMap();
            for (int index = 0; index < values.length(); ++index) {
                int value = values.get(index);
                if (value != 0)
                    map.put(index, value);
            }
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

    public Map<Integer,Integer> findIsomorphism(Graph<? extends Edge> g1,
                                                Graph<? extends Edge> g2) {
        // Since the user has asked to find the mapping itself, we'll need to
        // keep track of how the vertices are remapped.  Note that if the graphs
        // are already in canonical order, then these maps will be empty.
        TIntIntHashMap g1vMap = new TIntIntHashMap(g1.order());
        TIntIntHashMap g2vMap = new TIntIntHashMap(g2.order());

        // Remap the graphs so that the vertices are contiguous, filling in a
        // backwards mapping so we can recover the isomorphism later.
        Graph<? extends Edge> g1mapped = remap(g1, g1vMap);
        Graph<? extends Edge> g2mapped = remap(g2, g2vMap);
        State state = makeInitialState(g1mapped, g2mapped);

        Map<Integer,Integer> isoMapping = new HashMap<Integer,Integer>();
        // If we mapped the vertices, we have to unmap the vertices in order
        // to identify the isometric pairs.
        if (match(state, isoMapping)) {
            // Create a new isometric map that will contain the unmapped
            // mappings
            TIntIntMap fixedIsoMapping = new TIntIntHashMap(isoMapping.size());
            for (Map.Entry<Integer,Integer> e : isoMapping.entrySet()) {
                int v1 = e.getKey();
                v1 = (g1vMap.isEmpty()) ? v1 : g1vMap.get(v1);
                int v2 = e.getValue();
                v2 = (g2vMap.isEmpty()) ? v2 : g2vMap.get(v2);
                fixedIsoMapping.put(v1, v2);
            }
            return TDecorators.wrap(fixedIsoMapping);
        }
        else
            return Collections.<Integer,Integer>emptyMap();
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

        }
        if (isContiguous)
            return g;       

        // Map the vertices to a contiguous range
        TIntIntMap vMap = new TIntIntHashMap(g.order());
        int j = 0;
        for (int i : g.vertices()) {
            vMap.put(i, j++);
        }
       
        if (rvMap != null) {
            // Assumes a stable iteration ordering of the vertices, which is
            // potentially unsafe... However, this avoids putting a redundant
            // null check in the prior loop.
            int k = 0;
            for (int i : g.vertices()) {
                rvMap.put(k++, i);
            }
        }
       
        Graph<E> copy = g.copy(Collections.<Integer>emptySet());
        for (int i = 0; i < order; ++i)
            copy.add(i);
        for (E e : g.edges())
            copy.add(e.<E>clone(vMap.get(e.from()), vMap.get(e.to())));
       
        return copy;
    }   
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

     *        added to {@code objectIndices}
     */
    public IndexedCounter(Indexer<T> objectIndices, boolean allowNewIndices) {
        this.objectIndices = objectIndices;
        this.allowNewIndices = allowNewIndices;
        indexToCount = new TIntIntHashMap();
        sum = 0;
    }
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

        // If the state of this set's type is inconsistent with the current type
        // mapping, then update the mapping with any missing types and then
        // reset all of its BitSet contents with the correct indices
        if (needToRemapIndices) {
            TIntIntMap typeRemapping = new TIntIntHashMap();
            for (Map.Entry<Object,Integer> e : typeIndices.entrySet()) {
                Object o = e.getKey();
                int oldIndex = e.getValue();
                // NOTE: the else {} case above may have added several of our
                // types that weren't inconsistent, so this may be an identity
                // mapping for some types, which is nice.
                typeRemapping.put(oldIndex, index(o));
            }
            // Remap all the in-edges vertices' types...
            for (TIntObjectIterator<BitSet> it = edges.iterator(); it.hasNext(); ) {
                it.advance();
                int v = it.key();
                BitSet oldIndices = it.value();
                BitSet newIndices = new BitSet();
                for (int i = oldIndices.nextSetBit(0); i >= 0;
                         i = oldIndices.nextSetBit(i+1)) {
                    newIndices.set(typeRemapping.get(i));
                }
                it.setValue(newIndices);
            }
        }
    }
View Full Code Here

Examples of gnu.trove.map.hash.TIntIntHashMap

        // If the state of this set's type is inconsistent with the current type
        // mapping, then update the mapping with any missing types and then
        // reset all of its BitSet contents with the correct indices
        if (needToRemapIndices) {
            TIntIntMap typeRemapping = new TIntIntHashMap();
            for (Map.Entry<Object,Integer> e : typeIndices.entrySet()) {
                Object o = e.getKey();
                int oldIndex = e.getValue();
                // NOTE: the else {} case above may have added several of our
                // types that weren't inconsistent, so this may be an identity
                // mapping for some types, which is nice.
                typeRemapping.put(oldIndex, index(o));
            }
            // Remap all the in-edges vertices' types...
            for (TIntObjectIterator<BitSet> it = inEdges.iterator(); it.hasNext(); ) {
                it.advance();
                int v = it.key();
                BitSet oldIndices = it.value();
                BitSet newIndices = new BitSet();
                for (int i = oldIndices.nextSetBit(0); i >= 0;
                         i = oldIndices.nextSetBit(i+1)) {
                    newIndices.set(typeRemapping.get(i));
                }
                it.setValue(newIndices);
            }
            // Remap all the in-edges vertices' types...
            for (TIntObjectIterator<BitSet> it = outEdges.iterator(); it.hasNext(); ) {
                it.advance();
                int v = it.key();
                BitSet oldIndices = it.value();
                BitSet newIndices = new BitSet();
                for (int i = oldIndices.nextSetBit(0); i >= 0;
                         i = oldIndices.nextSetBit(i+1)) {
                    newIndices.set(typeRemapping.get(i));
                }
                it.setValue(newIndices);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.