Package java.util

Examples of java.util.TreeSet$MyIterator


    }

    private BeanProperty[] getPkProperties(JavaClass javaClass) {
        JavaMethod[] methods = javaClass.getMethods();
        JavaMethod method;
        SortedSet propSet = new TreeSet(new Comparator() {
                    public int compare(Object o1, Object o2) {
                        BeanProperty p1 = (BeanProperty) o1;
                        BeanProperty p2 = (BeanProperty) o2;
                        return p1.getName().compareTo(p2.getName());
                    }
                });

        for (int i = 0; i < methods.length; i++) {
            method = methods[i];
            int metaFlags = ejbUtils.getMethodMetadata(javaClass, method);

            if (EjbUtils.hasFlag(metaFlags, EjbUtils.METADATA_METHOD_PRIMARY_KEY_FIELD)) {
                BeanProperty beanProperty = javaClass.getBeanProperty(method.getPropertyName());

                if (beanProperty != null) {
                    if (propSet.add(beanProperty)) {
                        if (log.isDebugEnabled()) {
                            log.debug(beanProperty.getName() + " was added to the Set");
                        }
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug(beanProperty.getName() +
                                " wasn't added to the Set. There must be already a property with the same name");
                        }
                    }
                } else {
                    String errorMessage = "Unexpected null property for " + method.getPropertyName() + " in " +
                        javaClass.getFullyQualifiedName();
                    log.error(errorMessage);
                    throw new Error(errorMessage);
                }
            }
        }

        return (BeanProperty[]) propSet.toArray(new BeanProperty[0]);
    }
