几种常见的数据结构的JAVA实现
ITree
package utility.structure.def;
/**
*
* @author odie.tang
*
* @version 1.0 10/30/09
*/
public interface ITree<E>{
E getData();
E remove();
void setData(E e);
int getDepth();
int getLevel();
ITree<E> getRoot();
ITree<E> getParent();
ITree<E> getFirstChild();
ITree<E> addFirtChild(E e);
ITree<E> getLastChild();
ITree<E> addLastChild(E e);
ITree<E> getNode(E e);
boolean isLeaf();
boolean isRoot();
boolean remove(E e);
}
IBinaryTree
package utility.structure.def;
public interface IBinaryTree<E> extends ITree<E>{
boolean hasLeftChild();
boolean isLeftChild();
IBinaryTree<E> getLeftChild();
IBinaryTree<E> addLeftChild(E e);
boolean hasRightChild();
boolean isRightChild();
IBinaryTree<E> getRightChild();
IBinaryTree<E> addRightChild(E e);
}
BinaryTree
package utility.structure;
import java.io.Serializable;
import java.util.ConcurrentModificationException;
import utility.structure.def.IBinaryTree;
import utility.structure.def.ITree;
/**
*
* @author odie.tang
*
* @since 1.0 11/01/09
*/
public class BinaryTree<E> implements IBinaryTree<E>,Serializable{
private static final long serialVersionUID = 1565285530988892541L;
private E data;
private BinaryTree<E> parent = null;
private BinaryTree<E> leftChild = null;
private BinaryTree<E> rightChild = null;
private int level;
private enum Child{left,right}
public BinaryTree(E root) {
this.data = root;
this.level = 1;
}
public BinaryTree(E root, E leftChild){
this.data = root;
this.level = 1;
new BinaryTree<E>(this,Child.left,leftChild);
}
public BinaryTree(E root, E leftChild,E rightChild){
this.data = root;
this.level = 1;
new BinaryTree<E>(this,Child.left,leftChild);
new BinaryTre
相关文档:
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
......
比如applet文件是AppletTest.class
1)
在AppletTest.java的代码中
使用默认包,即不用package语句
在html页中的代码是
<applet code="AppletTest.class" width="400" height="300">
</applet>
AppletTest.class文件和html页放在一个文件夹中
2)
在AppletTest.java的代码中
package xx.yy;
在html页 ......
计算一下时间!我开始学习JAVA编程已经两个月了,每节课都是在学习一下理论的东西。感觉上没啥用处一样,所以自己着手做一些简单的JAVA编程。第一次编程肯定没法跟大师们比较了,但是这也见证了我努力的结果!
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import javax.swing.JPassword ......
猪年无聊,改了一个代码,有点D版那个意思,把WAP PUSH的C#代码改到了JAVA
原来出处:
http://www.codeproject.com/cs/internet/wappush.asp
改过后的代码在下面,程序好像可以输出了WAPPUSH的结构化的东西,但是,没有在CMPP协议上测试通过。
共7个文件:
package com.wap.wbxml;
public class Runner {
&nbs ......