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-2012, 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  
 package org.yaml.snakeyaml.nodes;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import org.yaml.snakeyaml.error.Mark;
 21  
 
 22  
 /**
 23  
  * Represents a sequence.
 24  
  * <p>
 25  
  * A sequence is a ordered collection of nodes.
 26  
  * </p>
 27  
  */
 28  
 public class SequenceNode extends CollectionNode {
 29  
     final private List<Node> value;
 30  
 
 31  
     public SequenceNode(Tag tag, boolean resolved, List<Node> value, Mark startMark, Mark endMark,
 32  
             Boolean flowStyle) {
 33  27136
         super(tag, startMark, endMark, flowStyle);
 34  27136
         if (value == null) {
 35  1
             throw new NullPointerException("value in a Node is required.");
 36  
         }
 37  27135
         this.value = value;
 38  27135
         this.resolved = resolved;
 39  27135
     }
 40  
 
 41  
     public SequenceNode(Tag tag, List<Node> value, Boolean flowStyle) {
 42  16228
         this(tag, true, value, null, null, flowStyle);
 43  16228
     }
 44  
 
 45  
     @Override
 46  
     public NodeId getNodeId() {
 47  97514
         return NodeId.sequence;
 48  
     }
 49  
 
 50  
     /**
 51  
      * Returns the elements in this sequence.
 52  
      * 
 53  
      * @return Nodes in the specified order.
 54  
      */
 55  
     public List<Node> getValue() {
 56  70331
         return value;
 57  
     }
 58  
 
 59  
     public void setListType(Class<? extends Object> listType) {
 60  105
         for (Node node : value) {
 61  196
             node.setType(listType);
 62  
         }
 63  105
     }
 64  
 
 65  
     public String toString() {
 66  3
         return "<" + this.getClass().getName() + " (tag=" + getTag() + ", value=" + getValue()
 67  
                 + ")>";
 68  
     }
 69  
 }