本文整理汇总了Java中org.apache.commons.collections.Buffer类的典型用法代码示例。如果您正苦于以下问题:Java Buffer类的具体用法?Java Buffer怎么用?Java Buffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Buffer类属于org.apache.commons.collections包,在下文中一共展示了Buffer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doGet
import org.apache.commons.collections.Buffer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws
ServletException, IOException {
StringBuffer sb = new StringBuffer();
Buffer nl = NotificationList.getInstance().getNotifications();
Iterator<String> it = nl.iterator();
while (it.hasNext()) {
String notification = (String) it.next();
sb.append(notification);
}
nl.clear();
PrintWriter out = response.getWriter();
out.println(sb.toString());
}
开发者ID:apache,项目名称:juddi,代码行数:17,代码来源:NotifyServlet.java
示例2: main
import org.apache.commons.collections.Buffer; //导入依赖的package包/类
public static void main(String[] args) {
Driver driver = new Driver();
Driver.DataRate imuFreq = Driver.DataRate.FREQ_476_HZ;
driver.setAccelerometerScale(Driver.AccelerometerScale.SCALE_PLUS_MINUS_2G);
driver.setDatarate(imuFreq);
driver.setUseFifoBuffer(true);
AsyncPollingHelper helper = new AsyncPollingHelper(driver);
try {
helper.beginPolling();
Thread.sleep(2500);
System.out.println("***Fetching data first 2.5 seconds***");
Buffer buffer = helper.getFifo();
while(!buffer.isEmpty()){
System.out.println(buffer.remove().toString());
}
Thread.sleep(2500);
System.out.println("***Fetching data second 2.5 seconds***");
while(!buffer.isEmpty()){
System.out.println(buffer.remove().toString());
}
helper.endPolling();
System.out.println("***Fetching final data***");
while(!buffer.isEmpty()){
System.out.println(buffer.remove().toString());
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
开发者ID:soblenes32,项目名称:LSM9DS1-Pi4j-Driver,代码行数:35,代码来源:AsyncPollingHelperTest.java
示例3: extract
import org.apache.commons.collections.Buffer; //导入依赖的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
示例4: getFifo
import org.apache.commons.collections.Buffer; //导入依赖的package包/类
public Buffer getFifo() {
return fifo;
}
开发者ID:soblenes32,项目名称:LSM9DS1-Pi4j-Driver,代码行数:4,代码来源:AsyncPollingHelper.java
示例5: getNotifications
import org.apache.commons.collections.Buffer; //导入依赖的package包/类
public Buffer getNotifications() {
return list;
}
开发者ID:apache,项目名称:juddi,代码行数:4,代码来源:NotificationList.java
示例6: setQueue
import org.apache.commons.collections.Buffer; //导入依赖的package包/类
/**
* Sets the queue of tasks.
*
* @param queue blocking queue of tasks.
*/
public void setQueue(Buffer queue) {
this.tasksQueue = queue;
}
开发者ID:nikos,项目名称:informa,代码行数:9,代码来源:WorkerThread.java
注:本文中的org.apache.commons.collections.Buffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论