⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 citymap.java

📁 利用模拟退火算法解决旅行商问题的java原码
💻 JAVA
字号:
public class CityMap
{
	String city;
	double xpos;
	double ypos;
	public CityMap(String s_city)
	{
		String _city[]=new String[3];
		_city=get_info(s_city,(int)'\t');
		city=_city[0];
		Double doubl;
		doubl=Double.valueOf(_city[1]);
		xpos=doubl.doubleValue();
		doubl=Double.valueOf(_city[2]);
		ypos=doubl.doubleValue();

	}
	public CityMap()
	{

		city="";
		xpos=0.0;
		ypos=0.0;

	}
	/**
	*method: splitString
	*param: args the string to split
	*param: c	the char you want to match
	*return:  a array 
	*/
	public static String[] get_info(String arg,int c)
	{	
		String[] _array=new String[6];
		int cc=0;
		//System.out.println(arg.indexOf(c));
		
		while(arg.indexOf(c)!=-1)
        {
			_array[cc]=arg.substring(0,arg.indexOf(c));
			arg=arg.substring(arg.indexOf(c)+1,arg.length());
			cc++;
        }
		_array[cc]=arg;

    	return _array;
	}
	/**
	*method:getcity()
	*/
	public String getcity()
	{
		return city;
	}
	/**
	*method:
	*/
	public double getxpos()
	{
		return xpos;
	}/**
	*method:
	*/
	public double getypos()
	{
		return ypos;
	}
	/**
	*method: 
	*/
	public void setcity(String c)
	{
		city=c;
	}
	/**
	*method: 
	*/
	public void setxpos(double c)
	{
		xpos=c;
	}
	/**
	*method: 
	*/
	public void setypos(double c)
	{
		ypos=c;
	}



};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -