Skip to content

Commit 7c9c628

Browse files
author
jan
committed
refactor rename fields to myXX format
Also deleted a unused method
1 parent 419b03e commit 7c9c628

File tree

3 files changed

+46
-52
lines changed

3 files changed

+46
-52
lines changed

io.sloeber.core/src/io/sloeber/core/api/Json/ArduinoInstallable.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44

55
public abstract class ArduinoInstallable {
66

7-
protected String archiveFileName;
8-
protected String url;
9-
protected String checksum;
10-
protected String size;
11-
protected String name;
7+
protected String myArchiveFileName;
8+
protected String myURL;
9+
protected String myChecksum;
10+
protected String mySize;
11+
protected String myName;
1212

1313
abstract public IPath getInstallPath();
1414

1515
public String getArchiveFileName() {
16-
return archiveFileName;
16+
return myArchiveFileName;
1717
}
1818

1919
public String getUrl() {
20-
return url;
20+
return myURL;
2121
}
2222

2323
public String getChecksum() {
24-
return checksum;
24+
return myChecksum;
2525
}
2626

2727
public String getSize() {
28-
return size;
28+
return mySize;
2929
}
3030

3131
public String getName() {
32-
return name;
32+
return myName;
3333
}
3434
}

io.sloeber.core/src/io/sloeber/core/api/Json/ArduinoPlatformVersion.java

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import java.io.File;
1414
import java.util.ArrayList;
15-
import java.util.Arrays;
1615
import java.util.List;
1716

1817
import org.eclipse.core.runtime.IPath;
@@ -25,12 +24,12 @@
2524

