| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,6 @@ | |||
| 23 | 23 | import java.util.*; | |
| 24 | 24 | import java.util.regex.Matcher; | |
| 25 | 25 | import java.util.regex.Pattern; | |
| 26 | - import java.util.stream.Collectors; | ||
| 27 | 26 | ||
| 28 | 27 | ||
| 29 | 28 | public class SketchParser { | |
@@ -118,7 +117,7 @@ private void addAllDecimalNumbers() { | |||
| 118 | 117 | ||
| 119 | 118 | Pattern p = Pattern.compile("[\\[\\{<>(),\\t\\s\\+\\-\\/\\*^%!|&=?:~]\\d+\\.?\\d*"); | |
| 120 | 119 | for (int i = 0; i < codeTabs.length; i++) { | |
| 121 | - List<Handle> handles = new ArrayList<Handle>(); | ||
| 120 | + List<Handle> handles = new ArrayList<>(); | ||
| 122 | 121 | allHandles.add(handles); | |
| 123 | 122 | ||
| 124 | 123 | String c = codeTabs[i]; | |
@@ -328,7 +327,7 @@ private void addAllWebColorNumbers() { | |||
| 328 | 327 | ||
| 329 | 328 | ||
| 330 | 329 | private ArrayList<ColorMode> findAllColorModes() { | |
| 331 | - ArrayList<ColorMode> modes = new ArrayList<ColorMode>(); | ||
| 330 | + ArrayList<ColorMode> modes = new ArrayList<>(); | ||
| 332 | 331 | ||
| 333 | 332 | for (int i=0; i<codeTabs.length; i++) { | |
| 334 | 333 | String tab = codeTabs[i]; | |
@@ -369,14 +368,14 @@ private void createColorBoxes() { | |||
| 369 | 368 | Pattern p = Pattern.compile("color\\(|color\\s\\(|fill[\\(\\s]|stroke[\\(\\s]|background[\\(\\s]|tint[\\(\\s]"); | |
| 370 | 369 | ||
| 371 | 370 | for (int i = 0; i < codeTabs.length; i++) { | |
| 372 | - List<ColorControlBox> colorBox = new ArrayList<ColorControlBox>(); | ||
| 371 | + List<ColorControlBox> colorBox = new ArrayList<>(); | ||
| 373 | 372 | colorBoxes.add(colorBox); | |
| 374 | 373 | ||
| 375 | 374 | String tab = codeTabs[i]; | |
| 376 | 375 | Matcher m = p.matcher(tab); | |
| 377 | 376 | ||
| 378 | 377 | while (m.find()) { | |
| 379 | - ArrayList<Handle> colorHandles = new ArrayList<Handle>(); | ||
| 378 | + ArrayList<Handle> colorHandles = new ArrayList<>(); | ||
| 380 | 379 | ||
| 381 | 380 | // look for the '(' and ')' positions | |
| 382 | 381 | int openPar = tab.indexOf("(", m.start()); | |
@@ -460,7 +459,7 @@ private void createColorBoxesForLights() { | |||
| 460 | 459 | Matcher m = p.matcher(tab); | |
| 461 | 460 | ||
| 462 | 461 | while (m.find()) { | |
| 463 | - ArrayList<Handle> colorHandles = new ArrayList<Handle>(); | ||
| 462 | + ArrayList<Handle> colorHandles = new ArrayList<>(); | ||
| 464 | 463 | ||
| 465 | 464 | // look for the '(' and ')' positions | |
| 466 | 465 | int openPar = tab.indexOf("(", m.start()); | |
@@ -559,7 +558,7 @@ private ColorMode getColorModeForContext(String context) { | |||
| 559 | 558 | ||
| 560 | 559 | private void handleMultipleColorModes() { | |
| 561 | 560 | // count how many color modes per context | |
| 562 | - Map<String, Integer> modeCount = new HashMap<String, Integer>(); | ||
| 561 | + Map<String, Integer> modeCount = new HashMap<>(); | ||
| 563 | 562 | for (ColorMode cm : colorModes) { | |
| 564 | 563 | Integer prev = modeCount.get(cm.drawContext); | |
| 565 | 564 | if (prev == null) { | |
@@ -569,7 +568,7 @@ private void handleMultipleColorModes() { | |||
| 569 | 568 | } | |
| 570 | 569 | ||
| 571 | 570 | // find the contexts that have more than one color mode | |
| 572 | - ArrayList<String> multipleContexts = new ArrayList<String>(); | ||
| 571 | + ArrayList<String> multipleContexts = new ArrayList<>(); | ||
| 573 | 572 | Set<String> allContexts = modeCount.keySet(); | |
| 574 | 573 | for (String context : allContexts) { | |
| 575 | 574 | if (modeCount.get(context) > 1) { | |
@@ -580,11 +579,13 @@ private void handleMultipleColorModes() { | |||
| 580 | 579 | // keep only hex and web color boxes in color calls | |
| 581 | 580 | // that belong to 'multipleContexts' contexts | |
| 582 | 581 | for (int i = 0; i < codeTabs.length; i++) { | |
| 583 | - List<ColorControlBox> toDelete = new ArrayList<ColorControlBox>(); | ||
| 582 | + List<ColorControlBox> toDelete = new ArrayList<>(); | ||
| 584 | 583 | for (String context : multipleContexts) { | |
| 585 | - toDelete = colorBoxes.get(i).stream() | ||
| 586 | - .filter(ccb -> ccb.drawContext.equals(context) && !ccb.isHex) | ||
| 587 | - .collect(Collectors.toList()); | ||
| 584 | + for (ColorControlBox ccb : colorBoxes.get(i)) { | ||
| 585 | + if (ccb.drawContext.equals(context) && !ccb.isHex) { | ||
| 586 | + toDelete.add(ccb); | ||
| 587 | + } | ||
| 588 | + } | ||
| 588 | 589 | } | |
| 589 | 590 | colorBoxes.get(i).removeAll(toDelete); | |
| 590 | 591 | } | |
@@ -596,7 +597,7 @@ private List<List<Range>> getAllScientificNotations() { | |||
| 596 | 597 | ||
| 597 | 598 | Pattern p = Pattern.compile("[+\\-]?(?:0|[1-9]\\d*)(?:\\.\\d*)?[eE][+\\-]?\\d+"); | |
| 598 | 599 | for (String code : codeTabs) { | |
| 599 | - List<Range> notation = new ArrayList<Range>(); | ||
| 600 | + List<Range> notation = new ArrayList<>(); | ||
| 600 | 601 | Matcher m = p.matcher(code); | |
| 601 | 602 | while (m.find()) { | |
| 602 | 603 | notation.add(new Range(m.start(), m.end())); | |
@@ -766,7 +767,7 @@ private boolean isGlobal(int pos, int codeTabIndex) { | |||
| 766 | 767 | ||
| 767 | 768 | ||
| 768 | 769 | static private List<Range> getCommentBlocks(String code) { | |
| 769 | - List<Range> commentBlocks = new ArrayList<Range>(); | ||
| 770 | + List<Range> commentBlocks = new ArrayList<>(); | ||
| 770 | 771 | ||
| 771 | 772 | int lastBlockStart=0; | |
| 772 | 773 | boolean lookForEnd = false; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments