int priorities[], BC[];  for(int i=1; i<nodeLevels.length; i++) { priorities = new int[nodeLevels[i].length]; BC = new int[nodeLevels[i].length]; for(int j=0; j<nodeLevels[i].length; j++) { if(((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID.startsWith("S")) priorities[j] = maxCount+1; else priorities[j] = uConnectivity(i, j); BC[j] = uBCenter(i, j, horPositions); }      priorityLayout2(nodeLevels[i], priorities, BC, horPositions);             }   for(int i=nodeLevels.length-2; i>=0; i--) { priorities = new int[nodeLevels[i].length]; BC = new int[nodeLevels[i].length]; for(int j=0; j<nodeLevels[i].length; j++) { if(((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID.startsWith("S")) priorities[j] = maxCount+1; else priorities[j] = lConnectivity(i, j); BC[j] = lBCenter(i, j, horPositions); } priorityLayout2(nodeLevels[i], priorities, BC, horPositions);             }   for(int i=2; i<nodeLevels.length; i++) { priorities = new int[nodeLevels[i].length]; BC = new int[nodeLevels[i].length]; for(int j=0; j<nodeLevels[i].length; j++) { if(((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID.startsWith("S")) priorities[j] = maxCount+1; else priorities[j] = uConnectivity(i, j); BC[j] = uBCenter(i, j, horPositions); }      priorityLayout2(nodeLevels[i], priorities, BC, horPositions);            }  int minPosition = horPositions[0];  for(int i=0; i<horPositions.length; i++) if(horPositions[i]<minPosition) minPosition=horPositions[i]; if(minPosition<0) { minPosition = minPosition*-1; for(int i=0; i<horPositions.length; i++){  horPositions[i]+=minPosition;  } }   for(int i=0, temp=0; i<nodeLevels.length; i++) { for(int j=0; j<nodeLevels[i].length; j++) { temp=nodeLevels[i][j];  GraphNode n = (GraphNode)m_nodes.elementAt(temp); n.x = horPositions[temp]*m_nodeWidth; n.y = i*3*m_nodeHeight; } }  }
    protected void priorityLayout1() {	int [] horPositions = new int[m_nodes.size()];	int maxCount=0;		for(int i=0; i<nodeLevels.length; i++) {	    int count=0;	    for(int j=0; j<nodeLevels[i].length; j++) {		horPositions[nodeLevels[i][j]]=j;   		count++;	    }	    if(count>maxCount)		maxCount=count;	}	//fireLayoutCompleteEvent( new LayoutCompleteEvent(this) );	int priorities[], BC[];	//System.out.println("********Going from 2 to n********");	for(int i=1; i<nodeLevels.length; i++) {	    priorities = new int[nodeLevels[i].length];	    BC = new int[nodeLevels[i].length];	    for(int j=0; j<nodeLevels[i].length; j++) {		if( ((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID.startsWith("S") )		    priorities[j] = maxCount+1;		else		    priorities[j] = uConnectivity(i, j);		BC[j] = uBCenter(i, j, horPositions);	    }	    //for(int j=0; j<nodeLevels[i].length; j++)	    //  System.out.println("Level: "+(i+1)+" Node: "	    //	       +((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID	    //            +" uConnectivity: "+priorities[j]+" uBC: "+BC[j]+" position: "	    //	       +horPositions[nodeLevels[i][j]]);	    priorityLayout2(nodeLevels[i], priorities, BC, horPositions);	    //repaint	    //try {	    //	tempMethod(horPositions);	    //	fireLayoutCompleteEvent( new LayoutCompleteEvent(this) );	    //	Thread.sleep(1000);	    //} catch(InterruptedException ie) { ie.printStackTrace(); }	    	    //for(int j=0; j<nodeLevels[i].length; j++)	    //    System.out.println("Level: "+(i+1)+" Node: "	    //		       +((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID	    //		       +" uConnectivity: "+priorities[j]+" uBC: "+BC[j]+" position: "	    //		       +horPositions[nodeLevels[i][j]]);	}	//System.out.println("********Going from n-1 to 1********");	for(int i=nodeLevels.length-2; i>=0; i--) {	    priorities = new int[nodeLevels[i].length]; 	    BC = new int[nodeLevels[i].length];	    for(int j=0; j<nodeLevels[i].length; j++) {		if( ((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID.startsWith("S") )		    priorities[j] = maxCount+1;		else		    priorities[j] = lConnectivity(i, j);		BC[j] = lBCenter(i, j, horPositions); //, priorities[j]); 	    }	    priorityLayout2(nodeLevels[i], priorities, BC, horPositions);	    //repaint();	    //try {	    //	tempMethod(horPositions);	    //	fireLayoutCompleteEvent( new LayoutCompleteEvent(this) );			    //	Thread.sleep(1000);	    //} catch(InterruptedException ie) { ie.printStackTrace(); }	    	    //for(int j=0; j<nodeLevels[i].length; j++)	    //    System.out.println("Level: "+(i+1)+" Node: "	    //		       +((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID	    //		       +" lConnectivity: "+priorities[j]+" lBC: "+BC[j]+" position: "	    //		       +horPositions[nodeLevels[i][j]]);	}	//System.out.println("********Going from 2 to n again********");	for(int i=2; i<nodeLevels.length; i++) {	    priorities = new int[nodeLevels[i].length];	    BC = new int[nodeLevels[i].length];	    for(int j=0; j<nodeLevels[i].length; j++) {		if( ((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID.startsWith("S") )		    priorities[j] = maxCount+1;		else		    priorities[j] = uConnectivity(i, j);		BC[j] = uBCenter(i, j, horPositions);	    }	    //for(int j=0; j<nodeLevels[i].length; j++)	    //    System.out.println("Level: "+(i+1)+" Node: "	    //		       +((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID	    //		       +" uConnectivity: "+priorities[j]+" uBC: "+BC[j]+" position: "	    //		       +horPositions[nodeLevels[i][j]]);	    priorityLayout2(nodeLevels[i], priorities, BC, horPositions);	    //repaint();	    //try {	    //	tempMethod(horPositions);	    //	fireLayoutCompleteEvent( new LayoutCompleteEvent(this) );			    //	Thread.sleep(1000);	    //} catch(InterruptedException ie) { ie.printStackTrace(); }	    //for(int j=0; j<nodeLevels[i].length; j++)	    //    System.out.println("Level: "+(i+1)+" Node: "	    //		       +((GraphNode)m_nodes.elementAt(nodeLevels[i][j])).ID	    //		       +" uConnectivity: "+priorities[j]+" uBC: "+BC[j]+" position: "	    //		       +horPositions[nodeLevels[i][j]]);	}		int minPosition = horPositions[0];		for(int i=0; i<horPositions.length; i++)	    if(horPositions[i]<minPosition)		minPosition=horPositions[i];	if(minPosition<0) {	    minPosition = minPosition*-1;	    for(int i=0; i<horPositions.length; i++){		//System.out.print(horPositions[i]);		horPositions[i]+=minPosition;		//System.out.println(">"+horPositions[i]); 	    }	}		//int nodeHeight = m_nodeHeight*2; //m_fm.getHeight()*2;	for(int i=0, temp=0; i<nodeLevels.length; i++) {	    for(int j=0; j<nodeLevels[i].length; j++) {		temp=nodeLevels[i][j];		//horPositions[temp]=j;		GraphNode n = (GraphNode)m_nodes.elementAt(temp);		n.x = horPositions[temp]*m_nodeWidth;		n.y = i*3*m_nodeHeight;	    }	}	//setAppropriateSize();    }