?? testbydifficulty.java
字號:
package model.condition.test;
import model.persistency.ItemMapper;
import model.connection.*;
import java.util.ArrayList;
import java.sql.*;
//import model.condition.visitor.Visitor;
/**
* 繼承Testable,用于產(chǎn)生某一難度的所有試題
*/
public class TestByDifficulty implements Testable {
private ArrayList test;
private String condition;//難度
/**
* 構(gòu)造函數(shù)
* @param difficulty 難度
*/
public TestByDifficulty(String difficulty){
condition = new String();
condition = difficulty;
test = new ArrayList();
}
/**
* 用于返回試卷
* @return ArrayList類型 返回試卷
*/
public ArrayList getList(){
return test;
}
/**
* 接收產(chǎn)生某一難度的試卷請求
*/
public void accept(){
ItemMapper itemMap = null;
try{
Connectable con = new ConnectionAccess("sun.jdbc.odbc.JdbcOdbcDriver");
//itemMap = ItemMapper.getInstance(con);
itemMap = new ItemMapper(con);
test = itemMap.getItemByDifficulty(this.condition);
}catch(SQLException e){
System.out.println("sql exception");
}
catch(ClassNotFoundException l){
System.out.println("class not found");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -