Coverage Report - net.sourceforge.combean.graph.containers.doubleval.EdgeMapAsDoubleEdgeMap
 
Classes in this File Line Coverage Branch Coverage Complexity
EdgeMapAsDoubleEdgeMap
77%
10/13
N/A
0
 
 1  
 /*
 2  
     This file is part of Combean.
 3  
 
 4  
     Combean is free software; you can redistribute it and/or modify
 5  
     it under the terms of the GNU General Public License as published by
 6  
     the Free Software Foundation; either version 2 of the License, or
 7  
     (at your option) any later version.
 8  
 
 9  
     Combean is distributed in the hope that it will be useful,
 10  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
     GNU General Public License for more details.
 13  
 
 14  
     You should have received a copy of the GNU General Public License
 15  
     along with Combean; if not, write to the Free Software
 16  
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 17  
 */
 18  
 /*
 19  
  * Created on 13.08.2005
 20  
  *
 21  
  */
 22  
 package net.sourceforge.combean.graph.containers.doubleval;
 23  
 
 24  
 import net.sourceforge.combean.graph.containers.MapAsEdgeMap;
 25  
 import net.sourceforge.combean.interfaces.graph.Edge;
 26  
 import net.sourceforge.combean.interfaces.graph.Graph;
 27  
 import net.sourceforge.combean.interfaces.graph.containers.EdgeMap;
 28  
 import net.sourceforge.combean.interfaces.graph.containers.doubleval.DoubleEdgeMap;
 29  
 
 30  
 /**
 31  
  * Use a 'normal' EdgeMap as DoubleEdgeMap
 32  
  * 
 33  
  * @author schickin
 34  
  *
 35  
  */
 36  
 public class EdgeMapAsDoubleEdgeMap
 37  
 implements DoubleEdgeMap {
 38  
     
 39  105
     private EdgeMap<Double> edgeMap = null;
 40  
     
 41  
     /**
 42  
      * Default constructor. Wraps a MapAsEdgeMap.
 43  
      */
 44  
     public EdgeMapAsDoubleEdgeMap() {
 45  105
         super();
 46  
         
 47  105
         this.edgeMap = new MapAsEdgeMap<Double>();
 48  105
     }
 49  
     
 50  
     /**
 51  
      * Constructor. Wraps a given EdgeMap.
 52  
      * 
 53  
      * @param edgeMap the EdgeMap to be wrapped.
 54  
      */
 55  
     public EdgeMapAsDoubleEdgeMap(EdgeMap<Double> edgeMap) {
 56  0
         super();
 57  
         
 58  0
         this.edgeMap = edgeMap;
 59  0
     }
 60  
 
 61  
     /* (non-Javadoc)
 62  
      * @see net.sourceforge.combean.interfaces.graph.containers.DoubleEdgeMap#putDouble(net.sourceforge.combean.interfaces.graph.Edge, double)
 63  
      */
 64  
     public double putDouble(Edge e, double newVal) {
 65  483
         return (this.edgeMap.put(e, new Double(newVal))).doubleValue();
 66  
     }
 67  
 
 68  
     /* (non-Javadoc)
 69  
      * @see net.sourceforge.combean.interfaces.graph.containers.EdgeMap#init(net.sourceforge.combean.interfaces.graph.Graph)
 70  
      */
 71  
     public void init(Graph g) {
 72  99
         this.edgeMap.init(g, new Double(0));
 73  99
     }
 74  
 
 75  
     /* (non-Javadoc)
 76  
      * @see net.sourceforge.combean.interfaces.graph.containers.InitializableWithDoubleDefaultValue#init(net.sourceforge.combean.interfaces.graph.Graph, double)
 77  
      */
 78  
     public void init(Graph g, double initVal) {
 79  6
         this.edgeMap.init(g, new Double(initVal));
 80  6
     }
 81  
     
 82  
     /* (non-Javadoc)
 83  
      * @see net.sourceforge.combean.interfaces.graph.containers.FixedDoubleEdgeMap#getDouble(net.sourceforge.combean.interfaces.graph.Edge)
 84  
      */
 85  
     public double getDouble(Edge e) {
 86  759
          return (this.edgeMap.get(e)).doubleValue();
 87  
     }
 88  
 }