Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/***************************************
 *            ViPER                    *
 *  The Video Processing               *
 *         Evaluation Resource         *
 *                                     *
 *  Distributed under the GPL license  *
 *        Terms available at gnu.org.  *
 *                                     *
 *  Copyright University of Maryland,  *
 *                      College Park.  *
 ***************************************/

import java.util.*;
import org.w3c.dom.*;

public class Main {
    /**
     * Converts a w3c DOM nodelist into an iterator.
     * @param nl the node list
     * @return the iterator wrapping the list of DOM nodes
     */
    public static Iterator nodeList2Iterator(final NodeList nl) {
        final int[] i = new int[] { 0 };
        return new Iterator() {
            public boolean hasNext() {
                return i[0] < nl.getLength();
            }

            public Object next() {
                return nl.item(i[0]++);
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
}