// // METreeRenderer.java // MetaEvolve // // Version 1 // // Created by Brian Risk of Geneffects on March 18, 2004. // Last Modified on March 19, 2004. // www.geneffects.com // import java.awt.*; public class METreeBranchRenderer implements TreeBranchRenderer{ public Color getBranchColor(Object node, int level) { String name = node.getClass().getName(); Color out = Color.black; if (name.equals("NodeNumIF")) {out = new Color(255, 0, 0);} if (name.equals("NodeNumAdd")) {out = new Color(86, 0, 0);} if (name.equals("NodeNumSubtract")) {out = new Color(171, 0, 0);} if (name.equals("NodeBoolLessThan")) {out = new Color(0, 0, 85);} if (name.equals("NodeBoolGreaterThan")) {out = new Color(0, 0, 171);} if (name.equals("NodeBoolEquals")) {out = new Color(0, 0, 255);} if (name.equals("NodeBoolOR")) {out = new Color(0, 200, 0);} if (name.equals("NodeBoolXOR")) {out = new Color(0, 150, 0);} if (name.equals("NodeBoolAND")) {out = new Color(0, 100, 0);} if (name.equals("NodeBoolIF")) {out = new Color(0, 250, 0);} if (name.equals("NodeBoolNOT")) {out = new Color(0, 50, 0);} return out; } //Retitle this "getBranchColor" and the above function "getBranchColor2" //to make this one active public Color getBranchColor2(Object node, int level) { String name = node.getClass().getName(); Color out = Color.black; if (name.equals("NodeNumIF")) {out = new Color(255, 255, 0);} if (name.equals("NodeNumAdd")) {out = new Color(171, 171, 0);} if (name.equals("NodeNumSubtract")) {out = new Color(86, 86, 0);} if (name.equals("NodeBoolLessThan")) {out = new Color(0, 0, 85);} if (name.equals("NodeBoolGreaterThan")) {out = new Color(0, 0, 171);} if (name.equals("NodeBoolEquals")) {out = new Color(0, 0, 255);} if (name.equals("NodeBoolOR")) {out = new Color(200, 200, 200);} if (name.equals("NodeBoolXOR")) {out = new Color(150, 150, 150);} if (name.equals("NodeBoolAND")) {out = new Color(100, 100, 100);} if (name.equals("NodeBoolIF")) {out = new Color(250, 250, 250);} if (name.equals("NodeBoolNOT")) {out = new Color(50, 50, 50);} return out; } }