Hi,
I've got a class that has constructor:
public ContEmpirical(double xs[], double fs[]) {
Check.check(xs.length == fs.length + 1 && fs.length > 0,
"Empirical distribution array mismatch");
this.xs = new double[xs.length];
this.xs = xs;
this.cs = new double[xs.length];
double fTotal = 0.0;
for (int i = 0; i < fs.length; i++)
fTotal += fs[i];
cs[0] = 0;
for (int i = 0; i < fs.length; i++)
cs[i + 1] = cs[i] + fs[i] / fTotal;
}
Attributes:
private double xs[], cs[];
private double fs[]; // this attribute i added to make castors life easier since it always wants to map constructor arg to class attribute.
The mapping File i have is:
<class name="tools.ContEmpirical">
<description xmlns="">
Mapping for class tools.ContEmpirical
</description>
<map-to xml="ContEmpirical"/>
<field name="xs" type="double" collection="array" set-method="%1" get-method="getXs" required="true">
<bind-xml node="attribute"/>
</field>
<field name="fs" type="double" collection="array" set-method="%2" get-method="getFs" required="true">
<bind-xml node="attribute"/>
</field></class>
Yet when i try to marshall an instance of ContEmpirical I get this XML:
<ContEmpirical xs="0.2 0.3 0.4 0.8"/>
When really I should be getting something like this:
<ContEmpirical xs="0.2 0.3 0.4 0.8" fs="0.2 0.3 0.4 0.8"/>
Is there something I'm missing from the mapping?