1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00
Go to file
Cristian Maglie c5a6a44b55 Simplify FindReplace.find() logic (part 2)
The snippet:

    boolean wrapNeeded = false;
    if (wrap && nextIndex == -1) {
      // if wrapping, a second chance is ok, start from the end
      wrapNeeded = true;
    }

Can be moved inside the `if (nextIndex == -1)` that follows, this way:

    if (nextIndex == -1) {
      boolean wrapNeeded = false;
      if (wrap) {
        // if wrapping, a second chance is ok, start from the end
        wrapNeeded = true;
      }

      [...CUT...]

      if (wrapNeeded) {
        nextIndex = backwards ? text.lastIndexOf(search) : text.indexOf(search, 0);
      }
    }

but since `wrapNeeded` is used only at the very end of the `if` statement
we can move it forward:

    if (nextIndex == -1) {
      [...CUT...]

      boolean wrapNeeded = false;
      if (wrap) {
        // if wrapping, a second chance is ok, start from the end
        wrapNeeded = true;
      }
      if (wrapNeeded) {
        nextIndex = backwards ? text.lastIndexOf(search) : text.indexOf(search, 0);
      }
    }

and finally simplify it by removing `wrapNeeded` altogether:

    if (nextIndex == -1) {
      [...CUT...]

      if (wrap) {
        nextIndex = backwards ? text.lastIndexOf(search) : text.indexOf(search, 0);
      }
    }
2016-09-20 13:58:36 +02:00
.settings Update eclipse java-formatter settings 2015-03-27 14:51:11 +01:00
app Simplify FindReplace.find() logic (part 2) 2016-09-20 13:58:36 +02:00
arduino-core Fixed wrong string check 2016-08-31 19:12:09 +02:00
build Update revision log 2016-09-14 13:54:31 -04:00
hardware Spaces to tab 2016-09-12 09:00:04 +02:00
libraries Stepper: update version to 1.1.3 2016-03-08 15:37:18 +01:00
.classpath Installing tools from packager (eg: arduino) in packager folder, thus avoiding 2015-11-20 17:15:53 +01:00
.gitignore Update avr-gcc to 4.9.2 and avrdude to 6.3 2016-07-25 12:34:57 +02:00
.project Fix eclipse project files 2012-01-11 14:18:48 +01:00
examples_formatter.conf Serial plotter: added comment to AnalogReadSerial. Fixes #3451 2015-07-06 15:27:07 +02:00
format.every.sketch.sh Examples: mass code format. See example_formatter.conf 2015-07-06 15:19:05 +02:00
lib_sync Added lib_sync, utility script 2015-04-23 17:46:20 +02:00
license.txt adding LGPL (a bit late, whoops). 2007-10-12 01:58:48 +00:00
README.md Fix typo in readme 2016-03-02 17:54:54 +01:00

Arduino

Installation

Detailed instructions are in reference/Guide_Windows.html and reference/Guide_MacOSX.html. For Linux, see the Arduino playground: http://www.arduino.cc/playground/Learning/Linux

Credits

Arduino is an open source project, supported by many.

The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe and David A. Mellis.

Arduino uses GNU avr-gcc toolchain, GCC ARM Embedded toolchain, avr-libc, avrdude, bossac, openOCD and code from Processing and Wiring.

Icon and about image designed by ToDo