MCPcopy Create free account
hub / github.com/Skykai521/ECTranslation / toString

Method toString

src/Translation.java:156–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154 }
155
156 @Override
157 public String toString() {
158 String string = null;
159 if (errorCode != SUCCESS) {
160 string = "错误代码:" + errorCode + "\n" + getErrorMessage();
161 } else {
162 String translation = getTranslationResult();
163 if (translation != null) {
164 translation = translation.substring(0, translation.length() - 1);
165 if (!translation.equals(query)) {
166 string = (query + ":" + getTranslationResult() + "\n");
167 }
168 }
169 if (getPhonetic() != null) {
170 if (string == null) {
171 string = "";
172 }
173 string += (getPhonetic() + "\n");
174 }
175 if (getExplains() != null) {
176 if (string == null) {
177 string = "";
178 }
179 string += (getExplains());
180 }
181 if (getWebResult() != null) {
182 if (string == null) {
183 string = "";
184 }
185 string += "网络释义:\n";
186 string += (getWebResult());
187 }
188 }
189 if (string == null) {
190 string = "你选的内容:" + query + "\n抱歉,翻译不了...";
191 }
192 return string;
193 }
194}

Callers 1

runMethod · 0.95

Calls 5

getErrorMessageMethod · 0.95
getTranslationResultMethod · 0.95
getPhoneticMethod · 0.95
getExplainsMethod · 0.95
getWebResultMethod · 0.95

Tested by

no test coverage detected