1 11 package org.eclipse.team.internal.ccvs.core; 12 13 import org.eclipse.osgi.util.NLS; 14 15 18 public class CVSAnnotateBlock { 19 20 String revision = ""; String user = ""; int startLine = 0; 23 int endLine = 0; 24 int sourceOffset = 0; 25 boolean valid = false; 26 27 30 public boolean isValid() { 31 return valid; 32 } 33 34 37 public int getSourceOffset() { 38 return sourceOffset; 39 } 40 41 44 public int getEndLine() { 45 return endLine; 46 } 47 48 51 public void setEndLine(int line) { 52 endLine = line; 53 } 54 55 58 public String getRevision() { 59 return revision; 60 } 61 62 65 public int getStartLine() { 66 return startLine; 67 } 68 69 70 74 public CVSAnnotateBlock(String line, int lineNumber) { 75 super(); 76 77 startLine = lineNumber; 78 endLine = lineNumber; 79 80 int index = line.indexOf(' '); 81 if (index == -1) { 82 return; 83 } 84 revision = line.substring(0, index); 85 86 index = line.indexOf("(", index); if (index == -1) { 88 return; 89 } 90 91 int index2 = line.indexOf(' ', index); 92 if (index2 == -1) { 93 return; 94 } 95 96 user = line.substring(index + 1, index2); 97 98 index = line.indexOf(":", index2); if (index == -1) { 100 return; 101 } 102 103 sourceOffset = index + 2; 104 valid = true; 105 } 106 107 110 public String toString() { 111 int delta = endLine - startLine + 1; 112 String line = CVSMessages.CVSAnnotateBlock_4; 113 if (delta == 1) { 114 line = CVSMessages.CVSAnnotateBlock_5; 115 } 116 return NLS.bind(CVSMessages.CVSAnnotateBlock_6, (new Object [] { 117 user, 118 revision, 119 String.valueOf(delta), 120 line 121 })); 122 } 123 124 129 public boolean contains(int i) { 130 return (i >= startLine && i <= endLine); 131 } 132 } 133 | Popular Tags |