Package gnu.trove

Examples of gnu.trove.TIntObjectHashMap


    protected static void createConstructorRepository(final Class klass) {
        if (klass == null) {
            throw new IllegalArgumentException("class can not be null");
        }
        Constructor[] constructors = klass.getDeclaredConstructors();
        TIntObjectHashMap constructorMap = new TIntObjectHashMap(constructors.length);
        for (int i = 0; i < constructors.length; i++) {
            Constructor constructor1 = constructors[i];
            Constructor prefixedConstructor = null;
            // try to find a prefixed ctor for this one, that is with JPManager as last argument
            Class[] parameterTypes2 = new Class[constructor1.getParameterTypes().length + 1];
            System.arraycopy(constructor1.getParameterTypes(), 0, parameterTypes2, 0, constructor1.getParameterTypes().length);
            parameterTypes2[parameterTypes2.length-1] = JoinPointManager.class;
            try {
                prefixedConstructor = klass.getDeclaredConstructor(parameterTypes2);
            } catch (NoSuchMethodException e) {
                // this one as no tuple available ie call pc or already a wrapper constructor
                continue;
            }

            // create a constructor tuple with 'wrapper constructor' and 'prefixed constructor'
            ConstructorTuple constructorTuple = new ConstructorTuple(constructor1, prefixedConstructor);

            // map the tuple to the hash for the 'wrapper constructor'
            int constructorHash = ReflectHelper.calculateHash(constructor1);
            constructorMap.put(constructorHash, constructorTuple);
        }

//
//
//
View Full Code Here


    protected static void createFieldRepository(final Class klass) {
        if (klass == null) {
            throw new IllegalArgumentException("class can not be null");
        }
        Field[] fields = klass.getDeclaredFields();
        TIntObjectHashMap fieldMap = new TIntObjectHashMap(fields.length);
        for (int i = 0; i < fields.length; i++) {
            Field field = fields[i];
            field.setAccessible(true);
            int fieldHash = ReflectHelper.calculateHash(field);
            fieldMap.put(fieldHash, field);
        }
        synchronized (s_fields) {
            s_fields.put(klass, fieldMap);
        }
    }
View Full Code Here

            throw new IllegalArgumentException("pointcut type can not be null");
        }
        if (methodInfo == null) {
            throw new IllegalArgumentException("method info can not be null");
        }
        TIntObjectHashMap cflows = (TIntObjectHashMap) m_cflowStack.get();
        if (cflows == null) {
            cflows = new TIntObjectHashMap();
        }
        ExpressionContext expressionContext = new ExpressionContext(pointcutType, methodInfo, withinInfo);
        cflows.put(expressionContext.hashCode(), expressionContext);
        m_cflowStack.set(cflows);
    }
View Full Code Here

            throw new IllegalArgumentException("pointcut type can not be null");
        }
        if (methodInfo == null) {
            throw new IllegalArgumentException("method info can not be null");
        }
        TIntObjectHashMap cflows = (TIntObjectHashMap) m_cflowStack.get();
        if (cflows == null) {
            return;
        }
        ExpressionContext ctx = new ExpressionContext(pointcutType, methodInfo, withinInfo);
        cflows.remove(ctx.hashCode());
        m_cflowStack.set(cflows);
    }
View Full Code Here

     */
    public boolean isInControlFlowOf(final CflowExpressionVisitorRuntime expression, ExpressionContext expressionContext) {
        if (expression == null) {
            throw new IllegalArgumentException("expression can not be null");
        }
        TIntObjectHashMap cflows = (TIntObjectHashMap) m_cflowStack.get();
        if (cflows == null) {
            // we still need to evaluate the expression to handle "NOT cflow"
            cflows = new TIntObjectHashMap();
        }
        if (expression.matchCflowStack(cflows.getValues(), expressionContext)) {
            return true;
        }
        return false;
    }
View Full Code Here

                Modifier.isNative(access) ||
                Modifier.isAbstract(access)) {
                ;//ignore
            }

            TIntObjectHashMap newInvocations = new TIntObjectHashMap(5);
            m_newInvocationsByCallerMemberHash.put(getMemberHash(name, desc), newInvocations);
            return new LookaheadNewDupInvokeSpecialInstructionCodeAdapter(newInvocations);
        }
