@Test void testDetectTwoLineHeader() { LineParser.TargetLine target = new LineParser.TargetLine( new ReSTLine("This is a part", 1), new ReSTLine("", 0), new ReSTLine("#############", 2)); assertEquals(true, MultiLineProcessUtils.processMultiLineMatch(null, '#', target)); }
static boolean processMultiLineMatch(Character prevChar, Character nextChar, LineParser.TargetLine target) { Line prevLine = target.previousLine; Line nextLine = target.nextLine; if (prevChar != null && nextChar != null) { if (processLineMatch(nextChar, nextLine) && processLineMatch(prevChar, prevLine)) { prevLine.erase(); nextLine.erase(); return true; } } if (prevChar == null && nextChar != null) { if (processLineMatch(nextChar, nextLine)) { nextLine.erase(); return true; } } if (prevChar != null && nextChar == null) { if (processLineMatch(prevChar, prevLine)) { prevLine.erase(); return true; } } return false; }
MultiLineProcessUtils { static boolean processMultiLineMatch(Character prevChar, Character nextChar, LineParser.TargetLine target) { Line prevLine = target.previousLine; Line nextLine = target.nextLine; if (prevChar != null && nextChar != null) { if (processLineMatch(nextChar, nextLine) && processLineMatch(prevChar, prevLine)) { prevLine.erase(); nextLine.erase(); return true; } } if (prevChar == null && nextChar != null) { if (processLineMatch(nextChar, nextLine)) { nextLine.erase(); return true; } } if (prevChar != null && nextChar == null) { if (processLineMatch(prevChar, prevLine)) { prevLine.erase(); return true; } } return false; } }
MultiLineProcessUtils { static boolean processMultiLineMatch(Character prevChar, Character nextChar, LineParser.TargetLine target) { Line prevLine = target.previousLine; Line nextLine = target.nextLine; if (prevChar != null && nextChar != null) { if (processLineMatch(nextChar, nextLine) && processLineMatch(prevChar, prevLine)) { prevLine.erase(); nextLine.erase(); return true; } } if (prevChar == null && nextChar != null) { if (processLineMatch(nextChar, nextLine)) { nextLine.erase(); return true; } } if (prevChar != null && nextChar == null) { if (processLineMatch(prevChar, prevLine)) { prevLine.erase(); return true; } } return false; }  }
MultiLineProcessUtils { static boolean processMultiLineMatch(Character prevChar, Character nextChar, LineParser.TargetLine target) { Line prevLine = target.previousLine; Line nextLine = target.nextLine; if (prevChar != null && nextChar != null) { if (processLineMatch(nextChar, nextLine) && processLineMatch(prevChar, prevLine)) { prevLine.erase(); nextLine.erase(); return true; } } if (prevChar == null && nextChar != null) { if (processLineMatch(nextChar, nextLine)) { nextLine.erase(); return true; } } if (prevChar != null && nextChar == null) { if (processLineMatch(prevChar, prevLine)) { prevLine.erase(); return true; } } return false; }   }
MultiLineProcessUtils { static boolean processMultiLineMatch(Character prevChar, Character nextChar, LineParser.TargetLine target) { Line prevLine = target.previousLine; Line nextLine = target.nextLine; if (prevChar != null && nextChar != null) { if (processLineMatch(nextChar, nextLine) && processLineMatch(prevChar, prevLine)) { prevLine.erase(); nextLine.erase(); return true; } } if (prevChar == null && nextChar != null) { if (processLineMatch(nextChar, nextLine)) { nextLine.erase(); return true; } } if (prevChar != null && nextChar == null) { if (processLineMatch(prevChar, prevLine)) { prevLine.erase(); return true; } } return false; }    }