Clover coverage report - Code Coverage for tapestry-contrib release 4.0-beta-12
Coverage timestamp: Sun Oct 30 2005 16:28:27 EST
file stats: LOC: 109   Methods: 14
NCLOC: 63   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TreeNode.java 0% 0% 0% 0%
coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.tapestry.contrib.tree.simple;
 16   
 17    import java.util.Collection;
 18    import java.util.HashSet;
 19    import java.util.Iterator;
 20    import java.util.Set;
 21   
 22    import org.apache.tapestry.contrib.tree.model.IMutableTreeNode;
 23    import org.apache.tapestry.contrib.tree.model.ITreeNode;
 24   
 25    /**
 26    * @author ceco
 27    */
 28    public class TreeNode implements IMutableTreeNode
 29    {
 30    private static final long serialVersionUID = 677919478017303186L;
 31   
 32    protected Set m_setChildren;
 33    protected IMutableTreeNode m_objParentNode;
 34   
 35    /**
 36    * Constructor for TreeNode.
 37    */
 38  0 public TreeNode() {
 39  0 this(null);
 40    }
 41  0 public TreeNode(IMutableTreeNode parentNode) {
 42  0 super();
 43  0 m_objParentNode = parentNode;
 44  0 m_setChildren = new HashSet();
 45    }
 46   
 47   
 48  0 public int getChildCount() {
 49  0 return m_setChildren.size();
 50    }
 51   
 52  0 public ITreeNode getParent() {
 53  0 return m_objParentNode;
 54    }
 55   
 56  0 public boolean getAllowsChildren() {
 57  0 return true;
 58    }
 59   
 60  0 public boolean isLeaf() {
 61  0 return m_setChildren.size() == 0 ? true:false;
 62    }
 63   
 64  0 public Collection children() {
 65  0 return m_setChildren;
 66    }
 67   
 68   
 69  0 public void insert(IMutableTreeNode child) {
 70  0 child.setParent(this);
 71  0 m_setChildren.add(child);
 72    }
 73   
 74  0 public void remove(IMutableTreeNode node) {
 75  0 m_setChildren.remove(node);
 76    }
 77   
 78  0 public void removeFromParent() {
 79  0 m_objParentNode.remove(this);
 80  0 m_objParentNode = null;
 81    }
 82   
 83  0 public void setParent(IMutableTreeNode newParent) {
 84  0 m_objParentNode = newParent;
 85    }
 86   
 87  0 public void insert(Collection colChildren){
 88  0 for (Iterator iter = colChildren.iterator(); iter.hasNext();) {
 89  0 IMutableTreeNode element = (IMutableTreeNode) iter.next();
 90  0 element.setParent(this);
 91  0 m_setChildren.add(element);
 92    }
 93    }
 94   
 95    /**
 96    * @see org.apache.tapestry.contrib.tree.model.ITreeNode#containsChild(ITreeNode)
 97    */
 98  0 public boolean containsChild(ITreeNode node) {
 99  0 return m_setChildren.contains(node);
 100    }
 101   
 102    /**
 103    * @see org.apache.tapestry.contrib.tree.model.ITreeNode#getChildren()
 104    */
 105  0 public Collection getChildren() {
 106  0 return m_setChildren;
 107    }
 108   
 109    }