Coverage details for edu.uci.ics.jung.graph.decorators.UserDatumNumberEdgeValue

LineHitsSource
1 /*
2  * Copyright (c) 2004, the JUNG Project and the Regents of the University of
3  * California All rights reserved.
4  *
5  * This software is open-source under the BSD license; see either "license.txt"
6  * or http://jung.sourceforge.net/license.txt for a description.
7  *
8  * Created on Sep 10, 2004
9  */
10 package edu.uci.ics.jung.graph.decorators;
11  
12 import java.util.Iterator;
13  
14 import edu.uci.ics.jung.graph.ArchetypeEdge;
15 import edu.uci.ics.jung.graph.ArchetypeGraph;
16 import edu.uci.ics.jung.utils.UserData;
17 import edu.uci.ics.jung.utils.UserDataContainer.CopyAction;
18  
19 /**
20  * An implementation of <code>NumberEdgeValue</code> that stores the values
21  * in the UserData repository.
22  *
23  * @author Joshua O'Madadhain
24  */
25 public class UserDatumNumberEdgeValue implements NumberEdgeValue
26 {
27     protected Object key;
28     protected CopyAction copy_action;
29     
30     /**
31      * Creates an instance with the specified key and with a
32      * <code>CopyAction</code> of <code>REMOVE</code>.
33      */
34     public UserDatumNumberEdgeValue(Object key)
357    {
367        this.key = key;
377        this.copy_action = UserData.REMOVE;
387    }
39     
40     /**
41      * Creates an instance with the specified key and <code>CopyAction</code>.
42      */
43     public UserDatumNumberEdgeValue(Object key, CopyAction copy_action)
440    {
450        this.key = key;
460        this.copy_action = copy_action;
470    }
48     
49     public void setCopyAction(CopyAction copy_action)
50     {
513        this.copy_action = copy_action;
523    }
53     
54     /**
55      * @see edu.uci.ics.jung.graph.decorators.NumberEdgeValue#getNumber(edu.uci.ics.jung.graph.ArchetypeEdge)
56      */
57     public Number getNumber(ArchetypeEdge e)
58     {
5956        return (Number)e.getUserDatum(key);
60     }
61  
62     /**
63      * @see edu.uci.ics.jung.graph.decorators.NumberEdgeValue#setNumber(edu.uci.ics.jung.graph.ArchetypeEdge, java.lang.Number)
64      */
65     public void setNumber(ArchetypeEdge e, Number n)
66     {
6736        e.setUserDatum(key, n, copy_action);
6836    }
69     
70     /**
71      * Removes this decoration from <code>g</code>.
72      */
73     public void clear(ArchetypeGraph g)
74     {
750        for (Iterator iter = g.getEdges().iterator(); iter.hasNext(); )
76         {
770            ArchetypeEdge v = (ArchetypeEdge)iter.next();
780            v.removeUserDatum(key);
79         }
800    }
81  
82 }

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.