Coverage details for edu.uci.ics.jung.graph.impl.AbstractHypervertex

LineHitsSource
1 /*
2  * Created on Apr 26, 2005
3  *
4  * Copyright (c) 2005, the JUNG Project and the Regents of the University
5  * of California
6  * All rights reserved.
7  *
8  * This software is open-source under the BSD license; see either
9  * "license.txt" or
10  * http://jung.sourceforge.net/license.txt for a description.
11  */
12 package edu.uci.ics.jung.graph.impl;
13  
14 import edu.uci.ics.jung.graph.ArchetypeGraph;
15 import edu.uci.ics.jung.graph.ArchetypeVertex;
16 import edu.uci.ics.jung.graph.Hyperedge;
17 import edu.uci.ics.jung.graph.Hypergraph;
18 import edu.uci.ics.jung.graph.Hypervertex;
19  
20 /**
21  * This class provides a skeletal implementation of the <code>Hypervertex</code>
22  * interface to minimize the effort required to implement this interface.
23  * <P>
24  * This class extends <code>UserData</code>, which provides storage and
25  * retrieval mechanisms for user-defined data for each edge instance.
26  * This allows users to attach data to edges without having to extend
27  * this class.</p>
28  * <p>
29  * Existing subclasses maintain collections of edges, and infer neighbor
30  * collections from these classes. Independent neighbor collections are
31  * difficult to maintain for the following reasons:
32  * <ol>
33  * <li/>Hyperedges' membership is mutable; when a vertex is added to
34  * or removed from a hyperedge, each
35  * vertex connected to the hyperedge must be notified of the change, and
36  * when a hyperedge is added to or removed from a graph, each connected
37  * vertex must remove all vertices incident to this edge from its
38  * collections...but only if there are no other edges connecting each
39  * vertex pair.
40  * <li/>The number of "neighboring" vertices for a
41  * hypergraph can be very large if it is connected to several hyperedges.
42  * Those who want to provide implementations which maintain something
43  * like the adjacency maps found in the <code>Vertex</code> implementations
44  * will need to provide support for edge set mutability both in the
45  * <code>Hypervertex</code> implementation and in the <code>Hyperedge</code>
46  * implementation.
47  * </ol>
48  * </p>
49  *
50  * @author Joshua O'Madadhain
51  *
52  * @see SetHypergraph
53  * @see AbstractHyperedge
54  *
55  *
56  *
57  * @author Joshua O'Madadhain
58  */
59 public abstract class AbstractHypervertex extends AbstractArchetypeVertex implements Hypervertex
60 {
61     /**
62      * The next vertex ID.
63      */
640    private static int nextGlobalVertexID = 0;
65     
66     public AbstractHypervertex()
67     {
680        super();
690        this.id = nextGlobalVertexID++;
700        initialize();
710    }
72     
73     /**
74      * @see edu.uci.ics.jung.graph.ArchetypeVertex#copy(edu.uci.ics.jung.graph.ArchetypeGraph)
75      */
76     public ArchetypeVertex copy(ArchetypeGraph g)
77     {
780        AbstractHypervertex v = (AbstractHypervertex)super.copy(g);
790        ((Hypergraph)g).addVertex(v);
800        return v;
81     }
82     
83     protected void initialize()
84     {
850        super.initialize();
860    }
87     
88     /**
89      * Returns a human-readable representation of this edge.
90      *
91      * @see java.lang.Object#toString()
92      */
93     public String toString()
94     {
950        return "HV" + id;
96     }
97     
98     /**
99      * @see edu.uci.ics.jung.graph.Hypervertex#connectEdge(Hyperedge)
100      */
101     public boolean connectEdge(Hyperedge e)
102     {
1030        return e.connectVertex(this);
104     }
105     
106     /**
107      * @see edu.uci.ics.jung.graph.Hypervertex#disconnectEdge(Hyperedge)
108      */
109     public boolean disconnectEdge(Hyperedge e)
110     {
1110        return e.disconnectVertex(this);
112     }
113 }

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.