Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

转换 Maven 结构项目. #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.iml
out/
*.class
target/
6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,18 @@

2020.2.6:
病毒变异过程是一个不断适应的过程,可以尝试简单的DNN对病毒进行建模,已经开始着手实施。

## Maven 用法

```sh
# 编译
mvn compile
# 运行
mvn exec:java -Dexec.mainClass="com.github.KikiLetGo.VirusBroadcast"

# 打包
mvn package
# 复制 jar 包 target/VirusBroadcast-1.0-SNAPSHOT.jar 即可单独执行
cp target/VirusBroadcast-1.0-SNAPSHOT.jar ~/
java -jar ~/VirusBroadcast-1.0-SNAPSHOT.jar
```
60 changes: 60 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.KikiLetGo</groupId>
<artifactId>VirusBroadcast</artifactId>
<version>1.0-SNAPSHOT</version>

<name>VirusBroadcast</name>
<url>https://github.com/KikiLetGo/VirusBroadcast</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.github.KikiLetGo.VirusBroadcast</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.github.KikiLetGo.VirusBroadcast</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
2 changes: 2 additions & 0 deletions src/Bed.java → src/main/java/com/github/KikiLetGo/Bed.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

/**
* 床位
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

/**
* 城市描述对象
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

/**
* 模拟参数
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.KikiLetGo;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
* 医院
Expand Down
78 changes: 40 additions & 38 deletions src/MathUtil.java → ...n/java/com/github/KikiLetGo/MathUtil.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
import java.util.Random;

/**
* 数学算法工具类
*
* @ClassName: MathUtil
* @Description: 数学算法工具类
* @author: Bruce Young
* @date: 2020年02月06日 11:27
*/
public class MathUtil {
/**
* 仅仅使用一个随机数生成器
*/
private static final Random randomGen = new Random();

/**
* 标准正态分布化
* <p>
* 流动意愿标准化后判断是在0的左边还是右边从而决定是否流动。
* <p>
* 设X随机变量为服从正态分布,sigma是影响分布形态的系数 u值决定正态分布均值
* <p>
* <p>
* 推导:
* StdX = (X-u)/sigma
* X = sigma * StdX + u
*
* @param sigma 正态标准差sigma值
* @param u 正态均值参数mu
* @return
*/
public static double stdGaussian(double sigma, double u) {
double X = randomGen.nextGaussian();
return sigma * X + u;
}

}
package com.github.KikiLetGo;

import java.util.Random;

/**
* 数学算法工具类
*
* @ClassName: MathUtil
* @Description: 数学算法工具类
* @author: Bruce Young
* @date: 2020年02月06日 11:27
*/
public class MathUtil {
/**
* 仅仅使用一个随机数生成器
*/
private static final Random randomGen = new Random();

/**
* 标准正态分布化
* <p>
* 流动意愿标准化后判断是在0的左边还是右边从而决定是否流动。
* <p>
* 设X随机变量为服从正态分布,sigma是影响分布形态的系数 u值决定正态分布均值
* <p>
* <p>
* 推导:
* StdX = (X-u)/sigma
* X = sigma * StdX + u
*
* @param sigma 正态标准差sigma值
* @param u 正态均值参数mu
* @return
*/
public static double stdGaussian(double sigma, double u) {
double X = randomGen.nextGaussian();
return sigma * X + u;
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

/**
* 位移目标对象
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

import javax.swing.*;
import java.awt.*;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

import java.util.List;
import java.util.Random;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

/**
* 位置坐标基类
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.github.KikiLetGo;

/**
* 病毒对象
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import javax.swing.*;
package com.github.KikiLetGo;

import javax.swing.*;
import java.util.List;
import java.util.Random;

Expand All @@ -9,7 +10,7 @@
* @author
* @comment GinRyan
*/
public class Main {
public class VirusBroadcast {

public static void main(String[] args) {
initHospital();
Expand Down
20 changes: 20 additions & 0 deletions src/test/java/com/github/KikiLetGo/VirusBroadcastTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.KikiLetGo;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
* Unit test for simple App.
*/
public class VirusBroadcastTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}