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

LineHitsSource
1 /*
2  * Created on Dec 11, 2003
3  *
4  * Copyright (c) 2004, 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 java.util.Iterator;
15  
16 import edu.uci.ics.jung.graph.ArchetypeGraph;
17 import edu.uci.ics.jung.graph.Edge;
18 import edu.uci.ics.jung.graph.Vertex;
19 import edu.uci.ics.jung.utils.UserDataContainer;
20  
21 /**
22  * A support class for both HyperedgeBPG and HyperVertexBPG,
23  * this represents a single object backed by a BipartiteVertex
24  * that is a member of a HypergraphBPG. Cannot be instantiated
25  * on its own.
26  *
27  * @author danyelf
28  * @deprecated As of version 1.7, JUNG now includes native versions of hypergraph classes.
29  */
30 public abstract class AbstractHyperUnitBPG implements UserDataContainer {
31  
32     protected BipartiteVertex vertex;
33     protected HypergraphBPG graph;
34  
3535    public AbstractHyperUnitBPG() {
3635        this.vertex = new BipartiteVertex();
3735    }
38  
39     /** for constructing a new HypergraphBPG based on a previous HypergraphBPG */
405    AbstractHyperUnitBPG( BipartiteVertex bpg, HypergraphBPG hypergraphBPG ) {
415        this.vertex = bpg;
425        this.graph = hypergraphBPG;
435    }
44     
45     protected BipartiteVertex underlying_vertex() {
46147        return vertex;
47     }
48  
49     public boolean equals( Object o ) {
500        if ( o instanceof AbstractHyperUnitBPG ) {
510            AbstractHyperUnitBPG hu = (AbstractHyperUnitBPG) o;
520            return (vertex.equals( hu.underlying_vertex()));
530        } else if ( o instanceof Vertex ) {
540            return (vertex.equals(o));
55         } else
560            return false;
57     }
58     
59     /**
60      * @see edu.uci.ics.jung.graph.ArchetypeVertex#getGraph()
61      */
62     public ArchetypeGraph getGraph() {
630        return graph;
64     }
65  
66     /**
67      * @see edu.uci.ics.jung.utils.UserDataContainer#addUserDatum(java.lang.Object, java.lang.Object, edu.uci.ics.jung.utils.UserDataContainer.CopyAction)
68      */
69     public void addUserDatum(Object key, Object datum, CopyAction copyAct) {
700        vertex.addUserDatum(key, datum, copyAct);
710    }
72  
73     /**
74      * @see edu.uci.ics.jung.utils.UserDataContainer#importUserData(edu.uci.ics.jung.utils.UserDataContainer)
75      */
76     public void importUserData(UserDataContainer udc) {
770        vertex.importUserData(udc);
780    }
79  
80     /**
81      * @see edu.uci.ics.jung.utils.UserDataContainer#getUserDatumKeyIterator()
82      */
83     public Iterator getUserDatumKeyIterator() {
840        return vertex.getUserDatumKeyIterator();
85     }
86  
87     /**
88      * @see edu.uci.ics.jung.utils.UserDataContainer#getUserDatumCopyAction(java.lang.Object)
89      */
90     public CopyAction getUserDatumCopyAction(Object key) {
910        return vertex.getUserDatumCopyAction(key);
92     }
93  
94     /**
95      * @see edu.uci.ics.jung.utils.UserDataContainer#getUserDatum(java.lang.Object)
96      */
97     public Object getUserDatum(Object key) {
980        return vertex.getUserDatum(key);
99     }
100  
101     /**
102      * @see edu.uci.ics.jung.utils.UserDataContainer#setUserDatum(java.lang.Object, java.lang.Object, edu.uci.ics.jung.utils.UserDataContainer.CopyAction)
103      */
104     public void setUserDatum(Object key, Object datum, CopyAction copyAct) {
1050        vertex.setUserDatum(key, datum, copyAct);
1060    }
107  
108     /**
109      * @see edu.uci.ics.jung.utils.UserDataContainer#removeUserDatum(java.lang.Object)
110      */
111     public Object removeUserDatum(Object key) {
1120        return vertex.removeUserDatum(key);
113     }
114  
115     public boolean containsUserDatumKey(Object key)
116     {
1170        return vertex.containsUserDatumKey(key);
118     }
119     
120     /**
121      * @param hypergraphBPG
122      */
123     protected void setGraph(HypergraphBPG hypergraphBPG) {
12435        this.graph = hypergraphBPG;
12535    }
126  
127     public void removeVertex(HypervertexBPG hv3) {
1280        Edge e = vertex.findEdge(hv3.underlying_vertex());
129     
1300        BipartiteGraph bpg = (BipartiteGraph) hv3.underlying_vertex().getGraph();
1310        bpg.removeEdge( e );
1320    }
133  
134     public Object clone() throws CloneNotSupportedException
135     {
1360        return super.clone();
137     }
138 }

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.