Rev | Line | |
---|
[27] | 1 | |
---|
| 2 | package view; |
---|
| 3 | |
---|
| 4 | import java.awt.Color; |
---|
| 5 | import java.util.ArrayList; |
---|
| 6 | import java.util.Collection; |
---|
| 7 | import java.util.List; |
---|
| 8 | import org.apache.commons.collections15.Transformer; |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | public class VertexPaintTransformer<V,Paint> implements Transformer<V,Paint>{ |
---|
| 12 | |
---|
| 13 | Collection<V> cluster; |
---|
| 14 | |
---|
| 15 | public VertexPaintTransformer(Collection<V> cluster){ |
---|
| 16 | this.cluster = cluster; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | public Paint transform(V node) { |
---|
[32] | 20 | if(cluster.contains(node)){ |
---|
| 21 | Color c = new Color(0,255,0); |
---|
| 22 | return (Paint) c; |
---|
| 23 | } |
---|
[27] | 24 | else |
---|
| 25 | return (Paint) Color.RED; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.