'indexOf' -> 'contains'

GitOrigin-RevId: ff741fb2aa565fefa54c6a479947ea5f8c837d0c
This commit is contained in:
Tagir Valeev
2019-07-25 10:03:44 +03:00
committed by intellij-monorepo-bot
parent 3e12574595
commit 0f3d493cb9
12 changed files with 16 additions and 16 deletions
@@ -92,7 +92,7 @@ public class CompilerErrorTreeView extends NewErrorTreeViewPanel {
final NavigatableMessageElement messageElement = (NavigatableMessageElement)errorTreeElement;
final String[] text = messageElement.getText();
if (text.length > 0) {
if (text[0].startsWith("[") && text[0].indexOf("]") != -1) {
if (text[0].startsWith("[") && text[0].contains("]")) {
final Navigatable navigatable = messageElement.getNavigatable();
if (navigatable instanceof OpenFileDescriptor) {
final OpenFileDescriptor fileDescriptor = (OpenFileDescriptor)navigatable;
@@ -79,7 +79,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt
@NonNls final String cdataStartMarker = "<![CDATA[";
final int cdataPos = text.indexOf(cdataStartMarker);
if (cdataPos != -1 && whiteSpace.indexOf(cdataStartMarker) == -1) {
if (cdataPos != -1 && !whiteSpace.contains(cdataStartMarker)) {
whiteSpace = DocumentBasedFormattingModel.mergeWsWithCdataMarker(whiteSpace, text, cdataPos);
if (whiteSpace == null) return null;
}
@@ -89,7 +89,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt
}
@NonNls final String cdataEndMarker = "]]>";
if(type == XmlTokenType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) {
if(type == XmlTokenType.XML_CDATA_END && !whiteSpace.contains(cdataEndMarker)) {
final ASTNode at = findElementAt(prevNode.getStartOffset());
if (at != null && at.getPsi() instanceof PsiWhiteSpace) {
@@ -16,7 +16,7 @@ public class JarContainer extends ZipContainer {
protected Zip createTask() {
String version = Main.getAntVersion();
Jar task;
if (version != null && (version.indexOf("1.8.0") != -1 || version.indexOf("1.8.1") != -1)) {
if (version != null && (version.contains("1.8.0") || version.contains("1.8.1"))) {
task = new PatchedJar();
}
else {
@@ -39,7 +39,7 @@ public class IdeFocusTraversalPolicy extends LayoutFocusTraversalPolicyExt {
final FocusTraversalPolicy focusTraversalPolicy = getFocusTraversalPolicyAwtImpl(component);
if (focusTraversalPolicy != null && focusTraversalPolicy != policyToIgnore) {
if (focusTraversalPolicy.getClass().getName().indexOf("LegacyGlueFocusTraversalPolicy") >=0) {
if (focusTraversalPolicy.getClass().getName().contains("LegacyGlueFocusTraversalPolicy")) {
return component;
}
@@ -106,7 +106,7 @@ public class AntUIUtil {
String name = AntInstallation.NAME.get(antProperties);
component.append(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
String versionString = AntInstallation.VERSION.get(antProperties);
if (name.indexOf(versionString) == -1)
if (!name.contains(versionString))
component.append(" (" + versionString + ")", SimpleTextAttributes.SYNTHETIC_ATTRIBUTES);
}
@@ -172,7 +172,7 @@ public class PropertyExpander {
String getResult() {
final String value = myBuilder.toString();
if (value.indexOf("$$") >= 0) {
if (value.contains("$$")) {
return $$_PATTERN.matcher(value).replaceAll("\\$");
}
return value;
@@ -318,7 +318,7 @@ public final class RequestProcessor implements IRequestProcessor {
}
private boolean isValidRequest(String request) {
return responseServices.getValidRequests().indexOf(request) >= 0;
return responseServices.getValidRequests().contains(request);
}
private void sendRequest(IRequest request, IConnectionStreams connectionStreams) throws CommandAbortedException, IOException {
@@ -103,7 +103,7 @@ public final class UpdateMessageParser extends AbstractMessageParser implements
return;
}
if (line.indexOf(EXAM_DIR) >= 0) {
if (line.contains(EXAM_DIR)) {
return;
}
@@ -171,7 +171,7 @@ public final class UpdateMessageParser extends AbstractMessageParser implements
if (line.length() > 2) {
if (line.charAt(1) == ' ') {
final String firstChar = line.substring(0, 1);
if (STATES.indexOf(firstChar) >= 0) {
if (STATES.contains(firstChar)) {
processFile(line.substring(2), firstChar);
}
}
@@ -184,7 +184,7 @@ class ModeReference extends SimpleAttributeReference implements PsiPolyVariantRe
public boolean matches(XmlTag element) {
final String s = element.getAttributeValue("mode");
return myMode != null &&
s != null && s.indexOf(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED) == -1 &&
s != null && !s.contains(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED) &&
super.matches(element);
}
@@ -377,7 +377,7 @@ public abstract class PydevConsoleCommunication extends AbstractConsoleCommunica
// This string always works,
// because it is hard-coded in
// the XML-RPC library)
if (executed.first != null && executed.first.indexOf(refusedConnPattern) != -1) {
if (executed.first != null && executed.first.contains(refusedConnPattern)) {
if (firstCommWorked) {
break;
}
@@ -45,7 +45,7 @@ public class PythonEditorHighlighter extends LexerEditorHighlighter {
int offset = e.getOffset();
int lineNumber = document.getLineNumber(offset);
TextRange tr = new TextRange(document.getLineStartOffset(lineNumber), document.getLineEndOffset(lineNumber));
document.putUserData(KEY, document.getText(tr).indexOf(PyNames.UNICODE_LITERALS) == -1);
document.putUserData(KEY, !document.getText(tr).contains(PyNames.UNICODE_LITERALS));
Boolean hasUnicodeImport = document.getUserData(KEY);
if (delegate instanceof PythonHighlightingLexer &&
(((PythonHighlightingLexer)delegate).getImportOffset() > e.getOffset()
@@ -69,7 +69,7 @@ public class PythonEditorHighlighter extends LexerEditorHighlighter {
public void setEditor(@NotNull HighlighterClient editor) {
Lexer l = getLexer();
if (l instanceof LayeredLexer) {
editor.getDocument().putUserData(KEY, editor.getDocument().getText().indexOf(PyNames.UNICODE_LITERALS) == -1);
editor.getDocument().putUserData(KEY, !editor.getDocument().getText().contains(PyNames.UNICODE_LITERALS));
}
super.setEditor(editor);
}
@@ -59,7 +59,7 @@ public class XmlFormattingModel extends PsiBasedFormattingModel {
final @NonNls String cdataStartMarker = "<![CDATA[";
final int cdataPos = text.indexOf(cdataStartMarker);
if (cdataPos != -1 && whiteSpace.indexOf(cdataStartMarker) == -1) {
if (cdataPos != -1 && !whiteSpace.contains(cdataStartMarker)) {
whiteSpace = mergeWsWithCdataMarker(whiteSpace, text, cdataPos);
if (whiteSpace == null) return null;
}
@@ -69,7 +69,7 @@ public class XmlFormattingModel extends PsiBasedFormattingModel {
}
final @NonNls String cdataEndMarker = "]]>";
if(type == XmlTokenType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) {
if(type == XmlTokenType.XML_CDATA_END && !whiteSpace.contains(cdataEndMarker)) {
final ASTNode at = findElementAt(prevNode.getStartOffset());
if (at != null && at.getPsi() instanceof PsiWhiteSpace) {