01: /*
02: * This file is part of JGAP.
03: *
04: * JGAP offers a dual license model containing the LGPL as well as the MPL.
05: *
06: * For licensing information please see the file license.txt included with JGAP
07: * or have a look at the top of class org.jgap.Chromosome which representatively
08: * includes the JGAP license policy applicable for any file delivered with JGAP.
09: */
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 extends JGAPTreeBranchRenderer {
25: /** String containing the CVS revision. Read out via reflection!*/
26: private final static String CVS_REVISION = "$Revision: 1.2 $";
27:
28: public Color getBranchColor(Object a_node, int a_level) {
29: String name = ((JGAPTreeNode) a_node).getName();
30: Color out = Color.white;
31: if (name.equals(IfFoodAheadElse.class.getName())) {
32: out = new Color(255, 30, 30);
33: } else {
34: return super.getBranchColor(a_node, a_level);
35: }
36: return out;
37: }
38: }
|