Coverage details for edu.uci.ics.jung.algorithms.RealMatrixElementOperations

LineHitsSource
1 /*
2 * Copyright (c) 2003, the JUNG Project and the Regents of the University
3 * of California
4 * All rights reserved.
5 *
6 * This software is open-source under the BSD license; see either
7 * "license.txt" or
8 * http://jung.sourceforge.net/license.txt for a description.
9 */
10 package edu.uci.ics.jung.algorithms;
11  
12 import edu.uci.ics.jung.algorithms.MatrixElementOperations;
13 import edu.uci.ics.jung.graph.Edge;
14 import edu.uci.ics.jung.utils.MutableDouble;
15 import edu.uci.ics.jung.utils.UserData;
16  
17 /**
18  * Implements the basic matrix operations on double-precision values. Assumes
19  * that the edges have a MutableDouble value.
20  *
21  * @author Joshua O'Madadhain
22  */
23 public class RealMatrixElementOperations implements MatrixElementOperations
24 {
25     private String EDGE_KEY;
26  
27     public RealMatrixElementOperations(String edge_key)
283    {
293        EDGE_KEY = edge_key;
303    }
31  
32     /**
33      * @see MatrixElementOperations#mergePaths(Edge, Object)
34      */
35     public void mergePaths(Edge e, Object pathData)
36     {
3721        MutableDouble pd = (MutableDouble)pathData;
3821        MutableDouble ed = (MutableDouble)e.getUserDatum(EDGE_KEY);
3921        if (ed == null)
4018            e.addUserDatum(EDGE_KEY, pd, UserData.SHARED);
41         else
423            ed.add(pd.doubleValue());
4321    }
44  
45     /**
46      * @see MatrixElementOperations#computePathData(Edge, Edge)
47      */
48     public Object computePathData(Edge e1, Edge e2)
49     {
5021        double d1 = ((MutableDouble)e1.getUserDatum(EDGE_KEY)).doubleValue();
5121        double d2 = ((MutableDouble)e2.getUserDatum(EDGE_KEY)).doubleValue();
5221        return new MutableDouble(d1*d2);
53     }
54 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.