2625
public class ArduinoPlatformVersion extends ArduinoInstallable implements Comparable<ArduinoPlatformVersion> {
2726

28-
private String architecture;
29-
private VersionNumber version;
30-
private String category;
27+
private String myArchitecture;
28+
private VersionNumber myVersion;
29+
private String myCategory;
3130

32-
private List<String> boards = new ArrayList<>();
33-
private List<ArduinoPlatformTooldDependency> toolsDependencies = new ArrayList<>();;
31+
private List<String> myBoards = new ArrayList<>();
32+
private List<ArduinoPlatformTooldDependency> myToolDependencies = new ArrayList<>();
3433

3534
private ArduinoPlatform myParent;
3635

@@ -40,20 +39,20 @@ public ArduinoPlatformVersion(JsonElement json, ArduinoPlatform parent) {
4039
JsonObject jsonObject = json.getAsJsonObject();
4140

4241
try {
43-
name = getSafeString(jsonObject, "name");
44-
architecture = getSafeString(jsonObject, "architecture");
45-
version = getSafeVersion(jsonObject, "version");
46-
category = getSafeString(jsonObject, "category");
47-
url = getSafeString(jsonObject, "url");
48-
archiveFileName = getSafeString(jsonObject, "archiveFileName");
49-
checksum = getSafeString(jsonObject, "checksum");
50-
size = getSafeString(jsonObject, "size");
42+
myName = getSafeString(jsonObject, "name");
43+
myArchitecture = getSafeString(jsonObject, "architecture");
44+
myVersion = getSafeVersion(jsonObject, "version");
45+
myCategory = getSafeString(jsonObject, "category");
46+
myURL = getSafeString(jsonObject, "url");
47+
myArchiveFileName = getSafeString(jsonObject, "archiveFileName");
48+
myChecksum = getSafeString(jsonObject, "checksum");
49+
mySize = getSafeString(jsonObject, "size");
5150
for (JsonElement curElement : jsonObject.get("boards").getAsJsonArray()) {
52-
boards.add(getSafeString(curElement.getAsJsonObject(), "name"));
51+
myBoards.add(getSafeString(curElement.getAsJsonObject(), "name"));
5352
}
5453
if (jsonObject.get("toolsDependencies") != null) {
5554
for (JsonElement curElement : jsonObject.get("toolsDependencies").getAsJsonArray()) {
56-
toolsDependencies.add(new ArduinoPlatformTooldDependency(curElement, this));
55+
myToolDependencies.add(new ArduinoPlatformTooldDependency(curElement, this));
5756
}
5857
}
5958
} catch (Exception e) {
@@ -66,19 +65,19 @@ public ArduinoPlatform getParent() {
6665
}
6766

6867
public String getArchitecture() {
69-
return architecture;
68+
return myArchitecture;
7069
}
7170

7271
public VersionNumber getVersion() {
73-
return version;
72+
return myVersion;
7473
}
7574

7675
public String getCategory() {
77-
return category;
76+
return myCategory;
7877
}
7978

8079
public List<ArduinoPlatformTooldDependency> getToolsDependencies() {
81-
return toolsDependencies;
80+
return myToolDependencies;
8281
}
8382

8483
public boolean isInstalled() {
@@ -95,22 +94,17 @@ public File getPlatformFile() {
9594

9695
@Override
9796
public IPath getInstallPath() {
98-
return getParent().getInstallPath().append(this.version.toString());
97+
return getParent().getInstallPath().append(this.myVersion.toString());
9998
}
10099

101-
public List<IPath> getIncludePath() {
102-
IPath installPath = getInstallPath();
103-
return Arrays.asList(installPath.append("cores/{build.core}"), //$NON-NLS-1$
104-
installPath.append(ARDUINO_VARIANTS_FOLDER_NAME + "/{build.variant}")); //$NON-NLS-1$
105-
}
106100

107101
@Override
108102
public int hashCode() {
109103
final int prime = 31;
110104
int result = 1;
111-
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
105+
result = prime * result + ((this.myName == null) ? 0 : this.myName.hashCode());
112106
result = prime * result + ((this.myParent == null) ? 0 : this.myParent.hashCode());
113-
result = prime * result + ((this.version == null) ? 0 : this.version.hashCode());
107+
result = prime * result + ((this.myVersion == null) ? 0 : this.myVersion.hashCode());
114108
return result;
115109
}
116110

@@ -123,30 +117,30 @@ public boolean equals(Object obj) {
123117
if (getClass() != obj.getClass())
124118
return false;
125119
ArduinoPlatformVersion other = (ArduinoPlatformVersion) obj;
126-
if (this.name == null) {
127-
if (other.name != null)
120+
if (this.myName == null) {
121+
if (other.myName != null)
128122
return false;
129-
} else if (!this.name.equals(other.name))
123+
} else if (!this.myName.equals(other.myName))
130124
return false;
131125
if (this.myParent == null) {
132126
if (other.myParent != null)
133127
return false;
134128
} else if (!this.myParent.equals(other.myParent))
135129
return false;
136-
if (this.version == null) {
137-
if (other.version != null)
130+
if (this.myVersion == null) {
131+
if (other.myVersion != null)
138132
return false;
139-
} else if (!this.version.equals(other.version))
133+
} else if (!this.myVersion.equals(other.myVersion))
140134
return false;
141135
return true;
142136
}
143137

144138
public List<String> getBoardNames() {
145-
return boards;
139+
return myBoards;
146140
}
147141

148142
public String getID() {
149-
return version.toString();
143+
return myVersion.toString();
150144
}
151145

152146
public String getConcattenatedBoardNames() {
@@ -155,12 +149,12 @@ public String getConcattenatedBoardNames() {
155149

156150
@Override
157151
public int compareTo(ArduinoPlatformVersion o) {
158-
return name.compareTo(o.getName());
152+
return myName.compareTo(o.getName());
159153
}
160154

161155
@Override
162156
public String toString() {
163-
return name + SPACE + architecture + '(' + version + ')';
157+
return myName + SPACE + myArchitecture + '(' + myVersion + ')';
164158
}
165159

166160
}

io.sloeber.core/src/io/sloeber/core/api/Json/ArduinpPlatformToolSystem.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public ArduinpPlatformToolSystem(JsonElement json, ArduinoPlatformToolVersion to
2727

2828
try {
2929
host = getSafeString(jsonObject, "host");
30-
archiveFileName = getSafeString(jsonObject, "archiveFileName");
31-
url = getSafeString(jsonObject, "url");
32-
checksum = getSafeString(jsonObject, "checksum");
33-
size = getSafeString(jsonObject, "size");
30+
myArchiveFileName = getSafeString(jsonObject, "archiveFileName");
31+
myURL = getSafeString(jsonObject, "url");
32+
myChecksum = getSafeString(jsonObject, "checksum");
33+
mySize = getSafeString(jsonObject, "size");
3434
} catch (Exception e) {
3535
throw new JsonParseException("failed to parse Tool json " + e.getMessage(),e);
3636
}

0 commit comments

Comments
 (0)