当前位置: 首页>>代码示例>>Java>>正文


Java UnboundedFifoBuffer类代码示例

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


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

示例1: initialize

import org.apache.commons.collections.buffer.UnboundedFifoBuffer; //导入依赖的package包/类
public boolean initialize (  ) {
  AddressBean addressBean =getActiveAddressBean ( );
  //  TODO: negative values?
  timer = new Timer(  addressBean.getPredicateValueAsInt( CLOCK_PERIOD_KEY ,DEFAULT_CLOCK_PERIODS) , this );
  maximumDelay = addressBean.getPredicateValueAsInt(MAX_DELAY_KEY, DEFAULT_MAX_DELAY);
  if(maximumDelay > 0){
  	streamElementBuffer = SynchronizedBuffer.decorate(new UnboundedFifoBuffer());
  	delayPostingElements = true;
  	if(timer.getDelay() < maximumDelay)
  		logger.warn("Maximum delay is greater than element production interval. Running for a long time may lead to an OutOfMemoryException" );
  }
  return true;
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:14,代码来源:SystemTime.java

示例2: extract

import org.apache.commons.collections.buffer.UnboundedFifoBuffer; //导入依赖的package包/类
/**
 * Extracts the weak components from a graph.
 * @param aGraph the graph whose weak components are to be extracted
 * @return the list of weak components
 */
public ClusterSet extract(ArchetypeGraph aGraph) {

    ClusterSet clusterSet = new VertexClusterSet(aGraph);

    HashSet unvisitedVertices = new HashSet();
    for (Iterator vIt=aGraph.getVertices().iterator(); vIt.hasNext();) {
        unvisitedVertices.add(vIt.next());
    }

    while (!unvisitedVertices.isEmpty()) {
        Set weakComponentSet = new HashSet();
        ArchetypeVertex root = (ArchetypeVertex) unvisitedVertices.iterator().next();
        unvisitedVertices.remove(root);
        weakComponentSet.add(root);

        Buffer queue = new UnboundedFifoBuffer();
        queue.add(root);

        while (!queue.isEmpty()) {
            ArchetypeVertex currentVertex = (ArchetypeVertex) queue.remove();
            Set neighbors = currentVertex.getNeighbors();

            for (Iterator nIt = neighbors.iterator(); nIt.hasNext();) {
                ArchetypeVertex neighbor = (ArchetypeVertex) nIt.next();
                if (unvisitedVertices.contains(neighbor)) {
                    queue.add(neighbor);
                    unvisitedVertices.remove(neighbor);
                    weakComponentSet.add(neighbor);
                }
            }
        }
        clusterSet.addCluster(weakComponentSet);
    }

    return clusterSet;
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:42,代码来源:WeakComponentClusterer.java


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