Line | Hits | Source |
---|---|---|
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 | ||
35 | 35 | public AbstractHyperUnitBPG() { |
36 | 35 | this.vertex = new BipartiteVertex(); |
37 | 35 | } |
38 | ||
39 | /** for constructing a new HypergraphBPG based on a previous HypergraphBPG */ | |
40 | 5 | AbstractHyperUnitBPG( BipartiteVertex bpg, HypergraphBPG hypergraphBPG ) { |
41 | 5 | this.vertex = bpg; |
42 | 5 | this.graph = hypergraphBPG; |
43 | 5 | } |
44 | ||
45 | protected BipartiteVertex underlying_vertex() { | |
46 | 147 | return vertex; |
47 | } | |
48 | ||
49 | public boolean equals( Object o ) { | |
50 | 0 | if ( o instanceof AbstractHyperUnitBPG ) { |
51 | 0 | AbstractHyperUnitBPG hu = (AbstractHyperUnitBPG) o; |
52 | 0 | return (vertex.equals( hu.underlying_vertex())); |
53 | 0 | } else if ( o instanceof Vertex ) { |
54 | 0 | return (vertex.equals(o)); |
55 | } else | |
56 | 0 | return false; |
57 | } | |
58 | ||
59 | /** | |
60 | * @see edu.uci.ics.jung.graph.ArchetypeVertex#getGraph() | |
61 | */ | |
62 | public ArchetypeGraph getGraph() { | |
63 | 0 | 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) { | |
70 | 0 | vertex.addUserDatum(key, datum, copyAct); |
71 | 0 | } |
72 | ||
73 | /** | |
74 | * @see edu.uci.ics.jung.utils.UserDataContainer#importUserData(edu.uci.ics.jung.utils.UserDataContainer) | |
75 | */ | |
76 | public void importUserData(UserDataContainer udc) { | |
77 | 0 | vertex.importUserData(udc); |
78 | 0 | } |
79 | ||
80 | /** | |
81 | * @see edu.uci.ics.jung.utils.UserDataContainer#getUserDatumKeyIterator() | |
82 | */ | |
83 | public Iterator getUserDatumKeyIterator() { | |
84 | 0 | 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) { | |
91 | 0 | 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) { | |
98 | 0 | 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) { | |
105 | 0 | vertex.setUserDatum(key, datum, copyAct); |
106 | 0 | } |
107 | ||
108 | /** | |
109 | * @see edu.uci.ics.jung.utils.UserDataContainer#removeUserDatum(java.lang.Object) | |
110 | */ | |
111 | public Object removeUserDatum(Object key) { | |
112 | 0 | return vertex.removeUserDatum(key); |
113 | } | |
114 | ||
115 | public boolean containsUserDatumKey(Object key) | |
116 | { | |
117 | 0 | return vertex.containsUserDatumKey(key); |
118 | } | |
119 | ||
120 | /** | |
121 | * @param hypergraphBPG | |
122 | */ | |
123 | protected void setGraph(HypergraphBPG hypergraphBPG) { | |
124 | 35 | this.graph = hypergraphBPG; |
125 | 35 | } |
126 | ||
127 | public void removeVertex(HypervertexBPG hv3) { | |
128 | 0 | Edge e = vertex.findEdge(hv3.underlying_vertex()); |
129 | ||
130 | 0 | BipartiteGraph bpg = (BipartiteGraph) hv3.underlying_vertex().getGraph(); |
131 | 0 | bpg.removeEdge( e ); |
132 | 0 | } |
133 | ||
134 | public Object clone() throws CloneNotSupportedException | |
135 | { | |
136 | 0 | return super.clone(); |
137 | } | |
138 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |