Browse Source

代码质量 hashcode&&assistutils

master
zheng 6 years ago
parent
commit
8f82a725da
  1. 10
      src/com/fr/plugin/demo/DemoChart.java
  2. 12
      src/com/fr/plugin/demo/DemoDataConfig.java

10
src/com/fr/plugin/demo/DemoChart.java

@ -15,6 +15,7 @@ import com.fr.json.JSONFactory;
import com.fr.json.JSONObject;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.stable.AssistUtils;
import com.fr.stable.web.Repository;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
@ -75,12 +76,17 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
return result;
}
@Override
public int hashCode() {
return super.hashCode() + AssistUtils.hashCode(this.getTitleFormula(), this.getThemeType());
}
@Override
public boolean equals(Object ob) {
return super.equals(ob)
&& ob instanceof DemoChart
&& ComparatorUtils.equals(this.getTitleFormula(), ((DemoChart) ob).getTitleFormula())
&& ComparatorUtils.equals(this.getThemeType(), ((DemoChart) ob).getThemeType())
&& AssistUtils.equals(this.getTitleFormula(), ((DemoChart) ob).getTitleFormula())
&& AssistUtils.equals(this.getThemeType(), ((DemoChart) ob).getThemeType())
;
}

12
src/com/fr/plugin/demo/DemoDataConfig.java

@ -3,6 +3,7 @@ package com.fr.plugin.demo;
import com.fr.extended.chart.AbstractDataConfig;
import com.fr.extended.chart.ExtendedField;
import com.fr.general.ComparatorUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
@ -71,12 +72,17 @@ public class DemoDataConfig extends AbstractDataConfig {
return result;
}
@Override
public int hashCode() {
return super.hashCode() + AssistUtils.hashCode(this.getX(), this.getY(), this.getZ());
}
@Override
public boolean equals(Object obj) {
return obj instanceof DemoDataConfig
&& ComparatorUtils.equals(this.getX(), ((DemoDataConfig) obj).getX())
&& ComparatorUtils.equals(this.getY(), ((DemoDataConfig) obj).getY())
&& ComparatorUtils.equals(this.getZ(), ((DemoDataConfig) obj).getZ())
&& AssistUtils.equals(this.getX(), ((DemoDataConfig) obj).getX())
&& AssistUtils.equals(this.getY(), ((DemoDataConfig) obj).getY())
&& AssistUtils.equals(this.getZ(), ((DemoDataConfig) obj).getZ())
;
}
}

Loading…
Cancel
Save