a = paInfo.getBengBuWay(); }
if (cityName.trim().equals(\安庆市\ a = paInfo.getAnQingWay(); }
if (cityName.trim().equals(\芜湖市\ a = paInfo.getWuHuWay(); }
if (cityName.trim().equals(\淮北市\ a = paInfo.getHuaiBeiWay(); }
if (cityName.trim().equals(\阜阳市\ a = paInfo.getFuYangWay(); }
return a; } }
4、工厂类
public class factory {
private static factory fac = new factory(); public static factory getFac() { return fac; }
public userDAO getUserDAO() { return new userDAO(); } }
5、DAO层类
import java.io.BufferedReader;
import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class userDAO { public void write() { }
@SuppressWarnings(\
public List
FileReader file = this.choiceCity(name); try {
}
br = new BufferedReader(file); list = new ArrayList
str = br.readLine(); }
} catch (IOException e) { e.printStackTrace(); }
return list;
public FileReader choiceCity(String name) { FileReader file = null; int choice = 0;
if (name.equals(\合肥市\ choice = 1; }
if (name.equals(\蚌埠市\ choice = 2; }
if (name.equals(\安庆市\ choice = 3; }
if (name.equals(\阜阳市\ choice = 4; }
if (name.equals(\淮北市\ choice = 5; }
if (name.equals(\芜湖市\ choice = 6; } try {
switch (choice) { case 1:
file = new FileReader(path.getHeFeiPath()); break; case 2:
file = new FileReader(path.getBengBuPath());break; case 3:
file = new FileReader(path.getAnQingPath());break; case 4:
file = new FileReader(path.getFuYangPath());break;
case 5:
file = new FileReader(path.getHuaiBeiPath());break; case 6:
file = new FileReader(path.getWuHuPath()); break; }
} catch (FileNotFoundException e) { e.printStackTrace(); }
return file; } }
6、路径信息类
public class pathInfo {
public int[][] getHeFeiWay(){
int heFei[][]={
{0,2000,1400,800,800,10,1200,4000}, {2000,0,2400,2800,2800,2000,1600,2000}, {1400,2400,0,1600,1600,1400,800,4400}, {800,2800,1600,0,8,800,2400,4800}, {800,2800,1600,8,0,800,2400,4800}, {10,2000,1400,800,800,0,1200,4000}, {1200,1600,800,2400,2400,1200,0,3600},
{4000,4000,4400,4800,4800,4000,3600,0}, };
return heFei; }
public int[][] getBengBuWay(){ int bengBu[][]={
{0,2000,1500,4000,1200}, {2000,0,2400,4500,3000}, {1500,2400,0,2500,900}, {4000,4500,2500,0,3100},
{1200,3000,900,3100,0} }; return bengBu; }
public int[][] getAnQingWay(){ int anQing[][]={
{0,1850,400,1400,1000}, {1850,0,2250,1300,860}, {400,2250,0,1650,1400}, {1400,1300,1650,0,600},
{1000,860,1400,600,0} }; return anQing; }
public int[][] getWuHuWay(){ int wuHu[][]={
{0,400,700,500}, {400,0,260,1500}, {700,260,0,540},
{500,1500,540,0} }; return wuHu; }
public int[][] getFuYangWay(){ int fuYang[][]={
{0,1200,200}, {1200,0,700}, {200,700,0} };
return fuYang; }
public int[][] getHuaiBeiWay(){ int huaiBei[][]=null; return huaiBei; }
public int[][] getHeFeiZB(){ int
a[][]={{250,250},{450,240},{260,130},{50,230},{140,230},{244,270},{330,144},{450,380}};
return a; }
public int[][] getBengBuZB(){
int a[][]={{450,300},{362,180},{260,270},{90,270},{340,330}}; return a; }
public int[][] getAnQingZB(){
int a[][]={{350,300},{82,200},{450,320},{160,330},{240,210}}; return a; }
public int[][] getWuHuZB(){
int a[][]={{150,150},{330,150},{330,300},{150,380}}; return a; }
public int[][] getFuYangZB(){
int a[][]={{320,340},{100,210},{300,210}}; return a; }
public int[][] getHuaiBeiZB(){
int a[][]={{250,300},{82,110},{100,90},{83,320},{240,330}};
return a; } }
7、路径类
public class path {
static String heFeiPath = \合肥市.txt\ static String bengBuPath = \蚌埠市.txt\ static String anQingPath=\安庆市.txt\ static String wuHuPath=\芜湖市.txt\ static String fuYangPath=\阜阳市.txt\ static String huaiBeiPath=\淮北市.txt\ public static String getBengBuPath() { return bengBuPath; }
public static String getHeFeiPath() { return heFeiPath; }
public static String getAnQingPath() { return anQingPath; }
public static String getFuYangPath() { return fuYangPath; }
public static String getHuaiBeiPath() { return huaiBeiPath; }
public static String getWuHuPath() { return wuHuPath; } }
8、退火算法实现类
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
public class annealingMeans {
public static float wayLength = 0; private userOP usOP = new userOP();
List