本文整理汇总了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;
}
示例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;
}