Browse Source

update with clone &equals

master
zheng 6 years ago
parent
commit
4a33dc19ff
  1. 16
      src/com/fr/plugin/demo/DemoChart.java
  2. 19
      src/com/fr/plugin/demo/DemoDataConfig.java

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

@ -6,6 +6,7 @@ import com.fr.extended.chart.ExtendedHelper;
import com.fr.extended.chart.HyperLinkPara;
import com.fr.extended.chart.export.ExportProcessor;
import com.fr.extended.chart.export.JSExportProcessor;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.json.JSON;
import com.fr.json.JSONArray;
@ -52,6 +53,21 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
ExtendedHelper.writeFormula(this.getTitleFormula(), writer, "title");
}
@Override
public Object clone() throws CloneNotSupportedException {
DemoChart result = (DemoChart) super.clone();
result.setTitleFormula(this.getTitleFormula().clone());
return result;
}
@Override
public boolean equals(Object ob) {
return super.equals(ob)
&& ob instanceof DemoChart
&& ComparatorUtils.equals(this.getTitleFormula(), ((DemoChart) ob).getTitleFormula())
;
}
@Override
protected String getChartID() {
return ID;

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

@ -2,6 +2,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.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
@ -60,4 +61,22 @@ public class DemoDataConfig extends AbstractDataConfig {
z
};
}
@Override
public DemoDataConfig clone() throws CloneNotSupportedException {
DemoDataConfig result = new DemoDataConfig();
result.setX(this.getX().clone());
result.setY(this.getY().clone());
result.setZ(this.getZ().clone());
return result;
}
@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())
;
}
}

Loading…
Cancel
Save