Package java.util

Examples of java.util.PriorityQueue$PriorityIterator


    Class nextClass = type;
    while (nextClass != null && nextClass != Object.class) {
      Collections.addAll(allMethods, nextClass.getDeclaredMethods());
      nextClass = nextClass.getSuperclass();
    }
    PriorityQueue<Method> methods = new PriorityQueue(Math.max(1, allMethods.size()), new Comparator<Method>() {
      public int compare (Method o1, Method o2) {
        // Methods are sorted so they can be represented as an index.
        int diff = o1.getName().compareTo(o2.getName());
        if (diff != 0) return diff;
        Class[] argTypes1 = o1.getParameterTypes();
        Class[] argTypes2 = o2.getParameterTypes();
        if (argTypes1.length > argTypes2.length) return 1;
        if (argTypes1.length < argTypes2.length) return -1;
        for (int i = 0; i < argTypes1.length; i++) {
          diff = argTypes1[i].getName().compareTo(argTypes2[i].getName());
          if (diff != 0) return diff;
        }
        throw new RuntimeException("Two methods with same signature!"); // Impossible.
      }
    });
    for (int i = 0, n = allMethods.size(); i < n; i++) {
      Method method = allMethods.get(i);
      int modifiers = method.getModifiers();
      if (Modifier.isStatic(modifiers)) continue;
      if (Modifier.isPrivate(modifiers)) continue;
      if (method.isSynthetic()) continue;
      methods.add(method);
    }

    int n = methods.size();
    cachedMethods = new CachedMethod[n];
    for (int i = 0; i < n; i++) {
      CachedMethod cachedMethod = new CachedMethod();
      cachedMethod.method = methods.poll();

      // Store the serializer for each final parameter.
      Class[] parameterTypes = cachedMethod.method.getParameterTypes();
      cachedMethod.serializers = new Serializer[parameterTypes.length];
      for (int ii = 0, nn = parameterTypes.length; ii < nn; ii++)
View Full Code Here


        if ( capacity == 0 ) {
            return;
        }

        this.queue = new PriorityQueue( capacity,
                                        new Comparator<SimulationStep>() {
                                            public int compare(SimulationStep s1,
                                                               SimulationStep s2) {
                                                return (int) (s1.getDistanceMillis() - s2.getDistanceMillis());
                                            }
View Full Code Here

        if ( capacity == 0 ) {
            return;
        }

        this.queue = new PriorityQueue( capacity,
                                        new Comparator<Step>() {
                                            public int compare(Step s1,
                                                               Step s2) {
                                                return (int) (s1.getTemporalDistance() - s2.getTemporalDistance());
                                            }
View Full Code Here

        if ( capacity == 0 ) {
            return;
        }

        this.queue = new PriorityQueue( capacity,
                                        new Comparator<Step>() {
                                            public int compare(Step s1,
                                                               Step s2) {
                                                return (int) (s1.getTemporalDistance() - s2.getTemporalDistance());
                                            }
View Full Code Here

  public void checkProperties() {
    ArrayList algoList = (ArrayList) msgProp.getProperties(AlgorithmSuitePropertyFactory.K_AlgoList);
    Iterator algoSuites = algoList.iterator();
    ArrayList tempAlgo;
    PriorityQueue q = new PriorityQueue(20, new AlgoSuiteComparator());
    while (algoSuites.hasNext()) {
      tempAlgo = (ArrayList) algoSuites.next();
      Iterator algorithms = tempAlgo.iterator();
      int i = 0;
      String algorithmName = "";
      while (algorithms.hasNext()) {
        algorithmName = (String) algorithms.next();
        if (algorithmName.equals(encMethod)) {
          i++;
        } else if (algorithmName.equals(asymKW)) {
          i++;
        } else if (algorithmName.equals(digestMethod)) {
          i++;
        }
      }
      if (i > 0) {
        q.add(new AlgoSuite(algorithmName, i));
      }

      /*
            if(i>=2){

               this.suite = new AlgorithmSuite(11);
              try {
                this.suite.setAlgorithmSuite((String)tempAlgo.get(3));
                System.out.println("AlgoSuite : "+(String)tempAlgo.get(3));


              } catch (WSSPolicyException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
              }
              this.isBehaviorCompleted=true;

               System.out.println("Digest Method : " + digestMethod);
               System.out.println("Encryption Method for Data : " + encMethod);
               System.out.println("Encryption Method for Key : " + asymKW);
               break;

            }

            */
    }
    if (!q.isEmpty()) {
      this.suite = new AlgorithmSuite(11);
      try {
        String algoSuiteName = ((AlgoSuite) q.poll()).getSuite();
        this.suite.setAlgorithmSuite(algoSuiteName);
        if (log.isDebugEnabled()) {
          log.debug("AlgoSuite : " + algoSuiteName);
        }
        //  System.out.println("AlgoSuite : "+algoSuiteName);
View Full Code Here

        if ( capacity == 0 ) {
            return;
        }

        this.queue = new PriorityQueue( capacity,
                                        new Comparator<SimulationStep>() {
                                            public int compare(SimulationStep s1,
                                                               SimulationStep s2) {
                                                return (int) (s1.getDistanceMillis() - s2.getDistanceMillis());
                                            }
View Full Code Here

    protected void setChangeTracker(CollectionChangeTracker ct) {
        changeTracker = ct;
    }
   
    public Object copy(Object paramObject) {
        return new PriorityQueue((PriorityQueue) paramObject);
    }
View Full Code Here

        initializeServers(serviceUrls);
    }
   
    protected void initializeServers(String serviceUrls) {
        String[] urls = serviceUrls.split(",");
        lipstickServers = new PriorityQueue(urls.length);       
        for (String url : urls) {
            lipstickServers.add(new Server(url, 1l));
        }
    }
View Full Code Here

    Class nextClass = type;
    while (nextClass != null && nextClass != Object.class) {
      Collections.addAll(allMethods, nextClass.getDeclaredMethods());
      nextClass = nextClass.getSuperclass();
    }
    PriorityQueue<Method> methods = new PriorityQueue(Math.max(1, allMethods.size()), new Comparator<Method>() {
      public int compare (Method o1, Method o2) {
        // Methods are sorted so they can be represented as an index.
        int diff = o1.getName().compareTo(o2.getName());
        if (diff != 0) return diff;
        Class[] argTypes1 = o1.getParameterTypes();
        Class[] argTypes2 = o2.getParameterTypes();
        if (argTypes1.length > argTypes2.length) return 1;
        if (argTypes1.length < argTypes2.length) return -1;
        for (int i = 0; i < argTypes1.length; i++) {
          diff = argTypes1[i].getName().compareTo(argTypes2[i].getName());
          if (diff != 0) return diff;
        }
        throw new RuntimeException("Two methods with same signature!"); // Impossible.
      }
    });
    for (int i = 0, n = allMethods.size(); i < n; i++) {
      Method method = allMethods.get(i);
      int modifiers = method.getModifiers();
      if (Modifier.isStatic(modifiers)) continue;
      if (Modifier.isPrivate(modifiers)) continue;
      if (method.isSynthetic()) continue;
      methods.add(method);
    }

    int n = methods.size();
    cachedMethods = new CachedMethod[n];
    for (int i = 0; i < n; i++) {
      CachedMethod cachedMethod = new CachedMethod();
      cachedMethod.method = methods.poll();

      // Store the serializer for each final parameter.
      Class[] parameterTypes = cachedMethod.method.getParameterTypes();
      cachedMethod.serializers = new Serializer[parameterTypes.length];
      for (int ii = 0, nn = parameterTypes.length; ii < nn; ii++)
View Full Code Here

    PriorityQueue pqueue;
   
    /** Creates a new instance of ERModel */
    public ERModel()
    {
  pqueue = new PriorityQueue();
    }
View Full Code Here

TOP

Related Classes of java.util.PriorityQueue$PriorityIterator

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.