Info

3 public interface Soillnterface {

4 public double getSWFac();

5 public void initialize();

6 public void initialize(Properties props);

7 public void calculateRate();

8 public void integrate();

9 public void setWeather(WeatherInterface weather);

10 public void setPlant(PlantInterface plant);

Figure 8-30. Java code for interface IS oil.

Note that lines 5 and 6 define the same method named initializeQ with different signatures. The method initializeQ, with no parameters, can be used in cases when users do not provide any initial soil data. In this case, the default soil data will be used and the initializeQ method will be activated. The method initialize(Properties props) will be used when users want to study the impact on plant growth of different soil parameters such as soil depth and wilting point percentage. These parameters will be stored in the property file and are an entry for the simulation process. In the case that other soil parameters need to be considered for the study, their values will be added to the property file. Figure 8-31 shows class Soil implementing the ISoil interface. Therefore, class Soil agrees to provide an implementation for all the methods defined in the interface ISoil.

0 0

Post a comment