View Full Code Here


   
    System.out.println( "comp1 = " + DHTControlImpl.compareDistances2( d1, d2 ));
    System.out.println( "comp2 = " + DHTControlImpl.computeAndCompareDistances2( t1, t2, target ));
   
    final Set      set =
      new TreeSet(
        new Comparator()
        {
          public int
          compare(
            Object  o1,
            Object  o2 )
          {           
            byte[] d1 = DHTControlImpl.computeDistance2( (byte[])o1, target );
            byte[] d2 = DHTControlImpl.computeDistance2( (byte[])o2, target );
           
            System.out.println( "dist:" + ByteFormatter.nicePrint((byte[])o1) + " -> " + ByteFormatter.nicePrint(d1));
            System.out.println( "dist:" + ByteFormatter.nicePrint((byte[])o2) + " -> " + ByteFormatter.nicePrint(d2));
            return( DHTControlImpl.compareDistances2( d1, d2 ));
          }
        });
   
    set.add( t1 );
    set.add( t2 );
   
    //set.add( new byte[]{ (byte)0xF0, (byte)0x48 ,(byte)0x3F, (byte)0x25 });
    //set.add( new byte[]{ (byte)0xF1, (byte)0xF8, (byte)0x36, (byte)0xCB });
    //set.add( new byte[]{ (byte)0xF2, (byte)0x2F, (byte)0xE1, (byte)0x0D });
 
   
    Iterator it = set.iterator();
   
    while( it.hasNext()){
     
      byte[]  val = (byte[])it.next();
     
View Full Code Here

     *
     * @param pkgname containing package name
     */
    public ImportsTracker(String pkgname) {
        m_packageName = pkgname;
        m_importedTypes = new TreeSet();
        m_unqualifiedNameType = new HashMap();
        m_localTypeName = new HashMap();
    }
View Full Code Here

  public DefaultPageGrid(final PageDefinition pageDefinition)
  {
    final Rectangle2D[] pagePositions = pageDefinition.getPagePositions();

    final TreeSet horizontalPositions = new TreeSet();
    final TreeSet verticalPositions = new TreeSet();

    final int pagePosCount = pagePositions.length;
    for (int i = 0; i < pagePosCount; i++)
    {
      final Rectangle2D pagePosition = pagePositions[i];

      final double minX = pagePosition.getMinX();
      final double maxX = pagePosition.getMaxX();
      final double minY = pagePosition.getMinY();
      final double maxY = pagePosition.getMaxY();

      if (minX == maxX || maxY == minY)
      {
        throw new IllegalArgumentException("This page format is invalid, it has no imageable area.");
      }
      horizontalPositions.add(new Double(minX));
      horizontalPositions.add(new Double(maxX));
      verticalPositions.add(new Double(minY));
      verticalPositions.add(new Double(maxY));
    }

    horizontalBreaksFull = new long[horizontalPositions.size()];
    int pos = 0;
    for (Iterator iterator = horizontalPositions.iterator(); iterator.hasNext();)
    {
      final Double value = (Double) iterator.next();
      horizontalBreaksFull[pos] = StrictGeomUtility.toInternalValue(value.doubleValue());
      pos += 1;
    }

    verticalBreaksFull = new long[verticalPositions.size()];
    pos = 0;
    for (Iterator iterator = verticalPositions.iterator(); iterator.hasNext();)
    {
      final Double value = (Double) iterator.next();
      verticalBreaksFull[pos] = StrictGeomUtility.toInternalValue(value.doubleValue());
      pos += 1;
    }

    horizontalPositions.remove(new Double(0));
    verticalPositions.remove(new Double(0));

    horizontalBreaks = new long[horizontalPositions.size()];
    pos = 0;
    for (Iterator iterator = horizontalPositions.iterator(); iterator.hasNext();)
    {
      final Double value = (Double) iterator.next();
      horizontalBreaks[pos] = StrictGeomUtility.toInternalValue(value.doubleValue());
      pos += 1;
    }

    verticalBreaks = new long[verticalPositions.size()];
    pos = 0;
    for (Iterator iterator = verticalPositions.iterator(); iterator.hasNext();)
    {
      final Double value = (Double) iterator.next();
      verticalBreaks[pos] = StrictGeomUtility.toInternalValue(value.doubleValue());
      pos += 1;
    }
View Full Code Here

  public List
  findBestContacts(
    int    max )
  {
    Set  set =
      new TreeSet(
          new Comparator()
          {
            public int
            compare(
              Object  o1,
              Object  o2 )
            {
              DHTRouterContactImpl  c1 = (DHTRouterContactImpl)o1;
              DHTRouterContactImpl  c2 = (DHTRouterContactImpl)o2;
             
              return((int)( c2.getTimeAlive() - c1.getTimeAlive()));
            }
          });
   
   
    try{
      this_mon.enter();

      findAllContacts( set, root );
     
    }finally{
     
      this_mon.exit();
    }
   
    List  result = new ArrayList( max );
 
    Iterator  it = set.iterator();
   
    while( it.hasNext() && (max <= 0 || result.size() < max )){
     
      result.add( it.next());
    }
View Full Code Here

     *        considered equals, in radians.
     * @return a convex hull of the geos
     */
    public static final Geo[] hull(Geo[] geos, double tolerance) {
        Geo pivot = findHighest(geos);
        TreeSet sortedGeos = new TreeSet(new PivotAngleComparator(pivot));
        for (int i = 0; i < geos.length; i++) {
            Geo g = geos[i];
            if (g != pivot) {
                sortedGeos.add(g);
            }
        }

        Stack hullStack = new Stack();
        hullStack.push(pivot);

        Geo gCross, midCross = null;
        Geo geo = null, endGeo = null, midGeo = null;

        Iterator sortedGeoIt = sortedGeos.iterator();
        if (sortedGeoIt.hasNext()) {
            midGeo = (Geo) sortedGeoIt.next();

            while (midGeo.distance(pivot) == 0 && sortedGeoIt.hasNext()) {
                midGeo = (Geo) sortedGeoIt.next();
View Full Code Here

     * @param keeps classes used but kept unchanged by binding
     */
    public void addClassList(ClassFile[] adds, ClassFile[] keeps) {
       
        // build a sorted tree of all the class names used in the binding
        Set tree = new TreeSet();
        int addcount = adds.length;
        for (int i = 0; i < addcount; i++) {
            tree.add(adds[i].getName());
        }
        for (int i = 0; i < keeps.length; i++) {
            tree.add(keeps[i].getName());
        }
        String[] refs = (String[])tree.toArray(new String[tree.size()]);
       
        // replace private method to return binding classes blob
        m_factoryClass.deleteMethod(CLASSLIST_METHOD_NAME,
            CLASSLIST_METHOD_SIGNATURE);
        MethodBuilder mb = new ExceptionMethodBuilder(CLASSLIST_METHOD_NAME,
View Full Code Here

    private static ArrayList arrayListFactory() {
        return new ArrayList();
    }
   
    private static SortedSet sortedSetFactory() {
        return new TreeSet();
    }
View Full Code Here

    @Test
    public void addProject() {
        checkAccessMethods(rootMock, toSortedSet(rootMock, childMock, childChildMock), toSortedSet(childMock,
                childChildMock), rootMock);
        checkAccessMethods(childMock, toSortedSet(childMock, childChildMock), toSortedSet(childChildMock), childMock);
        checkAccessMethods(childChildMock, toSortedSet(childChildMock), new TreeSet(), childChildMock);
    }
View Full Code Here

   */
  public Iterator getLevelsAscending()
  {
    if (iteratorSetAsc == null)
    {
      iteratorSetAsc = new TreeSet();
      final Integer[] ilevels = (Integer[]) levels.toArray(new Integer[levels.size()]);
      for (int i = 0; i < ilevels.length; i++)
      {
        if (iteratorSetAsc.contains(ilevels[i]) == false)
        {
View Full Code Here

TOP

Related Classes of java.util.TreeSet$MyIterator

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.