Skip to content

Commit 301682e

Browse files
Merge pull request #46 from jazzjaikla/jazz-release-v1.0.1.0
Jazz release v1.0.1.0
2 parents fe28df2 + a99a2a4 commit 301682e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+7148
-5040
lines changed

src/DSSATModel/CropModel.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@ public class CropModel extends BaseModel {
1616
public String toString(){
1717
return Description;
1818
}
19+
20+
public int compare(CropModel c2){
21+
int compare = this.ModelCode.compareTo(c2.ModelCode);
22+
23+
if(compare == 0){
24+
compare = this.Code.compareTo(c2.Code);
25+
}
26+
27+
return compare;
28+
}
1929
}

src/DSSATModel/CropModelList.java

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77

88
import java.util.ArrayList;
99
import java.util.Collections;
10-
import java.util.HashMap;
1110
import java.util.List;
1211

1312
/**
1413
*
1514
* @author Jazzy
1615
*/
1716
public class CropModelList {
18-
protected static HashMap cropModels = new HashMap();
17+
protected static List<CropModel> cropModels = new ArrayList<>();
1918

2019
public static void AddNew(CropModel cropModel)
2120
{
22-
cropModels.put(cropModel.ModelCode, cropModel);
21+
cropModels.add(cropModel);
2322
}
2423

2524
public static void Clear(){
@@ -28,55 +27,39 @@ public static void Clear(){
2827

2928
public static CropModel GetAt(String ModelCode)
3029
{
31-
CropModel cropModel = null;
32-
try{
33-
cropModel = (CropModel) cropModels.get(ModelCode);
30+
for(int i = 0;i < cropModels.size();i++)
31+
{
32+
if(cropModels.get(i).ModelCode.equals(ModelCode))
33+
return cropModels.get(i);
3434
}
35-
catch(Exception ex) {}
36-
37-
return cropModel;
35+
return null;
3836
}
3937

4038
public static CropModel GetByCrop(String CropCode)
4139
{
42-
CropModel cropModel = null;
43-
try {
44-
Object[] objects = cropModels.values().toArray();
45-
for (Object object : objects) {
46-
if(((CropModel) object).Code.endsWith(CropCode)) {
47-
cropModel = (CropModel) object;
48-
break;
49-
}
50-
}
51-
} catch (Exception ex) {
40+
for(int i = 0;i < cropModels.size();i++)
41+
{
42+
if(cropModels.get(i).Code.equals(CropCode))
43+
return cropModels.get(i);
5244
}
53-
54-
return cropModel;
45+
return null;
5546
}
5647

5748
public static CropModel GetAt(int n)
5849
{
59-
CropModel cropModel = null;
6050
try{
61-
Object[] object = cropModels.values().toArray();
62-
cropModel = (CropModel) object[n];
51+
return cropModels.get(n);
6352
}
6453
catch(Exception ex) {}
6554

66-
return cropModel;
55+
return null;
6756
}
6857

6958
public static List<CropModel> GetAll()
7059
{
71-
List<CropModel> cropModelList = new ArrayList<>();
72-
Object[] objects = cropModels.values().toArray();
73-
for (Object object : objects) {
74-
cropModelList.add((CropModel) object);
75-
}
76-
77-
Collections.sort(cropModelList, (BaseModel c1, BaseModel c2) -> c1.Code.compareTo(c2.Description));
60+
Collections.sort(cropModels, (CropModel c1, CropModel c2) -> c1.compare(c2));
7861

79-
return cropModelList;
62+
return cropModels;
8063
}
8164

8265
public static int size()

src/DSSATServices/CropService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public void Parse() throws Exception {
6060
if (culFile != null && !"".equals(culFile)) {
6161
CultivarList.AddNew(crop, culFile);
6262
} else {
63-
crop.Enabled = false;
6463
CultivarList.AddNew(crop, "");
6564
}
6665
}

src/Extensions/Variables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ public static BufferedImage getIconImage(Class<?> objectClass){
8383
}
8484

8585
public static String getVersion(){
86-
return "v1.0.0.0";
86+
return "v1.0.1.0";
8787
}
8888
}

src/FileXModel/GeneralInformation.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @author Jazzy
1414
*/
15-
public class GeneralInformation {
15+
public class GeneralInformation extends ModelXBase {
1616
public GeneralInformation (){
1717
FileType = ExperimentType.Experimental;
1818
}
@@ -40,4 +40,14 @@ public GeneralInformation (){
4040
public Integer HRNO; /* Harvest row number */
4141
public Float HLEN; /* Harvest row length, m */
4242
public String HARM; /* Harvest method */
43+
44+
@Override
45+
public String GetName() {
46+
return "";
47+
}
48+
49+
@Override
50+
public void SetName(String name) {
51+
52+
}
4353
}

0 commit comments

Comments
 (0)