Example usage for org.apache.commons.collections Buffer iterator

List of usage examples for org.apache.commons.collections Buffer iterator

Introduction

In this page you can find the example usage for org.apache.commons.collections Buffer iterator.

Prototype

Iterator<E> iterator();

Source Link

Document

Returns an iterator over the elements in this collection.

Usage

From source file:edu.polyu.vad.VAD.java

public static boolean detect(Buffer buf, int mode, double threshold) {
    int numFrames = buf.size();
    double energy[] = new double[numFrames];
    Iterator<double[]> it = buf.iterator();
    int n = 0;/*  ww w .j a  va  2  s. c  o m*/
    while (it.hasNext()) {
        energy[n++] = it.next()[0];
    }
    return detect(energy, mode, threshold);
}

From source file:edu.polyu.vad.VAD.java

private double[] getEnergyProfile(Buffer buf) {
    int numFrames = buf.size();
    double energy[] = new double[numFrames];
    Iterator<double[]> it = buf.iterator();
    int n = 0;//from w ww  .j a v a2s .c o  m
    while (it.hasNext()) {
        energy[n++] = it.next()[0];
    }
    return energy;
}

From source file:org.apache.juddi.servlets.NotifyServlet.java

@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);//from w w w .  ja v  a  2  s.c o  m
    }
    nl.clear();
    PrintWriter out = response.getWriter();
    out.println(sb.toString());
}

From source file:org.xwiki.ircbot.internal.BrokenLinksBotListener.java

@Override
public void onMessage(MessageEvent<T> event) throws Exception {
    if (event.getMessage().startsWith(COMMAND)) {
        Buffer latestBrokenLinks = ((BrokenLinkEventListener) this.brokenLinkEventListener)
                .getLastBrokenLinks();/*  w  ww  . j  a v  a2 s.co m*/
        if (latestBrokenLinks.size() > 0) {
            event.respond("Latest broken links:");
            Iterator it = latestBrokenLinks.iterator();
            while (it.hasNext()) {
                Map<String, Object> linkData = (Map<String, Object>) it.next();
                String linkURL = (String) linkData.get("url");
                String linkSource = (String) linkData.get("source");
                LinkState linkState = (LinkState) linkData.get("state");
                int responseCode = linkState.getResponseCode();

                String message = String.format("%s on page %s (code = %s)", linkURL, linkSource, responseCode);
                event.respond(message);
            }
        } else {
            event.respond("No broken links found so far or the Link Checker transformation is not active...");
        }
    }
}