• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PriorityQueue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vividsolutions.jts.util.PriorityQueue的典型用法代码示例。如果您正苦于以下问题:Java PriorityQueue类的具体用法?Java PriorityQueue怎么用?Java PriorityQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PriorityQueue类属于com.vividsolutions.jts.util包,在下文中一共展示了PriorityQueue类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: expandToQueue

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
/**
 * For a pair which is not a leaf
 * (i.e. has at least one composite boundable)
 * computes a list of new pairs
 * from the expansion of the larger boundable.
 */
public void expandToQueue(PriorityQueue priQ, double minDistance) {
    boolean isComp1 = isComposite(this.boundable1);
    boolean isComp2 = isComposite(this.boundable2);

    /**
     * HEURISTIC: If both boundable are composite,
     * choose the one with largest area to expand.
     * Otherwise, simply expand whichever is composite.
     */
    if (isComp1 && isComp2) {
        if (area(this.boundable1) > area(this.boundable2)) {
            this.expand(this.boundable1, this.boundable2, priQ, minDistance);
            return;
        } else {
            this.expand(this.boundable2, this.boundable1, priQ, minDistance);
            return;
        }
    } else if (isComp1) {
        this.expand(this.boundable1, this.boundable2, priQ, minDistance);
        return;
    } else if (isComp2) {
        this.expand(this.boundable2, this.boundable1, priQ, minDistance);
        return;
    }

    throw new IllegalArgumentException("neither boundable is composite");
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:34,代码来源:BoundablePair.java


示例2: expand

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private void expand(Boundable bndComposite, Boundable bndOther,
                    PriorityQueue priQ, double minDistance) {
    List children = ((AbstractNode) bndComposite).getChildBoundables();
    for (Object aChildren : children) {
        Boundable child = (Boundable) aChildren;
        BoundablePair bp = new BoundablePair(child, bndOther, this.itemDistance);
        // only add to queue if this pair might contain the closest points
        // MD - it's actually faster to construct the object rather than called distance(child, bndOther)!
        if (bp.getDistance() < minDistance) {
            priQ.add(bp);
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:14,代码来源:BoundablePair.java


示例3: expandToQueue

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
/**
 * For a pair which is not a leaf
 * (i.e. has at least one composite boundable)
 * computes a list of new pairs
 * from the expansion of the larger boundable.
 */
public void expandToQueue(PriorityQueue priQ, double minDistance) {
    boolean isComp1 = isComposite(boundable1);
    boolean isComp2 = isComposite(boundable2);

    /**
     * HEURISTIC: If both boundable are composite,
     * choose the one with largest area to expand.
     * Otherwise, simply expand whichever is composite.
     */
    if (isComp1 && isComp2) {
        if (area(boundable1) > area(boundable2)) {
            expand(boundable1, boundable2, priQ, minDistance);
            return;
        } else {
            expand(boundable2, boundable1, priQ, minDistance);
            return;
        }
    } else if (isComp1) {
        expand(boundable1, boundable2, priQ, minDistance);
        return;
    } else if (isComp2) {
        expand(boundable2, boundable1, priQ, minDistance);
        return;
    }

    throw new IllegalArgumentException("neither boundable is composite");
}
 
开发者ID:Semantive,项目名称:jts,代码行数:34,代码来源:BoundablePair.java


示例4: expand

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private void expand(Boundable bndComposite, Boundable bndOther,
                    PriorityQueue priQ, double minDistance) {
    List children = ((AbstractNode) bndComposite).getChildBoundables();
    for (Iterator i = children.iterator(); i.hasNext(); ) {
        Boundable child = (Boundable) i.next();
        BoundablePair bp = new BoundablePair(child, bndOther, itemDistance);
        // only add to queue if this pair might contain the closest points
        // MD - it's actually faster to construct the object rather than called distance(child, bndOther)!
        if (bp.getDistance() < minDistance) {
            priQ.add(bp);
        }
    }
}
 
开发者ID:Semantive,项目名称:jts,代码行数:14,代码来源:BoundablePair.java


示例5: expandToQueue

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
/**
 * For a pair which is not a leaf 
 * (i.e. has at least one composite boundable)
 * computes a list of new pairs 
 * from the expansion of the larger boundable.
 * 
 */
public void expandToQueue( PriorityQueue priQ, double minDistance ) {
    boolean isComp1 = isComposite(boundable1);
    boolean isComp2 = isComposite(boundable2);

    /**
     * HEURISTIC: If both boundable are composite,
     * choose the one with largest area to expand.
     * Otherwise, simply expand whichever is composite.
     */
    if (isComp1 && isComp2) {
        if (area(boundable1) > area(boundable2)) {
            expand(boundable1, boundable2, priQ, minDistance);
            return;
        } else {
            expand(boundable2, boundable1, priQ, minDistance);
            return;
        }
    } else if (isComp1) {
        expand(boundable1, boundable2, priQ, minDistance);
        return;
    } else if (isComp2) {
        expand(boundable2, boundable1, priQ, minDistance);
        return;
    }

    throw new IllegalArgumentException("neither boundable is composite");
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:35,代码来源:BoundablePair.java


示例6: expand

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private void expand( Boundable bndComposite, Boundable bndOther, PriorityQueue priQ, double minDistance ) {
    List children = ((AbstractNode) bndComposite).getChildBoundables();
    for( Iterator i = children.iterator(); i.hasNext(); ) {
        Boundable child = (Boundable) i.next();
        BoundablePair bp = new BoundablePair(child, bndOther, itemDistance);
        // only add to queue if this pair might contain the closest points
        // MD - it's actually faster to construct the object rather than called distance(child,
        // bndOther)!
        if (bp.getDistance() < minDistance) {
            priQ.add(bp);
        }
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:14,代码来源:BoundablePair.java


示例7: expandToQueue

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
/**
 * For a pair which is not a leaf 
 * (i.e. has at least one composite boundable)
 * computes a list of new pairs 
 * from the expansion of the larger boundable.
 * 
 * @return a List of new pairs
 */
public void expandToQueue(PriorityQueue priQ, double minDistance)
{
  boolean isComp1 = isComposite(boundable1);
  boolean isComp2 = isComposite(boundable2);
  
  /**
   * HEURISTIC: If both boundable are composite,
   * choose the one with largest area to expand.
   * Otherwise, simply expand whichever is composite.
   */
  if (isComp1 && isComp2) {
    if (area(boundable1) > area(boundable2)) {
      expand(boundable1, boundable2, priQ, minDistance);
      return;
    }
    else {
      expand(boundable2, boundable1, priQ, minDistance);
      return;
    }
  }
  else if (isComp1) {
    expand(boundable1, boundable2, priQ, minDistance);
    return;
  }
  else if (isComp2) {
    expand(boundable2, boundable1, priQ, minDistance);
    return;
  }
  
  throw new IllegalArgumentException("neither boundable is composite");
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:40,代码来源:BoundablePair.java


示例8: expand

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private void expand(Boundable bndComposite, Boundable bndOther,
    PriorityQueue priQ, double minDistance)
{
  List children = ((AbstractNode) bndComposite).getChildBoundables();
  for (Iterator i = children.iterator(); i.hasNext(); ) {
    Boundable child = (Boundable) i.next();
    BoundablePair bp = new BoundablePair(child, bndOther, itemDistance);
    // only add to queue if this pair might contain the closest points
    // MD - it's actually faster to construct the object rather than called distance(child, bndOther)!
    if (bp.getDistance() < minDistance) {
      priQ.add(bp);
    }
  }
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:15,代码来源:BoundablePair.java


示例9: expandToQueue

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
/**
 * For a pair which is not a leaf 
 * (i.e. has at least one composite boundable)
 * computes a list of new pairs 
 * from the expansion of the larger boundable.
 * 
 */
public void expandToQueue(PriorityQueue priQ, double minDistance)
{
  boolean isComp1 = isComposite(boundable1);
  boolean isComp2 = isComposite(boundable2);
  
  /**
   * HEURISTIC: If both boundable are composite,
   * choose the one with largest area to expand.
   * Otherwise, simply expand whichever is composite.
   */
  if (isComp1 && isComp2) {
    if (area(boundable1) > area(boundable2)) {
      expand(boundable1, boundable2, priQ, minDistance);
      return;
    }
    else {
      expand(boundable2, boundable1, priQ, minDistance);
      return;
    }
  }
  else if (isComp1) {
    expand(boundable1, boundable2, priQ, minDistance);
    return;
  }
  else if (isComp2) {
    expand(boundable2, boundable1, priQ, minDistance);
    return;
  }
  
  throw new IllegalArgumentException("neither boundable is composite");
}
 
开发者ID:Jules-,项目名称:terraingis,代码行数:39,代码来源:BoundablePair.java


示例10: nearestNeighbour

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private Object[] nearestNeighbour(BoundablePair initBndPair, double maxDistance) {
    double distanceLowerBound = maxDistance;
    BoundablePair minPair = null;

    // initialize internal structures
    PriorityQueue priQ = new PriorityQueue();

    // initialize queue
    priQ.add(initBndPair);

    while (!priQ.isEmpty() && distanceLowerBound > 0.0) {
        // pop head of queue and expand one side of pair
        BoundablePair bndPair = (BoundablePair) priQ.poll();
        double currentDistance = bndPair.getDistance();

        /**
         * If the distance for the first node in the queue
         * is >= the current minimum distance, all other nodes
         * in the queue must also have a greater distance.
         * So the current minDistance must be the true minimum,
         * and we are done.
         */
        if (currentDistance >= distanceLowerBound) {
            break;
        }

        /**
         * If the pair members are leaves
         * then their distance is the exact lower bound.
         * Update the distanceLowerBound to reflect this
         * (which must be smaller, due to the test
         * immediately prior to this).
         */
        if (bndPair.isLeaves()) {
            // assert: currentDistance < minimumDistanceFound
            distanceLowerBound = currentDistance;
            minPair = bndPair;
        } else {
            // testing - does allowing a tolerance improve speed?
            // Ans: by only about 10% - not enough to matter
    /*
    double maxDist = bndPair.getMaximumDistance();
    if (maxDist * .99 < lastComputedDistance) 
      return;
    //*/

            /**
             * Otherwise, expand one side of the pair,
             * (the choice of which side to expand is heuristically determined)
             * and insert the new expanded pairs into the queue
             */
            bndPair.expandToQueue(priQ, distanceLowerBound);
        }
    }
    // done - return items with min distance
    return new Object[] {
            ((ItemBoundable) minPair.getBoundable(0)).getItem(),
            ((ItemBoundable) minPair.getBoundable(1)).getItem()
    };
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:61,代码来源:STRtree.java


示例11: nearestNeighbour

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private Object[] nearestNeighbour(BoundablePair initBndPair, double maxDistance) {
    double distanceLowerBound = maxDistance;
    BoundablePair minPair = null;

    // initialize internal structures
    PriorityQueue priQ = new PriorityQueue();

    // initialize queue
    priQ.add(initBndPair);

    while (!priQ.isEmpty() && distanceLowerBound > 0.0) {
        // pop head of queue and expand one side of pair
        BoundablePair bndPair = (BoundablePair) priQ.poll();
        double currentDistance = bndPair.getDistance();

        /**
         * If the distance for the first node in the queue
         * is >= the current minimum distance, all other nodes
         * in the queue must also have a greater distance.
         * So the current minDistance must be the true minimum,
         * and we are done.
         */
        if (currentDistance >= distanceLowerBound)
            break;

        /**
         * If the pair members are leaves
         * then their distance is the exact lower bound.
         * Update the distanceLowerBound to reflect this
         * (which must be smaller, due to the test
         * immediately prior to this).
         */
        if (bndPair.isLeaves()) {
            // assert: currentDistance < minimumDistanceFound
            distanceLowerBound = currentDistance;
            minPair = bndPair;
        } else {
            // testing - does allowing a tolerance improve speed?
            // Ans: by only about 10% - not enough to matter
    /*
    double maxDist = bndPair.getMaximumDistance();
    if (maxDist * .99 < lastComputedDistance) 
      return;
    //*/

            /**
             * Otherwise, expand one side of the pair,
             * (the choice of which side to expand is heuristically determined)
             * and insert the new expanded pairs into the queue
             */
            bndPair.expandToQueue(priQ, distanceLowerBound);
        }
    }
    // done - return items with min distance
    return new Object[]{
            ((ItemBoundable) minPair.getBoundable(0)).getItem(),
            ((ItemBoundable) minPair.getBoundable(1)).getItem()
    };
}
 
开发者ID:Semantive,项目名称:jts,代码行数:60,代码来源:STRtree.java


示例12: nearestNeighbour

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private Object[] nearestNeighbour( BoundablePair initBndPair, double maxDistance ) {
    double distanceLowerBound = maxDistance;
    BoundablePair minPair = null;

    // initialize internal structures
    PriorityQueue priQ = new PriorityQueue();

    // initialize queue
    priQ.add(initBndPair);

    while( !priQ.isEmpty() && distanceLowerBound > 0.0 ) {
        // pop head of queue and expand one side of pair
        BoundablePair bndPair = (BoundablePair) priQ.poll();
        double currentDistance = bndPair.getDistance();

        /**
         * If the distance for the first node in the queue
         * is >= the current minimum distance, all other nodes
         * in the queue must also have a greater distance.
         * So the current minDistance must be the true minimum,
         * and we are done.
         */
        if (currentDistance >= distanceLowerBound)
            break;

        /**
         * If the pair members are leaves
         * then their distance is the exact lower bound.
         * Update the distanceLowerBound to reflect this
         * (which must be smaller, due to the test 
         * immediately prior to this). 
         */
        if (bndPair.isLeaves()) {
            // assert: currentDistance < minimumDistanceFound
            distanceLowerBound = currentDistance;
            minPair = bndPair;
        } else {
            // testing - does allowing a tolerance improve speed?
            // Ans: by only about 10% - not enough to matter
            /*
            double maxDist = bndPair.getMaximumDistance();
            if (maxDist * .99 < lastComputedDistance) 
              return;
            //*/

            /**
             * Otherwise, expand one side of the pair,
             * (the choice of which side to expand is heuristically determined) 
             * and insert the new expanded pairs into the queue
             */
            bndPair.expandToQueue(priQ, distanceLowerBound);
        }
    }
    // done - return items with min distance
    return new Object[]{((ItemBoundable) minPair.getBoundable(0)).getItem(),
            ((ItemBoundable) minPair.getBoundable(1)).getItem()};
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:58,代码来源:STRtreeJGT.java


示例13: nearestNeighbour

import com.vividsolutions.jts.util.PriorityQueue; //导入依赖的package包/类
private Object[] nearestNeighbour(BoundablePair initBndPair, double maxDistance) 
{
  double distanceLowerBound = maxDistance;
  BoundablePair minPair = null;
  
  // initialize internal structures
  PriorityQueue priQ = new PriorityQueue();

  // initialize queue
  priQ.add(initBndPair);

  while (! priQ.isEmpty() && distanceLowerBound > 0.0) {
    // pop head of queue and expand one side of pair
    BoundablePair bndPair = (BoundablePair) priQ.poll();
    double currentDistance = bndPair.getDistance();
    
    /**
     * If the distance for the first node in the queue
     * is >= the current minimum distance, all other nodes
     * in the queue must also have a greater distance.
     * So the current minDistance must be the true minimum,
     * and we are done.
     */
    if (currentDistance >= distanceLowerBound) 
      break;  

    /**
     * If the pair members are leaves
     * then their distance is the exact lower bound.
     * Update the distanceLowerBound to reflect this
     * (which must be smaller, due to the test 
     * immediately prior to this). 
     */
    if (bndPair.isLeaves()) {
      // assert: currentDistance < minimumDistanceFound
      distanceLowerBound = currentDistance;
      minPair = bndPair;
    }
    else {
      // testing - does allowing a tolerance improve speed?
      // Ans: by only about 10% - not enough to matter
      /*
      double maxDist = bndPair.getMaximumDistance();
      if (maxDist * .99 < lastComputedDistance) 
        return;
      //*/

      /**
       * Otherwise, expand one side of the pair,
       * (the choice of which side to expand is heuristically determined) 
       * and insert the new expanded pairs into the queue
       */
      bndPair.expandToQueue(priQ, distanceLowerBound);
    }
  }
  // done - return items with min distance
  return new Object[] {    
        ((ItemBoundable) minPair.getBoundable(0)).getItem(),
        ((ItemBoundable) minPair.getBoundable(1)).getItem()
    };
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:62,代码来源:STRtree.java



注:本文中的com.vividsolutions.jts.util.PriorityQueue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VariableDeclaration类代码示例发布时间:2022-05-22
下一篇:
Java FrameRecorder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap