修改后提交

pull/1/head
阴仁辉 2 years ago
parent d99d9fa617
commit d976c10188

@ -1,153 +0,0 @@
package domain;
/**
* @author laoyingyong
* @date: 2020-02-05 13:28
*/
public class Example implements Comparable<Example>
{
private Integer id;
private String name;
private String type;
private String source;
private Double multiple;
private Integer distance;
private String toxicity;
private String danger;
private String stability;
private String solubility;
private String volatility;
private String technology;
private Double sim;
public Double getSim() {
return sim;
}
public void setSim(Double sim) {
this.sim = sim;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public Double getMultiple() {
return multiple;
}
public void setMultiple(Double multiple) {
this.multiple = multiple;
}
public Integer getDistance() {
return distance;
}
public void setDistance(Integer distance) {
this.distance = distance;
}
public String getToxicity() {
return toxicity;
}
public void setToxicity(String toxicity) {
this.toxicity = toxicity;
}
public String getDanger() {
return danger;
}
public void setDanger(String danger) {
this.danger = danger;
}
public String getStability() {
return stability;
}
public void setStability(String stability) {
this.stability = stability;
}
public String getSolubility() {
return solubility;
}
public void setSolubility(String solubility) {
this.solubility = solubility;
}
public String getVolatility() {
return volatility;
}
public void setVolatility(String volatility) {
this.volatility = volatility;
}
public String getTechnology() {
return technology;
}
public void setTechnology(String technology) {
this.technology = technology;
}
@Override
public String toString() {
return "Example{" +
"id=" + id +
", name='" + name + '\'' +
", type='" + type + '\'' +
", source='" + source + '\'' +
", multiple=" + multiple +
", distance=" + distance +
", toxicity='" + toxicity + '\'' +
", danger='" + danger + '\'' +
", stability='" + stability + '\'' +
", solubility='" + solubility + '\'' +
", volatility='" + volatility + '\'' +
", technology='" + technology + '\'' +
", sim=" + sim +
'}';
}
@Override
public int compareTo(Example example)
{
return this.sim<example.sim?1:this.sim>example.sim?-1:0;
}
}

@ -1,175 +0,0 @@
package util;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
/**
* @author laoyingyong
* @date: 2020-02-05 14:32
*/
public class ExampleUtils
{
public static double getMultipleNum(double n)
{
if(n>=100)
{ return 1;}
else if(n>=90)
{ return 0.9;}
else if(n>=80)
{return 0.8;}
else if(n>=70)
{return 0.7;}
else if(n>=60)
{return 0.6;}
else if(n>=50)
{return 0.5;}
else if(n>=40)
{return 0.4;}
else if(n>=30)
{return 0.3;}
else if(n>=20)
{return 0.2;}
else if(n>=0)
{return 0.1;}
else {System.out.println("倍数不能为负数!");return 0;}//倍数不可能为负数
}
public static double getDistanceNum(double n)
{
if(n>=270)
{ return 1;}
else if(n>=240)
{ return 0.9;}
else if(n>=210)
{return 0.8;}
else if(n>=180)
{return 0.7;}
else if(n>=150)
{return 0.6;}
else if(n>=120)
{return 0.5;}
else if(n>=90)
{return 0.4;}
else if(n>=60)
{return 0.3;}
else if(n>=30)
{return 0.2;}
else if(n>=0)
{return 0.1;}
else {System.out.println("距离不能为负数!");return 0;}//距离不可能为负数
}
public static double getToxicityNum(String toxicity)
{
if(toxicity.equals("微毒"))
{
return 0.1;
}
else if(toxicity.equals("低毒"))
{
return 0.3;
}
else if(toxicity.equals("中等毒"))
{
return 0.5;
}
else if(toxicity.equals("高毒"))
{
return 0.7;
}
else if(toxicity.equals("剧毒"))
{
return 0.9;
}
else
{
System.out.println("污染毒性等级有误!");
return 0;
}
}
public static double getDangerNum(String danger)
{
if(danger.equals("可燃"))
{
return 0.2;
}
else if(danger.equals("易燃"))
{
return 0.5;
}
else if(danger.equals("易燃易爆"))
{
return 0.8;
}
else
{
System.out.println("污染物危险等级有误!");
return 0;
}
}
public static double getStabilityNum(String stability)
{
if(stability.equals("不稳定"))
{
return 0.2;
}
else if(stability.equals("中等"))
{
return 0.5;
}
else if(stability.equals("稳定"))
{
return 0.8;
}
else
{
System.out.println("污染物稳定性等级有误!");
return 0;
}
}
public static double getSolubilityNum(String solubility)
{
if(solubility.equals("不溶于水"))
{
return 0.2;
}
else if(solubility.equals("微溶于水"))
{
return 0.5;
}
else if(solubility.equals("易溶于水"))
{
return 0.8;
}
else
{
System.out.println("污染物溶解性等级有误!");
return 0;
}
}
public static double getVolatilityNum(String volatility)
{
if(volatility.equals("不易挥发"))
{
return 0.2;
}
else if(volatility.equals("中等挥发"))
{
return 0.5;
}
else if(volatility.equals("易挥发"))
{
return 0.8;
}
else
{
System.out.println("污染物挥发性等级有误!");
return 0;
}
}
}
Loading…
Cancel
Save