Skip to content

Commit 25a2a59

Browse files
committed
Clean up JavaProblem, remove IProblem field
1 parent a79fe7f commit 25a2a59

File tree

1 file changed

+13
-52
lines changed

1 file changed

+13
-52
lines changed

java/src/processing/mode/java/pdex/JavaProblem.java

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
* according to its tab, including the original IProblem object
3131
*/
3232
public class JavaProblem implements Problem {
33-
/**
34-
* The IProblem which is being wrapped
35-
*/
36-
private IProblem iProblem;
3733
/**
3834
* The tab number to which the error belongs to
3935
*/
@@ -71,11 +67,9 @@ public class JavaProblem implements Problem {
7167
* @param lineNumber - Line number(pde code) of the error
7268
*/
7369
public JavaProblem(IProblem iProblem, int tabIndex, int lineNumber) {
74-
this.iProblem = iProblem;
7570
if(iProblem.isError()) {
7671
type = ERROR;
77-
}
78-
else if(iProblem.isWarning()) {
72+
} else if (iProblem.isWarning()) {
7973
type = WARNING;
8074
}
8175
this.tabIndex = tabIndex;
@@ -88,62 +82,41 @@ public void setPDEOffsets(int startOffset, int stopOffset){
8882
this.stopOffset = stopOffset;
8983
}
9084

85+
@Override
9186
public int getStartOffset() {
9287
return startOffset;
9388
}
9489

90+
@Override
9591
public int getStopOffset() {
9692
return stopOffset;
9793
}
9894

99-
public String toString() {
100-
return new String("TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: "
101-
+ startOffset + ",LN STOP OFF: " + stopOffset + ",PROB: "
102-
+ message);
103-
}
104-
95+
@Override
10596
public boolean isError() {
10697
return type == ERROR;
10798
}
10899

100+
@Override
109101
public boolean isWarning() {
110102
return type == WARNING;
111103
}
112104

105+
@Override
113106
public String getMessage() {
114107
return message;
115108
}
116109

117-
public IProblem getIProblem() {
118-
return iProblem;
119-
}
120-
110+
@Override
121111
public int getTabIndex() {
122112
return tabIndex;
123113
}
124114

115+
@Override
125116
public int getLineNumber() {
126117
return lineNumber;
127118
}
128119

129-
/**
130-
* Remember to subtract a -1 to line number because in compile check code an
131-
* extra package statement is added, so all line numbers are increased by 1
132-
*
133-
* @return
134-
*/
135-
public int getSourceLineNumber() {
136-
return iProblem.getSourceLineNumber();
137-
}
138-
139-
public void setType(int ProblemType){
140-
if(ProblemType == ERROR)
141-
type = ERROR;
142-
else if(ProblemType == WARNING)
143-
type = WARNING;
144-
else throw new IllegalArgumentException("Illegal Problem type passed to Problem.setType(int)");
145-
}
146-
147120
public String[] getImportSuggestions() {
148121
return importSuggestions;
149122
}
@@ -152,23 +125,11 @@ public void setImportSuggestions(String[] a) {
152125
importSuggestions = a;
153126
}
154127

155-
// Split camel case words into separate words.
156-
// "VaraibleDeclaration" becomes "Variable Declaration"
157-
// But sadly "PApplet" become "P Applet" and so on.
158-
public static String splitCamelCaseWord(String word) {
159-
String newWord = "";
160-
for (int i = 1; i < word.length(); i++) {
161-
if (Character.isUpperCase(word.charAt(i))) {
162-
// System.out.println(word.substring(0, i) + " "
163-
// + word.substring(i));
164-
newWord += word.substring(0, i) + " ";
165-
word = word.substring(i);
166-
i = 1;
167-
}
168-
}
169-
newWord += word;
170-
// System.out.println(newWord);
171-
return newWord.trim();
128+
@Override
129+
public String toString() {
130+
return "TAB " + tabIndex + ",LN " + lineNumber + "LN START OFF: "
131+
+ startOffset + ",LN STOP OFF: " + stopOffset + ",PROB: "
132+
+ message;
172133
}
173134

174135
}

0 commit comments

Comments
 (0)