java ƽºâ¶þ²æÊ÷ʵÏÖ
////////////////////////////////////////////////½ÚµãÀà TreeNode.java //////////////////////////
package com.tree;
class TreeNode {//°ü·ÃÎÊȨÏÞ
long data ;
long x,y;
String adrr;
TreeNode left;
TreeNode right;
int size=0;
public TreeNode(){};
public TreeNode(long data,long x,long y,String addr){
size++;
this.data=data;
this.x=x;
this.y=y;
this.adrr=addr;
}
public TreeNode(long data ,TreeNode left ,TreeNode right){
size++;
this.data=data;
this.left=left;
this.right=right;
}
public long getData() {
return data;
}
public void setData(long data) {
this.data = data;
}
public long getX() {
return x;
}
public void setX(long x) {
this.x = x;
}
public long getY() {
return y;
}
public void setY(long y) {
this.y = y;
}
public TreeNode getLeft() {
return left;
}
public void setLeft(TreeNode left) {
this.left = left;
}
public TreeNode getRight() {
return right;
}
public void setRight(TreeNode right) {
this.right = right;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getAdrr() {
return adrr;
}
public void setAdrr(String adrr) {
this.adrr = adrr;
}
}
///////////////////////////////////////// tree.java /////////////////////////////
package com.tree;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Random;
import com.vdoany.db.DbHandle;
public class Tree {
private
Ïà¹ØÎĵµ£º
ÏÈÀ´Á˽âÒ»ÏÂÁ´±íģʽµÄÔÀí£º
Ê×ÏÈдһ¸öJavaBean£¬ÄÚÈÝÊÇÒªÌí¼ÓµÄÔªËغ͸ÃÔªËصĽڵ㡣
public class NodeBean implements Serializable
{
private Object data; //ÔªËر¾Éí
private NodeBean next; //ÏÂÒ»¸ö½Úµã
&n ......
Ö÷Ïß³ÌÖУº
InitThread initThread=new InitThread(new Semaphore(0));//³õʼ»¯Ò»¸ö×ÓỊ̈߳¬´«Ò»¸ö³õֵΪ0µÄÐźÅÁ¿¸øËü
Display.getDefault().asyncExec(initThread);
try {//´Ë´¦»á¹ÒÆð£¬Ö±µ½×ÓÏß³ÌÍê³É¹¤×÷£¬ÐÞ¸ÄÁËÐźÅÁ¿µÄÖµ£¬Ö÷Ï̲߳Żá¼ÌÐø
initThread.getSemaphore().acquire();
} catch (Inte ......
·½·¨¾ÍÊÇÒ»¶Î¿ÉÖظ´µ÷ÓõĴúÂë¶Ë
·½·¨µÄ¶¨ÒåÔÚJavaÖÐÓжàÖÖÐÎʽ£¬
ÏÖÔÚµÄÎÒËù˵µÄ·½·¨¾ÍÊÇÖ¸¿ÉÒÔÓÃmain·½·¨Ö±½ÓÈ¥µ÷Óõķ½·¨¡£
public class JavaDemo06
{
public static void main(String args[])
{
printTab() ;
}
// ¶¨ÒåÒ»¸ö·½·¨£¬´Ë·½·¨ÓÃÓÚ´òÓ¡Hello World
// public static±ØÐë¼ÓÉÏ£¬ÒòΪÊÇÓ ......
/*×÷ÓãºÓû§ÊäÈë×Ô¼ºµÄÃû×Ö£¬ÏÔʾһ¾äÎʺòÓï¡£
ʱ¼ä£º2010Äê4ÔÂ20ÈÕ¡£
×÷Õߣºenfang.
*/
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class KeyboardReader¡¡//×÷Ó㺴ӼüÅ̶ÁÈëÊý¾Ý
{
¡¡¡¡private BufferedReader reader;
¡¡¡¡& ......