Changeset 7 for src/main/java/weka/clusterers/forMetisMQI/Graph.java
- Timestamp:
- Sep 10, 2010, 10:51:27 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/weka/clusterers/forMetisMQI/Graph.java
r6 r7 6 6 import java.util.Iterator; 7 7 import java.util.List; 8 import java.util.Map.Entry; 8 9 9 10 import weka.core.Attribute; … … 41 42 return "Vwgt: " + vwgt + " Cewgt: " + cewgt + " Iedges: " + iedges 42 43 + " Nedges: " + nedges + " Adjwgt: " + adjwgt; 44 } 45 46 @Override 47 public NodeInfo clone() { 48 NodeInfo ni = new NodeInfo(); 49 ni.adjwgt = adjwgt; 50 ni.cewgt = cewgt; 51 ni.iedges = iedges; 52 ni.nedges = nedges; 53 ni.vwgt = vwgt; 54 return ni; 43 55 } 44 56 } … … 107 119 * @return 108 120 */ 109 p rivateint getLabel(int index) {121 public int getLabel(int index) { 110 122 return this.index.get(index); 111 123 } … … 116 128 * @return 117 129 */ 118 p rivateint getIndex(int label) {130 public int getIndex(int label) { 119 131 return this.label.get(label); 120 132 } … … 307 319 } 308 320 } 321 322 323 @Override 324 public Graph clone() { 325 Graph g = new Graph(); 326 g.adjncy = new ArrayList<Integer>(); 327 for(int i = 0; i < adjncy.size(); i++) { 328 g.adjncy.add(adjncy.get(i)); 329 } 330 331 g.weights = new ArrayList<Integer>(); 332 for(int i = 0; i < weights.size(); i++) { 333 g.weights.add(weights.get(i)); 334 } 335 336 g.vtxs = new ArrayList<NodeInfo>(); 337 for(int i = 0; i < vtxs.size(); i++) { 338 g.vtxs.add(vtxs.get(i).clone()); 339 } 340 341 g.index = new HashMap<Integer, Integer>(); 342 Iterator<Entry<Integer,Integer>> i = index.entrySet().iterator(); 343 while(i.hasNext()) { 344 Entry<Integer,Integer> entry = i.next(); 345 g.index.put(entry.getKey(), entry.getValue()); 346 } 347 348 g.label = new HashMap<Integer, Integer>(); 349 i = label.entrySet().iterator(); 350 while(i.hasNext()) { 351 Entry<Integer,Integer> entry = i.next(); 352 g.label.put(entry.getKey(), entry.getValue()); 353 } 354 355 356 return g; 357 } 309 358 }
Note: See TracChangeset
for help on using the changeset viewer.