Clover coverage report - Code Coverage for hivemind release 1.1
Coverage timestamp: Tue Oct 25 2005 10:47:07 EDT
file stats: LOC: 129   Methods: 11
NCLOC: 81   Classes: 1
 
 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  10641 public String getElementName()
 48    {
 49  10641 return _elementName;
 50    }
 51   
 52  3999 public void setElementName(String string)
 53    {
 54  3999 _elementName = string;
 55    }
 56   
 57  5030 public void addAttributeModel(AttributeModel attributeModel)
 58    {
 59  5030 if (_attributeModels == null)
 60  2093 _attributeModels = new ArrayList();
 61   
 62  5030 _attributeModels.add(attributeModel);
 63  5030 _shareableAttributeModels = null;
 64    }
 65   
 66  11153 public List getAttributeModels()
 67    {
 68  11153 if (_shareableAttributeModels == null)
 69  3584 _shareableAttributeModels = _attributeModels == null ? Collections.EMPTY_LIST
 70    : Collections.unmodifiableList(_attributeModels);
 71   
 72  11153 return _shareableAttributeModels;
 73    }
 74   
 75  127 public AttributeModel getAttributeModel(String name)
 76    {
 77  127 if (_attributeModels == null)
 78  1 return null;
 79   
 80  126 for (Iterator i = _attributeModels.iterator(); i.hasNext();)
 81    {
 82  126 AttributeModel am = (AttributeModel) i.next();
 83   
 84  126 if (am.getName().equals(name))
 85  126 return am;
 86    }
 87   
 88  0 return null;
 89    }
 90   
 91  3995 public void setKeyAttribute(String keyAttribute)
 92    {
 93  3995 _keyAttribute = keyAttribute;
 94    }
 95   
 96  13956 public String getKeyAttribute()
 97    {
 98  13956 return _keyAttribute;
 99    }
 100   
 101  14689 public void addRule(Rule rule)
 102    {
 103  14689 if (_rules == null)
 104  3987 _rules = new ArrayList();
 105   
 106  14689 _rules.add(rule);
 107  14689 _shareableRules = null;
 108    }
 109   
 110  7639 public List getRules()
 111    {
 112  7639 if (_shareableRules == null)
 113  956 _shareableRules = _rules == null ? Collections.EMPTY_LIST : Collections
 114    .unmodifiableList(_rules);
 115   
 116  7639 return _shareableRules;
 117    }
 118   
 119  16 public String getContentTranslator()
 120    {
 121  16 return _contentTranslator;
 122    }
 123   
 124  3995 public void setContentTranslator(String string)
 125    {
 126  3995 _contentTranslator = string;
 127    }
 128   
 129    }