View Full Code Here

    protected static void createMethodRepository(final Class klass) {
        if (klass == null) {
            throw new IllegalArgumentException("class can not be null");
        }
        Method[] methods = klass.getDeclaredMethods();
        TIntObjectHashMap methodMap = new TIntObjectHashMap(methods.length);
        for (int i = 0; i < methods.length; i++) {
            Method wrapperMethod = methods[i];
            if (!wrapperMethod.getName().startsWith(TransformationUtil.ASPECTWERKZ_PREFIX)) {
                Method prefixedMethod = null;
                for (int j = 0; j < methods.length; j++) {
                    Method method2 = methods[j];
                    if (method2.getName().startsWith(TransformationUtil.ASPECTWERKZ_PREFIX)) {
                        String[] tokens = Strings.splitString(method2.getName(), TransformationUtil.DELIMITER);
                        String methodName = tokens[1];
                        Class[] parameterTypes1 = wrapperMethod.getParameterTypes();
                        Class[] parameterTypes2 = method2.getParameterTypes();
                        if (!methodName.equals(wrapperMethod.getName())) {
                            continue;
                        }
                        if (parameterTypes2.length != parameterTypes1.length) {
                            continue;
                        }
                        boolean match = true;
                        for (int k = 0; k < parameterTypes1.length; k++) {
                            if (parameterTypes1[k] != parameterTypes2[k]) {
                                match = false;
                                break;
                            }
                        }
                        if (!match) {
                            continue;
                        }
                        prefixedMethod = method2;
                        break;
                    }
                }

                // create a method tuple with 'wrapped method' and 'prefixed method'
                MethodTuple methodTuple = new MethodTuple(wrapperMethod, prefixedMethod);

                // map the tuple to the hash for the 'wrapper method'
                int methodHash = TransformationUtil.calculateHash(wrapperMethod);
                methodMap.put(methodHash, methodTuple);
            }
        }
        synchronized (s_methods) {
            s_methods.put(klass, methodMap);
        }
View Full Code Here

    protected static void createConstructorRepository(final Class klass) {
        if (klass == null) {
            throw new IllegalArgumentException("class can not be null");
        }
        Constructor[] constructors = klass.getDeclaredConstructors();
        TIntObjectHashMap constructorMap = new TIntObjectHashMap(constructors.length);
        for (int i = 0; i < constructors.length; i++) {
            Constructor constructor1 = constructors[i];
            Constructor prefixedConstructor = constructor1;
            Constructor wrapperConstructor = constructor1;
            for (int j = 0; j < constructors.length; j++) {
                Constructor constructor2 = constructors[j];
                Class[] parameterTypes1 = constructor1.getParameterTypes();
                Class[] parameterTypes2 = constructor2.getParameterTypes();
                if (!constructor2.getName().equals(constructor1.getName())) {
                    continue;
                }
                if (parameterTypes1.length == parameterTypes2.length) {
                    continue;
                } else if ((parameterTypes1.length < parameterTypes2.length)
                           && (parameterTypes1.length == (parameterTypes2.length - 1))) {
                    boolean match = true;
                    for (int k = 0; k < parameterTypes1.length; k++) {
                        if (parameterTypes1[k] != parameterTypes2[k]) {
                            match = false;
                            break;
                        }
                    }
                    if (parameterTypes2[parameterTypes1.length].getName().equals(
                            TransformationUtil.JOIN_POINT_MANAGER_CLASS
                    )) {
                        match = true;
                    }
                    if (!match) {
                        continue;
                    }
                    wrapperConstructor = constructor1;
                    prefixedConstructor = constructor2;
                    break;
                } else if ((parameterTypes2.length < parameterTypes1.length)
                           && (parameterTypes2.length == (parameterTypes1.length - 1))) {
                    boolean match = true;
                    for (int k = 0; k < parameterTypes2.length; k++) {
                        if (parameterTypes2[k] != parameterTypes1[k]) {
                            match = false;
                            break;
                        }
                    }
                    if (parameterTypes1[parameterTypes2.length].getName().equals(
                            TransformationUtil.JOIN_POINT_MANAGER_CLASS
                    )) {
                        match = true;
                    }
                    if (!match) {
                        continue;
                    }
                    wrapperConstructor = constructor2;
                    prefixedConstructor = constructor1;
                    break;
                }
            }

            // create a constructor tuple with 'wrapper constructor' and 'prefixed constructor'
            ConstructorTuple constructorTuple = new ConstructorTuple(wrapperConstructor, prefixedConstructor);

            // map the tuple to the hash for the 'wrapper constructor'
            int constructorHash = TransformationUtil.calculateHash(wrapperConstructor);
            constructorMap.put(constructorHash, constructorTuple);
        }
        synchronized (s_constructors) {
            s_constructors.put(klass, constructorMap);
        }
    }
View Full Code Here

    protected static void createFieldRepository(final Class klass) {
        if (klass == null) {
            throw new IllegalArgumentException("class can not be null");
        }
        Field[] fields = klass.getDeclaredFields();
        TIntObjectHashMap fieldMap = new TIntObjectHashMap(fields.length);
        for (int i = 0; i < fields.length; i++) {
            Field field = fields[i];
            field.setAccessible(true);
            int fieldHash = TransformationUtil.calculateHash(field);
            fieldMap.put(fieldHash, field);
        }
        synchronized (s_fields) {
            s_fields.put(klass, fieldMap);
        }
    }
View Full Code Here

TOP

Related Classes of gnu.trove.TIntObjectHashMap

Copyright © 2018 www.massapicom. 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.