Commit 8c5f3535 authored by Elf's avatar Elf

csv修改

parent bedba911
package top.ninwoo.test.CsvMerge; package top.ninwoo.test.CsvMerge;
import top.ninwoo.test.doMap.DoMap; import top.ninwoo.test.doMap.DoMap;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import static top.ninwoo.test.CsvMerge.GetTopo.TopoRequire; import static top.ninwoo.test.CsvMerge.GetTopo.TopoRequire;
...@@ -15,25 +14,33 @@ public class Wteg { ...@@ -15,25 +14,33 @@ public class Wteg {
* 先用SimpleDateFormat.parse() 方法将日期字符串转化为Date格式 * 先用SimpleDateFormat.parse() 方法将日期字符串转化为Date格式
* 通过Date.getTime()方法,将其转化为毫秒数 * 通过Date.getTime()方法,将其转化为毫秒数
*/ */
public static double[][] getWteg() { public static double[][] getWteg() throws ParseException {
//传输时间参数 //传输时间参数
String str; String str;
String str1; String str1;
String str2; String str2;
//可在这里修改时间
//todo 应该放在yaml文件中
String dateInput = "5-00-00";
long time;
//测试时间 //测试时间
str = ReadFile.date+" 5-00-00"; str = ReadFile.date+" "+ dateInput;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Date current1 = new Date(sdf.parse(str).getTime()+ (long)DoMap.slot);
Date current2 = new Date(current1.getTime()+ (long)DoMap.slot);
//
str1 = sdf.format(current1);
str2 = sdf.format(current2);
//产生三个时隙
int[][] topo = TopoRequire(str); int[][] topo = TopoRequire(str);
str1 = ReadFile.date+" 5-00-20";
int[][] topo1 = TopoRequire(str1); int[][] topo1 = TopoRequire(str1);
str2 = ReadFile.date+" 5-00-40";
int[][] topo2 = TopoRequire(str2); int[][] topo2 = TopoRequire(str2);
//动态获取当前时间topo //动态获取当前时间topo
/* Date current = new Date(); /* Date current = new Date();
Date current1 = new Date(current.getTime()+ (long)DoMap.slot); Date current1 = new Date(current.getTime()+ (long)DoMap.slot);
Date current2 = new Date(current1.getTime()+ (long)DoMap.slot); Date current2 = new Date(current1.getTime()+ (long)DoMap.slot);
SimpleDateFormat sdf = new SimpleDateFormat( SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
"yyyy-MM-dd HH-mm-ss");
str = sdf.format(current); str = sdf.format(current);
str1 = sdf.format(current1); str1 = sdf.format(current1);
str2 = sdf.format(current2); str2 = sdf.format(current2);
......
package top.ninwoo.test.doMap; package top.ninwoo.test.doMap;
import org.springframework.beans.factory.annotation.Value;
import top.ninwoo.test.CsvMerge.Wteg; import top.ninwoo.test.CsvMerge.Wteg;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.HashMap;
import java.util.LinkedList;
import java.util.Random;
import java.util.Stack;
import static top.ninwoo.test.doMap.CycleTopo.cycleTp; import static top.ninwoo.test.doMap.CycleTopo.cycleTp;
...@@ -16,8 +20,6 @@ import static top.ninwoo.test.doMap.CycleTopo.cycleTp; ...@@ -16,8 +20,6 @@ import static top.ninwoo.test.doMap.CycleTopo.cycleTp;
* @jthu * @jthu
*/ */
public class DoMap { public class DoMap {
//最大权值 //最大权值
public static final int MAXWEIGHT = 10000*1000; public static final int MAXWEIGHT = 10000*1000;
...@@ -79,7 +81,7 @@ public class DoMap { ...@@ -79,7 +81,7 @@ public class DoMap {
//惯性权重,加速因子1,2 //惯性权重,加速因子1,2
static double s = 1.5; static int c1 = 1; static int c2 = 1; static double s = 1.5; static int c1 = 1; static int c2 = 1;
public static void main(String[] args) { public static void main(String[] args) throws ParseException {
//子任务依赖关系 边 //子任务依赖关系 边
int[][] link = {{0, 0, 1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 5, 6}}; int[][] link = {{0, 0, 1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 5, 6}};
//task编号 //task编号
...@@ -99,7 +101,7 @@ public class DoMap { ...@@ -99,7 +101,7 @@ public class DoMap {
//路由表 //路由表
public static int[][] lastHop; public static int[][] lastHop;
public static void doMapApp(int[][] link1, int[] func1) { public static void doMapApp(int[][] link1, int[] func1) throws ParseException {
link = link1; link = link1;
func = func1; func = func1;
......
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