/* -------------------------------------------------------------------------- */ /* */ /* T-TREE CANVAS SUB_CLASS */ /* */ /* Frans Coenen */ /* */ /* 10 September 2008. */ /* */ /* Department of Computer Science */ /* The University of Liverpool */ /* */ /* -------------------------------------------------------------------------- */ /** Modules to paint a representation of the T-tree where the T-tree comprises fuzzy data. Methods place all T-tree nodes are placed in an X-Y plane which is then processed and output. */ import java.awt.*; // Java extension packages import javax.swing.*; public class TtreeCanvasSub extends TtreeCanvas { /** Referece to start of T-tree data structure. */ private FuzzyTtreeNode[] startTtreeRef = null; /* CONSTRUCTORS */ public TtreeCanvasSub(int numXnodes, int numYnodes, FuzzyTtreeNode[] tTreeRef, double supp) { startTtreeRef=tTreeRef; minSupport = supp; //System.out.println("TtreeCanvas: numXnodes = " + numXnodes + ", numYnodes = " + //numYnodes); // Initialise node array nodeArray=new int[numXnodes][numYnodes][3]; for (int colIndex=0;colIndex0;index--) { // Check if supported if (treeRef[index]!=null) { // Lable nodeArray[colIndex][rowIndex][0] = index; // support nodeArray[colIndex][rowIndex][1] = (int) ((treeRef[index].support+0.005)*100); // If strat and supported child nodes then type 2 else type 0 if (start) { if (supportedChildNodes(treeRef[index].childRef)) { nodeArray[colIndex][rowIndex][2]=2; populateArray(colIndex,rowIndex+1,treeRef[index].childRef); } else nodeArray[colIndex][rowIndex][2]=0; } // If not start and supported child nodes then type 3, otherwise // type 1. else { if (supportedChildNodes(treeRef[index].childRef)) { nodeArray[colIndex][rowIndex][2]=3; populateArray(colIndex,rowIndex+1,treeRef[index].childRef); } else nodeArray[colIndex][rowIndex][2]=1; } // Decrement volumn index colIndex--; // Set start flag to false start=false; } } } /* CHECK FOR SUPPORT CHILD NODES */ private boolean supportedChildNodes(FuzzyTtreeNode[] treeRef) { if (treeRef==null) return(false); // Loop for (int index=1;index