1 17 18 package com.finalist.util; 19 20 import com.lowagie.text.html.HtmlEncoder; 21 22 27 public class DiffConflictLine { 28 29 private String line; 30 private int number; 31 private boolean firstFile; 32 33 34 public static final DiffConflictLine EOF = new DiffConflictLine(); 35 36 37 43 public DiffConflictLine(boolean firstFile, int number, String line) { 44 this.number = number; 45 this.firstFile = firstFile; 46 this.line = line; 47 } 48 49 private DiffConflictLine() { 50 } 51 52 53 58 public boolean lineEquals(DiffConflictLine line2) { 59 return line.trim().equals(line2.getLine().trim()); 60 } 61 62 public String getLine() { 63 return line; 64 } 65 66 public boolean isEof() { 67 return (this == EOF); 68 } 69 70 public int getLineNumber() { 71 return number; 72 } 73 74 public boolean isFirstFile() { 75 return firstFile; 76 } 77 81 public String toString() { 82 return "<font class='file" + (firstFile ? "1" : "2") + "-code'>" + 83 (firstFile ? "<" : ">") + HtmlEncoder.encode(getLine()) + "</font><br>"; 84 } 85 86 92 public boolean precedes(DiffConflictLine next) { 93 return next != null && 94 (firstFile == next.firstFile) && 95 next.getLineNumber() == number + 1; 96 } 97 98 } 99 | Popular Tags |