|
13 | 13 | */
|
14 | 14 | package com.ca.lsp.core.cobol.preprocessor.sub.document.impl;
|
15 | 15 |
|
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 |
| - |
23 | 16 | import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.PseudoTextContext;
|
| 17 | +import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplaceSameElementContext; |
24 | 18 | import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplaceableContext;
|
25 | 19 | import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplacementContext;
|
26 |
| -import com.ca.lsp.core.cobol.parser.CobolPreprocessorParser.ReplaceSameElementContext; |
27 | 20 | 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; |
28 | 28 |
|
29 | 29 | /** A mapping from a replaceable to a replacement. */
|
| 30 | +@Data |
30 | 31 | public class CobolReplacementMapping implements Comparable<CobolReplacementMapping> {
|
31 | 32 |
|
32 | 33 | private ReplaceableContext replaceable;
|
33 | 34 | private ReplacementContext replacement;
|
34 | 35 |
|
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 |
| - |
51 | 36 | private String extractPseudoText(
|
52 | 37 | final PseudoTextContext pseudoTextCtx, final BufferedTokenStream tokens) {
|
53 | 38 | final String pseudoText = TokenUtils.getTextIncludingHiddenTokens(pseudoTextCtx, tokens).trim();
|
@@ -129,30 +114,6 @@ public String toString() {
|
129 | 114 | return replaceable.getText() + " -> " + replacement.getText();
|
130 | 115 | }
|
131 | 116 |
|
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 |
| - |
156 | 117 | @Override
|
157 | 118 | public int compareTo(final CobolReplacementMapping o) {
|
158 | 119 | return o.replaceable.getText().length() - replaceable.getText().length();
|
|
0 commit comments