001    /*
002     * Copyright 2007 - 2007 JEuclid, http://jeuclid.sf.net
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    /* $Id: MathMLNodeListImpl.java,v 8afef6dd0d58 2007/09/14 08:29:58 maxberger $ */
018    
019    package net.sourceforge.jeuclid.elements.support;
020    
021    import java.util.List;
022    
023    import org.w3c.dom.Node;
024    import org.w3c.dom.mathml.MathMLNodeList;
025    
026    /**
027     * Implements a MathMLNodeList based on a java.util.List.
028     * 
029     * @version $Revision: 8afef6dd0d58 $
030     */
031    public class MathMLNodeListImpl implements MathMLNodeList {
032    
033        private final List<Node> nodeList;
034    
035        /**
036         * create a new MathMLNodeList based on a given java list of nodes.
037         * 
038         * @param list
039         *            the list of nodes.
040         */
041        public MathMLNodeListImpl(final List<Node> list) {
042            this.nodeList = list;
043        }
044    
045        /** {@inheritDoc} */
046        public int getLength() {
047            return this.nodeList.size();
048        }
049    
050        /** {@inheritDoc} */
051        public Node item(final int arg0) {
052            return this.nodeList.get(arg0);
053        }
054    
055    }