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

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 /*
11  * Created on Dec 11, 2003
12  */
13 package edu.uci.ics.jung.graph.impl;
14  
15 import java.util.Set;
16  
17 import edu.uci.ics.jung.graph.*;
18  
19 /**
20  * A HyperEdge has zero or more HyperVertices attached to it;
21  * this implements that as part of an underlying HyperGraph.
22  *
23  * @author danyelf
24  * @deprecated As of version 1.7, replaced by native implementations of <code>Hyperedge</code>.
25  * @see SetHyperedge
26  * @see ListHyperedge
27  */
28 public class HyperedgeBPG extends AbstractHyperUnitBPG implements Hyperedge{
29  
3014    public HyperedgeBPG() {
3114    }
32  
33     HyperedgeBPG( BipartiteVertex bpv, HypergraphBPG hypergraphBPG ) {
342        super( bpv, hypergraphBPG );
352    }
36  
37     public Set getIncidentElements()
38     {
390        return getIncidentVertices();
40     }
41  
42     /**
43      * @see edu.uci.ics.jung.graph.ArchetypeEdge#getIncidentVertices()
44      */
45     public Set getIncidentVertices() {
460        return graph.translateUnderlyingVertices(vertex.getNeighbors());
47     }
48  
49     /**
50      * @see edu.uci.ics.jung.graph.ArchetypeEdge#getEqualEdge(edu.uci.ics.jung.graph.ArchetypeGraph)
51      */
52     public ArchetypeEdge getEqualEdge(ArchetypeGraph g) {
532        HypergraphBPG bpg = (HypergraphBPG) g;
54         // check if that graph's underlying vertex is the same as this one's.
552        return bpg.getEdgeCorrespondingTo( underlying_vertex() );
56     }
57  
58     /**
59      * @deprecated As of version 1.4, renamed to getEqualEdge(g).
60      */
61     public ArchetypeEdge getEquivalentEdge(ArchetypeGraph g)
62     {
630        return getEqualEdge(g);
64     }
65     
66     /**
67      * @see edu.uci.ics.jung.graph.ArchetypeEdge#numVertices()
68      */
69     public int numVertices() {
700        return vertex.degree();
71     }
72  
73     /**
74      * @see edu.uci.ics.jung.graph.ArchetypeEdge#isIncident(edu.uci.ics.jung.graph.ArchetypeVertex)
75      */
76     public boolean isIncident(ArchetypeVertex v) {
770        HypervertexBPG hv = (HypervertexBPG) v;
780        return vertex.isNeighborOf(hv.underlying_vertex());
79     }
80  
81     /**
82      * @see edu.uci.ics.jung.graph.ArchetypeEdge#copy(edu.uci.ics.jung.graph.ArchetypeGraph)
83      */
84     public ArchetypeEdge copy(ArchetypeGraph g) {
850        HypergraphBPG hg = (HypergraphBPG) g;
860        HyperedgeBPG he = new HyperedgeBPG();
870        hg.addEdge( he );
880        he.importUserData(this);
890        return he;
90     }
91  
92     /**
93      * Registers an additional vertex <code>hv3_x</code> onto this Edge.
94      */
95     public boolean connectVertex(Hypervertex hv3_x)
96     {
9722        HypervertexBPG hv3 = (HypervertexBPG) hv3_x;
9822        BipartiteGraph bpg = (BipartiteGraph) hv3.underlying_vertex().getGraph();
9922        BipartiteVertex v1 = hv3.underlying_vertex();
10022        BipartiteVertex v2 = underlying_vertex();
101         
10222        if (v1.isNeighborOf(v2))
1030            return false;
104         
10522        bpg.addBipartiteEdge(new BipartiteEdge(v1, v2));
106         
10722        return true;
108     }
109     
110     public boolean disconnectVertex(Hypervertex v)
111     {
1120        HypervertexBPG hv3 = (HypervertexBPG)v;
1130        BipartiteGraph bpg = (BipartiteGraph) hv3.underlying_vertex().getGraph();
1140        BipartiteVertex v1 = hv3.underlying_vertex();
1150        BipartiteVertex v2 = underlying_vertex();
1160        Edge e = v1.findEdge(v2);
1170        if (e != null)
118         {
1190            bpg.removeEdge(e);
1200            return true;
121         }
1220        return false;
123     }
124  
125 }

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.