KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > gp > anttrail > AntTreeBranchRenderer


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package examples.gp.anttrail;
11
12 import java.awt.*;
13 import org.jgap.util.tree.*;
14 import org.jgap.gp.function.*;
15 import org.jgap.gp.*;
16 import org.jgap.gp.impl.*;
17
18 /**
19  * Renders the branches' colors of a tree to display.
20  *
21  * @author Klaus Meffert
22  * @since 3.01
23  */

24 public class AntTreeBranchRenderer
25     extends JGAPTreeBranchRenderer {
26   /** String containing the CVS revision. Read out via reflection!*/
27   private final static String JavaDoc CVS_REVISION = "$Revision: 1.1 $";
28
29   public Color getBranchColor(Object JavaDoc a_node, int a_level) {
30     String JavaDoc name = ( (JGAPTreeNode) a_node).getName();
31     Color out = Color.white;
32     if (name.equals(IfFoodAheadElse.class.getName())) {
33       out = new Color(255, 30, 30);
34     }
35     else {
36       return super.getBranchColor(a_node, a_level);
37     }
38     return out;
39   }
40 }
41
Popular Tags