()
| 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 | } |
no test coverage detected