Clover coverage report - Code Coverage for hivemind release 1.1-beta-1
Coverage timestamp: Thu Apr 28 2005 19:53:41 EDT
file stats: LOC: 129   Methods: 11
NCLOC: 81   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ElementModelImpl.java 83.3% 96.3% 100% 92.9%
coverage 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.hivemind.schema.impl;
 16   
 
 17   
 import java.util.ArrayList;
 18   
 import java.util.Collections;
 19   
 import java.util.Iterator;
 20   
 import java.util.List;
 21   
 
 22   
 import org.apache.hivemind.schema.AttributeModel;
 23   
 import org.apache.hivemind.schema.ElementModel;
 24   
 import org.apache.hivemind.schema.Rule;
 25   
 
 26   
 /**
 27   
  * Implementation of {@link org.apache.hivemind.schema.ElementModel}.
 28   
  * 
 29   
  * @author Howard Lewis Ship
 30   
  */
 31   
 public class ElementModelImpl extends SchemaImpl implements ElementModel
 32   
 {
 33   
     private String _elementName;
 34   
 
 35   
     private List _attributeModels;
 36   
 
 37   
     private List _shareableAttributeModels;
 38   
 
 39   
     private String _keyAttribute;
 40   
 
 41   
     private List _rules;
 42   
 
 43   
     private List _shareableRules;
 44   
 
 45   
     private String _contentTranslator;
 46   
 
 47  9969
     public String getElementName()
 48   
     {
 49  9969
         return _elementName;
 50   
     }
 51   
 
 52  3779
     public void setElementName(String string)
 53   
     {
 54  3779
         _elementName = string;
 55   
     }
 56   
 
 57  4755
     public void addAttributeModel(AttributeModel attributeModel)
 58   
     {
 59  4755
         if (_attributeModels == null)
 60  1980
             _attributeModels = new ArrayList();
 61   
 
 62  4755
         _attributeModels.add(attributeModel);
 63  4755
         _shareableAttributeModels = null;
 64   
     }
 65   
 
 66  10452
     public List getAttributeModels()
 67   
     {
 68  10452
         if (_shareableAttributeModels == null)
 69  3386
             _shareableAttributeModels = _attributeModels == null ? Collections.EMPTY_LIST
 70   
                     : Collections.unmodifiableList(_attributeModels);
 71   
 
 72  10452
         return _shareableAttributeModels;
 73   
     }
 74   
 
 75  120
     public AttributeModel getAttributeModel(String name)
 76   
     {
 77  120
         if (_attributeModels == null)
 78  1
             return null;
 79   
 
 80  119
         for (Iterator i = _attributeModels.iterator(); i.hasNext();)
 81   
         {
 82  119
             AttributeModel am = (AttributeModel) i.next();
 83   
 
 84  119
             if (am.getName().equals(name))
 85  119
                 return am;
 86   
         }
 87   
 
 88  0
         return null;
 89   
     }
 90   
 
 91  3775
     public void setKeyAttribute(String keyAttribute)
 92   
     {
 93  3775
         _keyAttribute = keyAttribute;
 94   
     }
 95   
 
 96  13090
     public String getKeyAttribute()
 97   
     {
 98  13090
         return _keyAttribute;
 99   
     }
 100   
 
 101  13880
     public void addRule(Rule rule)
 102   
     {
 103  13880
         if (_rules == null)
 104  3767
             _rules = new ArrayList();
 105   
 
 106  13880
         _rules.add(rule);
 107  13880
         _shareableRules = null;
 108   
     }
 109   
 
 110  6972
     public List getRules()
 111   
     {
 112  6972
         if (_shareableRules == null)
 113  904
             _shareableRules = _rules == null ? Collections.EMPTY_LIST : Collections
 114   
                     .unmodifiableList(_rules);
 115   
 
 116  6972
         return _shareableRules;
 117   
     }
 118   
 
 119  16
     public String getContentTranslator()
 120   
     {
 121  16
         return _contentTranslator;
 122   
     }
 123   
 
 124  3775
     public void setContentTranslator(String string)
 125   
     {
 126  3775
         _contentTranslator = string;
 127   
     }
 128   
 
 129   
 }