Coverage Report - org.simpleframework.xml.stream.InputStack
 
Classes in this File Line Coverage Branch Coverage Complexity
InputStack
100%
3/3
100%
4/4
1.5
 
 1  
 /*
 2  
  * InputStack.java July 2006
 3  
  *
 4  
  * Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net>
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 15  
  * implied. See the License for the specific language governing 
 16  
  * permissions and limitations under the License.
 17  
  */
 18  
 
 19  
 package org.simpleframework.xml.stream;
 20  
 
 21  
 /**
 22  
  * The <code>InputStack</code> is used to keep track of the nodes 
 23  
  * that have been read from the document. This ensures that when
 24  
  * nodes are read from the source document that the reader can tell
 25  
  * whether a child node for a given <code>InputNode</code> can be
 26  
  * created. Each created node is pushed, and popped when ended.
 27  
  *
 28  
  * @author Niall Gallagher
 29  
  *
 30  
  * @see org.simpleframework.xml.stream.InputNode
 31  
  */ 
 32  
 class InputStack extends Stack<InputNode> {
 33  
 
 34  
    /**
 35  
     * Constructor for the <code>InputStack</code> object. This is
 36  
     * used to create a stack that can be used to keep track of the
 37  
     * elements that have been read from the source XML document.
 38  
     */         
 39  
    public InputStack() {
 40  74073
       super(6);
 41  74073
    }
 42  
    
 43  
    /**
 44  
     * This is used to determine if the specified node is relevant
 45  
     * with respect to the state of the input stack. This returns
 46  
     * true if there are no elements in the stack, which accounts
 47  
     * for a new root node. Also this returns true if the specified
 48  
     * node exists within the stack and is thus an active node.
 49  
     * 
 50  
     * @param value this is the input node value to be checked
 51  
     * 
 52  
     * @return returns true if the node is relevant in the stack
 53  
     */
 54  
    public boolean isRelevant(InputNode value) {
 55  3603059
       return contains(value) || isEmpty();
 56  
    }
 57  
 }