Skip to content

Commit 7bdd69b

Browse files
committed
Add Lombok annotation to remove boilerplate code #23
1 parent 53785fb commit 7bdd69b

File tree

1 file changed

+9
-48
lines changed

1 file changed

+9
-48
lines changed

com.ca.lsp.cobol/lsp-core-cobol-parser/src/main/java/com/ca/lsp/core/cobol/preprocessor/sub/document/impl/CobolReplacementMapping.java

+9-48
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,26 @@
1313
*/
1414
package com.ca.lsp.core.cobol.preprocessor.sub.document.impl;
1515

16-
import java.util.regex.Matcher;
17-
import java.util.regex.Pattern;
18-
19-
import org.antlr.v4.runtime.BufferedTokenStream;
20-
import org.antlr.v4.runtime.ParserRuleContext;
21-
import org.codehaus.plexus.util.StringUtils;
22-
2316
import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.PseudoTextContext;
17+
import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplaceSameElementContext;
2418
import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplaceableContext;
2519
import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplacementContext;
26-
import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplaceSameElementContext;
2720
import com.ca.lsp.core.cobol.preprocessor.sub.util.TokenUtils;
21+
import lombok.Data;
22+
import org.antlr.v4.runtime.BufferedTokenStream;
23+
import org.antlr.v4.runtime.ParserRuleContext;
24+
import org.codehaus.plexus.util.StringUtils;
25+
26+
import java.util.regex.Matcher;
27+
import java.util.regex.Pattern;
2828

2929
/** A mapping from a replaceable to a replacement. */
30+
@Data
3031
public class CobolReplacementMapping implements Comparable<CobolReplacementMapping> {
3132

3233
private ReplaceableContext replaceable;
3334
private ReplacementContext replacement;
3435

35-
public ReplaceableContext getReplaceable() {
36-
return replaceable;
37-
}
38-
39-
public void setReplaceable(ReplaceableContext replaceable) {
40-
this.replaceable = replaceable;
41-
}
42-
43-
public ReplacementContext getReplacement() {
44-
return replacement;
45-
}
46-
47-
public void setReplacement(ReplacementContext replacement) {
48-
this.replacement = replacement;
49-
}
50-
5136
private String extractPseudoText(
5237
final PseudoTextContext pseudoTextCtx, final BufferedTokenStream tokens) {
5338
final String pseudoText = TokenUtils.getTextIncludingHiddenTokens(pseudoTextCtx, tokens).trim();
@@ -129,30 +114,6 @@ public String toString() {
129114
return replaceable.getText() + " -> " + replacement.getText();
130115
}
131116

132-
@Override
133-
public int hashCode() {
134-
final int prime = 31;
135-
int result = 1;
136-
result = prime * result + ((replaceable == null) ? 0 : replaceable.hashCode());
137-
result = prime * result + ((replacement == null) ? 0 : replacement.hashCode());
138-
return result;
139-
}
140-
141-
@Override
142-
public boolean equals(Object obj) {
143-
if (this == obj) return true;
144-
if (obj == null) return false;
145-
if (getClass() != obj.getClass()) return false;
146-
CobolReplacementMapping other = (CobolReplacementMapping) obj;
147-
if (replaceable == null) {
148-
if (other.replaceable != null) return false;
149-
} else if (!replaceable.equals(other.replaceable)) return false;
150-
if (replacement == null) {
151-
if (other.replacement != null) return false;
152-
} else if (!replacement.equals(other.replacement)) return false;
153-
return true;
154-
}
155-
156117
@Override
157118
public int compareTo(final CobolReplacementMapping o) {
158119
return o.replaceable.getText().length() - replaceable.getText().length();

0 commit comments

Comments
 (0)