?? test.java
字號:
package structs;
public class Test{
static Struct university;
static Libarary liba;
static Libarary libb;
static BookShelf shelfa;
static BookShelf shelfb;
static BookShelf shelfc;
static BookShelf shelfd;
static Book[] books;
static String[] keys;
static String keys2;
public static void display(){
liba.preDisplay("o---");
libb.display("o---");
}
public static void seekers(){
String target="compute public hello";
Book[] reg=new Book[3];
//通過搜索得到實例
//boolean t=books[0].hasKWS("computer");
reg[0]=liba.skByKW("computer");//通過關鍵字搜索
reg[1]=(Book)shelfa.skByName(books[3].Name);//通過名稱搜索
reg[2]=libb.skByKW("Math");
//boolean[] record=book.compareTo(target);
for(int i=0;i<3;i++){
if(reg[i]!=null)
System.out.println("Found Name:"+reg[i].Name);
else
System.out.println("The "+i+"st NotFound!");
}
System.out.println("URL "+liba.find(books[0]));//通過實例搜索得到路徑
}
public static void add(){
university.add(liba);
//university.add(libb);
Book book=new Book("testBook","Science");
BookShelf shelf=new BookShelf("TestShelf");
Page[] ps=new Page[]{
new Page("page1"),new Page("page2"),new Page("page3"),
new Page("page4"),new Page("page5"),new Page("page6")
};
books[0].addSubs(ps);//為第一本書加6頁
//liba.add(shelf);//為圖書室a加一個書架
// liba.add(book);//為圖書室加一本書
liba.add("libB.shelfC",book);//通過路徑加書
//libb.add("libB.shelfC",book);
university.preDisplay("o---");
//libb.preDisplay("o---");
}
public static void del(){
liba.display("o---");
liba.del(libb); //圖書
liba.del(books[0]);
liba.del(shelfb);
liba.display("o---");
}
public static void main(String[] args){
init();
display();
//seekers();
// add();
// del();
}
public static void init(){
university=new Struct("NCEPU");
liba=new Libarary("libA");
libb=new Libarary("libB");
shelfa=new BookShelf("shelfA","Math");
shelfb=new BookShelf("shelfB","Computer");
shelfc=new BookShelf("shelfC","Science");
shelfd=new BookShelf("shelfD","Literature");
keys=new String[]{"computer","public","hello"};
keys2="computer public hello";
books=new Book[]{
new Book("booka","computer"),new Book("bookb","Literature"),
new Book("bookc","Computer"),new Book("bookd","Math"),
new Book("booke","Computer"),new Book("bookf","Literature"),
new Book("bookg","Computer"),new Book("bookh","Science")
};
liba.add(libb);
liba.add(shelfa);
liba.add(shelfb);
libb.add(shelfc);
libb.add(shelfd);
libb.add(shelfa);
for(int i=0;i<4;i++){
liba.add(books[i]);
libb.add(books[i+4]);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -