Changeset 36 for branches/localSpectral/src/view
- Timestamp:
- Jan 6, 2011, 9:41:42 AM (14 years ago)
- Location:
- branches/localSpectral/src/view
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/localSpectral/src/view/VertexPaintRankTransformer.java
r34 r36 14 14 List<VertexScore<V>> pagerank; 15 15 V seed_node; 16 List<V> cluster; 16 17 17 18 public VertexPaintRankTransformer(List<VertexScore<V>> ranking, V seed_node){ 18 19 this.pagerank = ranking; 19 20 this.seed_node = seed_node; 21 this.cluster = null; 20 22 } 21 23 24 public VertexPaintRankTransformer(List<VertexScore<V>> ranking, V seed_node, List<V> cluster){ 25 this.pagerank = ranking; 26 this.seed_node = seed_node; 27 this.cluster = cluster; 28 } 29 22 30 public Paint transform(V node) { 23 31 … … 25 33 if (seed_node.equals(node)){ 26 34 return (Paint) Color.GREEN; 35 } 36 } 37 if(cluster != null){ 38 if (!cluster.contains(node)){ 39 return (Paint) Color.WHITE; 27 40 } 28 41 } -
branches/localSpectral/src/view/Viewer.java
r34 r36 24 24 import javax.swing.JPanel; 25 25 import javax.swing.JTextArea; 26 import javax.xml.bind.JAXB;27 26 import org.apache.commons.collections15.Transformer; 28 27 … … 83 82 } 84 83 84 public void viewClusterRankedInGraph(List<VertexScore<V>> pagerank, V seed_node, List<V> cluster){ 85 VertexPaintRankTransformer vertexPaint = new VertexPaintRankTransformer(pagerank,seed_node, cluster); 86 vv.getRenderContext().setVertexFillPaintTransformer((Transformer<V, Paint>) vertexPaint); 87 88 frame.getContentPane().add(vv); 89 frame.pack(); 90 frame.repaint(); 91 frame.setVisible(true); 92 } 93 85 94 86 95 public void viewGraph(List<V> cut){ … … 98 107 } 99 108 109 100 110 }
Note: See TracChangeset
for help on using the changeset viewer.