2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Clover coverage report - Code Coverage for hivemind release 1.2.1
Coverage timestamp: Fri Feb 10 2006 16:33:43 PST
file stats: LOC: 87   Methods: 6
NCLOC: 46   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ElementsInnerProxyMap.java 12.5% 47.1% 50% 38.7%
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.impl;
 16   
 17    import java.util.AbstractMap;
 18    import java.util.Map;
 19    import java.util.Set;
 20   
 21    /**
 22    * Implements a {@link java.util.Map} as a proxy to an actual map of elements, provided by an
 23    * extension point. The proxy is unmodifiable and will work with the extension point to generate the
 24    * real map of elements in a just-in-time manner.
 25    *
 26    * @author Knut Wannheden
 27    * @since 1.1
 28    */
 29    public final class ElementsInnerProxyMap extends AbstractMap
 30    {
 31    private Map _inner;
 32   
 33    private ConfigurationPointImpl _point;
 34   
 35    private ElementsProxyMap _outer;
 36   
 37  124 ElementsInnerProxyMap(ConfigurationPointImpl point, ElementsProxyMap outer)
 38    {
 39  124 _point = point;
 40  124 _outer = outer;
 41   
 42  124 _outer.setInner(this);
 43    }
 44   
 45  123 public Set entrySet()
 46    {
 47  123 return inner().entrySet();
 48    }
 49   
 50  123 private synchronized Map inner()
 51    {
 52  123 if (_inner == null)
 53    {
 54  123 _inner = _point.constructMapElements();
 55   
 56    // Replace ourselves in the outer proxy with the actual list.
 57  123 _outer.setInner(_inner);
 58    }
 59   
 60  123 return _inner;
 61    }
 62   
 63  0 public boolean equals(Object o)
 64    {
 65  0 if (this == o)
 66  0 return true;
 67   
 68  0 if (o == null)
 69  0 return false;
 70   
 71  0 return inner().equals(o);
 72    }
 73   
 74  0 public int hashCode()
 75    {
 76  0 return inner().hashCode();
 77    }
 78   
 79  0 public synchronized String toString()
 80    {
 81  0 if (_inner != null)
 82  0 return _inner.toString();
 83   
 84  0 return "<Element Map Proxy for " + _point.getExtensionPointId() + ">";
 85    }
 86   
 87    }