Coverage Report - org.yaml.snakeyaml.nodes.SequenceNode
 
Classes in this File Line Coverage Branch Coverage Complexity
SequenceNode
100%
14/14
100%
4/4
1.5
 
 1  
 /**
 2  
  * Copyright (c) 2008-2011, http://www.snakeyaml.org
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.yaml.snakeyaml.nodes;
 18  
 
 19  
 import java.util.List;
 20  
 
 21  
 import org.yaml.snakeyaml.error.Mark;
 22  
 
 23  
 /**
 24  
  * Represents a sequence.
 25  
  * <p>
 26  
  * A sequence is a ordered collection of nodes.
 27  
  * </p>
 28  
  */
 29  
 public class SequenceNode extends CollectionNode {
 30  
     final private List<Node> value;
 31  
 
 32  
     public SequenceNode(Tag tag, boolean resolved, List<Node> value, Mark startMark, Mark endMark,
 33  
             Boolean flowStyle) {
 34  27126
         super(tag, startMark, endMark, flowStyle);
 35  27126
         if (value == null) {
 36  1
             throw new NullPointerException("value in a Node is required.");
 37  
         }
 38  27125
         this.value = value;
 39  27125
         this.resolved = resolved;
 40  27125
     }
 41  
 
 42  
     public SequenceNode(Tag tag, List<Node> value, Boolean flowStyle) {
 43  16224
         this(tag, true, value, null, null, flowStyle);
 44  16224
     }
 45  
 
 46  
     @Override
 47  
     public NodeId getNodeId() {
 48  97484
         return NodeId.sequence;
 49  
     }
 50  
 
 51  
     /**
 52  
      * Returns the elements in this sequence.
 53  
      * 
 54  
      * @return Nodes in the specified order.
 55  
      */
 56  
     public List<Node> getValue() {
 57  70310
         return value;
 58  
     }
 59  
 
 60  
     public void setListType(Class<? extends Object> listType) {
 61  102
         for (Node node : value) {
 62  182
             node.setType(listType);
 63  
         }
 64  102
     }
 65  
 
 66  
     public String toString() {
 67  3
         return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue()
 68  
                 + ")>";
 69  
     }
 70  
 }