Commit ee424024 authored by ymwang's avatar ymwang

第一次合并尝试

parent 6a1f8be3
......@@ -89,6 +89,9 @@ public class BisheTestMain implements ApplicationRunner {
for(int i =0;i<lastHop.length;i++){
for (int j=0;j<lastHop[0].length;j++){
route[i][j] = "sate"+lastHop[i][j];
if (route[i][j].equals("sate0")){
route[i][j]="sate"+(i+1);
}
}
}
dataPackage.setRoute(route);
......@@ -96,7 +99,7 @@ public class BisheTestMain implements ApplicationRunner {
System.out.println("========================================");
System.out.println();
String file_path = "C:\\Users\\225\\Pictures\\Camera Roll\\passport.jpg";
String file_path = "passport.jpg";
Picture picture = loadPicture(file_path);
dataPackage.setPicture(picture);
dataPackage.setCurrentSataHop("sate1");
......
......@@ -17,7 +17,7 @@ public class CycleTopo {
ToponetImpl tp = new ToponetImpl();
SimData sd = new SimData();
//tp.delHistory();
File file = new File("D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt");
File file = new File("topusim_1.txt");
//D:\LabratoryJavaPro\codingDownload\latestCoding\
List<WeiXingData> wxData = null;
try {
......
......@@ -27,7 +27,7 @@ public class TransferServiceImpl implements TransferService {
//获取目标节点ip
String app_name = nextHop;
System.out.println(app_name);
String IP = "127.0.0.1";//this.getIpByAppName(app_name);
String IP = "127.0.0.1";
System.out.println(IP);
//发送至目标
send(dataPackage, IP, 2020, startime);
......
......@@ -114,7 +114,9 @@ public class Application implements ApplicationRunner {
}
// }
} else {//仅作转发的节点
System.out.println("only transfer nextHop"+findService.findNextHop(dataPackage.getDestinSataHop(), route));
newDataPackage.setNextSataHop(findService.findNextHop(dataPackage.getDestinSataHop(), route));
System.out.println("only current nextHop"+dataPackage.getNextSataHop());
newDataPackage.setCurrentSataHop(dataPackage.getNextSataHop());
//创建时间
Date date = new Date();
......
......@@ -4,30 +4,24 @@ import com.pitong.business.service.transfer.FindService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
@Service
public class FindServiceImpl implements FindService {
@Override
public ArrayList<String> findDestinSataHops(String[] pathTable,String currenthop) {
ArrayList<String> destinSataHops = new ArrayList<>();
public ArrayList<String> findDestinSataHops(String[] pathTable, String currenthop) {
ArrayList<String> destinSataHops = new ArrayList<String>();
int j = 0;
if(pathTable.length == 0){
System.out.println("路径表为空");
destinSataHops.add(0,"nopara");
destinSataHops.add("nopara");
return destinSataHops;
}
for (int i = 0; i < pathTable.length; i++) {
//判断本机是否为路径起点
if(currenthop.equals(pathTable[i].split("->")[0])){
/* System.out.println(Arrays.toString(pathTable));
System.out.println();
System.out.println(currenthop);
System.out.println("destinSataHops index"+j);
System.out.println("pathTable[i].split(\"->\")[1]"+pathTable[i].split("->")[1]);*/
destinSataHops.add(j++,pathTable[i].split("->")[1]);
destinSataHops.add(pathTable[i].split("->")[1]);
}
}
if(destinSataHops.size() == 0){
......@@ -68,6 +62,7 @@ public class FindServiceImpl implements FindService {
//找到本卫星的路由
private String[] findCurrentRoute(String sataname, String[][] routeTable){
int index = Integer.parseInt(sataname.split("sate")[1]);
System.out.println(index);
return routeTable[index-1];
}
}
......
......@@ -277,7 +277,7 @@ public class WxTests {
ToponetImpl tp = new ToponetImpl();
SimData sd = new SimData();
//tp.delHistory();
File file = new File("D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt");
File file = new File("G:\\code\\cnf\\topusim_1.txt");
// D:\LabratoryJavaPro\codingDownload\latestCoding\
List<WeiXingData> wxData = wx.iniTopo(file,sd.getZhouqi());
int[][] toponet = tp.getTopology(wxData,sd);
......
package top.ninwoo.edgecenter.service;
import com.sun.xml.internal.ws.spi.db.DatabindingException;
//import com.sun.xml.internal.ws.spi.db.DatabindingException;
import top.ninwoo.common.entity.NetworkTopology;
import java.text.ParseException;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment