V2_1.java [src/java/m/sq/sci] Revision: default Date:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package m.sq.sci;
import csip.ModelDataService;
import csip.annotations.*;
import static csip.annotations.State.DEVELOPMENT;
import static m.sq.Constants.*;
import javax.ws.rs.Path;
/**
* SCI service.
*
* @author od
*/
@Name("SCI")
@Description("SCI")
@State(DEVELOPMENT)
@Path("m/sci/2.1")
public class V2_1 extends ModelDataService {
private double water_erosion;
private double water_om;
private double water_fo;
private double wind_erosion;
private double wind_om;
private double wind_fo;
private double sci_total;
@Override
protected void preProcess() throws Exception {
water_erosion = parameter().getDouble(KEY_EROSION_WATER);
water_om = parameter().getDouble(KEY_WATER_OM);
water_fo = parameter().getDouble(KEY_WATER_FO);
wind_erosion = parameter().getDouble(KEY_EROSION_WIND);
wind_om = parameter().getDouble(KEY_WIND_OM);
wind_fo = parameter().getDouble(KEY_WIND_FO);
}
@Override
public void doProcess() throws Exception {
sci_total = SCICalculator.calculateSCI(water_erosion, water_om,
water_fo, wind_erosion, wind_om, wind_fo);
}
@Override
protected void postProcess() throws Exception {
results().put(KEY_SCI_TOTAL, sci_total);
}
}