Package gnu.trove

Examples of gnu.trove.TIntObjectHashMap


    protected 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 (m_constructors) {
            m_constructors.put(klass, constructorMap);
        }
View Full Code Here


        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 (m_fields) {
            m_fields.put(klass, fieldMap);
        }
View Full Code Here

  public JunctionTree(int size)
  {
    super();

    numNodes = size;
    sepsets = new TIntObjectHashMap();
    cpfs = new Factor[size];
  } // JunctionTree constructor
View Full Code Here

                ;//ignore
            }

            m_callerMemberName = name;

            TIntObjectHashMap newInvocations = new TIntObjectHashMap(5);
            m_newInvocationsByCallerMemberHash.put(getMemberHash(name, desc), newInvocations);
            return new LookaheadNewDupInvokeSpecialInstructionCodeAdapter(
                    super.visitMethod(access, name, desc, exceptions, attrs),
                    newInvocations,
                    m_callerMemberName
View Full Code Here

     * @param qName
     * @return
     */
    public static AspectContainer getContainerQNamed(final ClassLoader visibleFrom, final Class containerClass, final String qName) {
        synchronized (ASPECT_CONTAINER_LISTS) {
            TIntObjectHashMap containers = (TIntObjectHashMap) ASPECT_CONTAINER_LISTS.get(containerClass);
            if (containers == null) {
                containers = new TIntObjectHashMap();
                ASPECT_CONTAINER_LISTS.put(containerClass, containers);
            }
            AspectContainer container = (AspectContainer) containers.get(qName.hashCode());
            if (container == null) {
                container = createAspectContainer(visibleFrom, containerClass, qName);
                containers.put(qName.hashCode(), container);
            }
            return container;
        }
    }
View Full Code Here

                ;//ignore
            }

            m_callerMemberName = name;

            TIntObjectHashMap newInvocations = new TIntObjectHashMap(5);
            m_newInvocationsByCallerMemberHash.put(getMemberHash(name, desc), newInvocations);
            return new LookaheadNewDupInvokeSpecialInstructionCodeAdapter(
                    super.visitMethod(access, name, desc, exceptions, attrs),
                    newInvocations,
                    m_callerMemberName
View Full Code Here

     * @param qName
     * @return
     */
    public static AspectContainer getContainerQNamed(final ClassLoader visibleFrom, final Class containerClass, final String qName) {
        synchronized (ASPECT_CONTAINER_LISTS) {
            TIntObjectHashMap containers = (TIntObjectHashMap) ASPECT_CONTAINER_LISTS.get(containerClass);
            if (containers == null) {
                containers = new TIntObjectHashMap();
                ASPECT_CONTAINER_LISTS.put(containerClass, containers);
            }
            AspectContainer container = (AspectContainer) containers.get(CompositeVisibleFromQNameKey.hash(visibleFrom, qName));
            if (container == null) {
                container = createAspectContainer(visibleFrom, containerClass, qName);
                containers.put(CompositeVisibleFromQNameKey.hash(visibleFrom, qName), container);
            }
            return container;
        }
    }
View Full Code Here

    List sizes = new ArrayList (varSet.size ());
    for (int vi = 0; vi < varSet.size (); vi++) {
      sizes.add (varSet.get(vi).getNumOutcomes ());
    }

    TIntObjectHashMap result = (TIntObjectHashMap) allProjectionCaches.get (sizes);
    if (result == null) {
      result = new TIntObjectHashMap ();
      allProjectionCaches.put (sizes, result);
    }

    return result;
  }
View Full Code Here

   }

  private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
     in.defaultReadObject ();
    // rerun initializers of transient fields
     projectionCache = new TIntObjectHashMap ();
  }
View Full Code Here

        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 (m_methods) {
            m_methods.put(klass, methodMap);
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.