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 add lombok #44

Open
wants to merge 4 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)

71 changes: 71 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?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.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.10.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
</plugin>
<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>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
42 changes: 0 additions & 42 deletions src/MoveTarget.java

This file was deleted.

16 changes: 7 additions & 9 deletions src/Bed.java → src/main/java/entity/Bed.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package entity;

import lombok.Getter;
import lombok.Setter;

/**
* 床位
*
*
* @ClassName: Bed
* @Description: 床位
* @author: Bruce Young
Expand All @@ -15,13 +19,7 @@ public Bed(int x, int y) {
/**
* 是否占用了该床位
*/
@Setter
@Getter
private boolean isEmpty = true;

public boolean isEmpty() {
return isEmpty;
}

public void setEmpty(boolean empty) {
isEmpty = empty;
}
}
25 changes: 9 additions & 16 deletions src/City.java → src/main/java/entity/City.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
package entity;

import lombok.Getter;
import lombok.Setter;

/**
* 城市描述对象
*
Expand All @@ -7,27 +12,15 @@
* @date: 2020年02月02日 17:48
*/
public class City {
@Getter
@Setter
private int centerX;
@Getter
@Setter
private int centerY;

public City(int centerX, int centerY) {
this.centerX = centerX;
this.centerY = centerY;
}

public int getCenterX() {
return centerX;
}

public void setCenterX(int centerX) {
this.centerX = centerX;
}

public int getCenterY() {
return centerY;
}

public void setCenterY(int centerY) {
this.centerY = centerY;
}
}
18 changes: 7 additions & 11 deletions src/Hospital.java → src/main/java/entity/Hospital.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package entity;

import lombok.Getter;
import util.Constants;

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

/**
* 医院
Expand All @@ -15,19 +19,11 @@
public class Hospital extends Point {
public static final int HOSPITAL_X = 720;
public static final int HOSPITAL_Y = 80;
@Getter
private int width;
@Getter
private int height = 600;

public int getWidth() {
return width;
}


public int getHeight() {
return height;
}


private static Hospital hospital = new Hospital();

public static Hospital getInstance() {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/entity/MoveTarget.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package entity;

import lombok.Getter;
import lombok.Setter;

/**
* 位移目标对象
*
* @ClassName: MoveTarget
* @Description: 位移目标对象
* @author: Bruce Young
* @date: 2020年02月02日 17:47
*/
public class MoveTarget {
@Getter
@Setter
private int x;
@Getter
@Setter
private int y;
@Getter
@Setter
private boolean arrived = false;//是否到达目标点

public MoveTarget(int x, int y) {
this.x = x;
this.y = y;
}
}
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
13 changes: 7 additions & 6 deletions src/PersonPool.java → src/main/java/entity/PersonPool.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
package entity;

import lombok.Getter;
import util.Constants;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
Expand All @@ -17,13 +22,9 @@ public static PersonPool getInstance() {
return personPool;
}

@Getter
List<Person> personList = new ArrayList<Person>();

public List<Person> getPersonList() {
return personList;
}


/**
* @param state 市民类型 Person.State的值,若为-1则返回当前总数目
* @return 获取指定人群数量
Expand All @@ -40,7 +41,7 @@ public int getPeopleSize(int state) {
}
return i;
}


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

import lombok.Getter;
import lombok.Setter;

/**
* 位置坐标基类
*
Expand All @@ -7,7 +12,11 @@
* @date: 2020年02月02日 20:59
*/
public class Point {
@Setter
@Getter
private int x;
@Setter
@Getter
private int y;

public Point(int x, int y) {
Expand All @@ -25,20 +34,4 @@ public void moveTo(int x, int y) {
this.x += x;
this.y += y;
}

public int getX() {
return x;
}

public void setX(int x) {
this.x = x;
}

public int getY() {
return y;
}

public void setY(int y) {
this.y = y;
}
}
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
Loading