本文整理汇总了Java中edu.stanford.nlp.util.FixedPrioritiesPriorityQueue.next方法的典型用法代码示例。如果您正苦于以下问题:Java FixedPrioritiesPriorityQueue.next方法的具体用法?Java FixedPrioritiesPriorityQueue.next怎么用?Java FixedPrioritiesPriorityQueue.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.util.FixedPrioritiesPriorityQueue
的用法示例。
在下文中一共展示了FixedPrioritiesPriorityQueue.next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asCounter
import edu.stanford.nlp.util.FixedPrioritiesPriorityQueue; //导入方法依赖的package包/类
/**
* Returns a counter whose keys are the elements in this priority queue, and
* whose counts are the priorities in this queue. In the event there are
* multiple instances of the same element in the queue, the counter's count
* will be the sum of the instances' priorities.
*
*/
public static <E> Counter<E> asCounter(FixedPrioritiesPriorityQueue<E> p) {
FixedPrioritiesPriorityQueue<E> pq = p.clone();
ClassicCounter<E> counter = new ClassicCounter<E>();
while (pq.hasNext()) {
double priority = pq.getPriority();
E element = pq.next();
counter.incrementCount(element, priority);
}
return counter;
}
示例2: asCounter
import edu.stanford.nlp.util.FixedPrioritiesPriorityQueue; //导入方法依赖的package包/类
/**
* Returns a counter whose keys are the elements in this priority queue, and
* whose counts are the priorities in this queue. In the event there are
* multiple instances of the same element in the queue, the counter's count
* will be the sum of the instances' priorities.
*
*/
public static <E> Counter<E> asCounter(FixedPrioritiesPriorityQueue<E> p) {
FixedPrioritiesPriorityQueue<E> pq = p.clone();
ClassicCounter<E> counter = new ClassicCounter<E>();
while (pq.hasNext()) {
double priority = pq.getPriority();
E element = pq.next();
counter.incrementCount(element, priority);
}
return counter;
}