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

YLi convert to maven #43

Open
wants to merge 3 commits 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
6 changes: 0 additions & 6 deletions .classpath

This file was deleted.

17 changes: 0 additions & 17 deletions .project

This file was deleted.

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

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

####如何编译工程
首先您得安装 [maven](https://maven.apache.org)


MacOs可以使用 ```brew install maven```

使用```maven install```编译工程

使用 ```mvn exec:java``` 运行主类(UI)

50 changes: 50 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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>KikiLetGo</groupId>
<artifactId>VirusBroadcast</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>ui.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
3 changes: 2 additions & 1 deletion src/Bed.java → src/main/java/entity/Bed.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package entity;

/**
* 床位
*
*
* @ClassName: Bed
* @Description: 床位
* @author: Bruce Young
Expand Down
2 changes: 2 additions & 0 deletions src/City.java → src/main/java/entity/City.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package entity;

/**
* 城市描述对象
*
Expand Down
5 changes: 4 additions & 1 deletion src/Hospital.java → src/main/java/entity/Hospital.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package entity;

import util.Constants;

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

/**
* 医院
Expand Down
4 changes: 3 additions & 1 deletion src/MoveTarget.java → src/main/java/entity/MoveTarget.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package entity;

/**
* 位移目标对象
*
Expand All @@ -9,7 +11,7 @@
public class MoveTarget {
private int x;
private int y;
private boolean arrived=false;//是否到达目标点
private boolean arrived = false;//是否到达目标点

public MoveTarget(int x, int y) {
this.x = x;
Expand Down
6 changes: 6 additions & 0 deletions src/Person.java → src/main/java/entity/Person.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
package entity;

import ui.MyPanel;
import util.Constants;
import util.MathUtil;

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

Expand Down
6 changes: 5 additions & 1 deletion src/PersonPool.java → src/main/java/entity/PersonPool.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package entity;

import util.Constants;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand Down Expand Up @@ -40,7 +44,7 @@ public int getPeopleSize(int state) {
}
return i;
}


private PersonPool() {
City city = new City(400, 400);//设置城市中心为坐标(400,400)
Expand Down
2 changes: 2 additions & 0 deletions src/Point.java → src/main/java/entity/Point.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package entity;

/**
* 位置坐标基类
*
Expand Down
2 changes: 2 additions & 0 deletions src/Virus.java → src/main/java/entity/Virus.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package entity;

/**
* 病毒对象
*
Expand Down
9 changes: 8 additions & 1 deletion src/Main.java → src/main/java/ui/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import javax.swing.*;
package ui;

import entity.Hospital;
import entity.Person;
import entity.PersonPool;
import ui.MyPanel;
import util.Constants;

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

Expand Down
8 changes: 7 additions & 1 deletion src/MyPanel.java → src/main/java/ui/MyPanel.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
package ui;

import entity.Hospital;
import entity.Person;
import entity.PersonPool;
import util.Constants;

import javax.swing.*;
import java.awt.*;
import java.util.List;
Expand All @@ -15,7 +22,6 @@
public class MyPanel extends JPanel implements Runnable {



public MyPanel() {
super();
this.setBackground(new Color(0x444444));
Expand Down
2 changes: 2 additions & 0 deletions src/Constants.java → src/main/java/util/Constants.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package util;

/**
* 模拟参数
*
Expand Down
2 changes: 2 additions & 0 deletions src/MathUtil.java → src/main/java/util/MathUtil.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package util;

import java.util.Random;

/**
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/entity/TestPersonPool.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package entity;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import util.Constants;

public class TestPersonPool {
@Test
public void testPeopleSizeInitialState() {
PersonPool personPool = PersonPool.getInstance();
Assertions.assertEquals(Constants.CITY_PERSON_SIZE, personPool.getPeopleSize(-1));
}
}