1 19 20 27 package org.netbeans.nbbuild.utils.cvsutils; 28 29 import java.util.*; 30 31 38 39 public class Entry { 40 private static final String DEFAULT_SEPARATOR = "/"; 41 private String filename, filetype, revno, timestamp; 42 43 51 public Entry(String ft, String fn, String revno, String ts) { 52 setFiletype(ft); 53 setFilename(fn); 54 setRevno(revno); 55 setTimestamp(ts); 56 } 57 58 62 public Entry(String line, String separator) { 63 70 StringTokenizer st = new StringTokenizer(line, separator); 71 72 int index = 0; 73 String [] item=new String [6]; 74 75 while (st.hasMoreTokens()) { 76 String ftstr = ""; 77 String tok = st.nextToken(); 78 79 83 if (index == 0 ) { 84 if ( ! tok.equals("D") ) { 85 item[index++]="F"; 86 } 87 } 88 item[index++]=tok; 89 96 } this.setFiletype(item[0]); 98 this.setFilename(item[1]); 99 this.setRevno(item[2]); 100 this.setTimestamp(item[3]); 101 102 } 103 104 public Entry(String line) { 105 this(line, DEFAULT_SEPARATOR); 106 } 107 108 public boolean hasName(String queryFilename) { 109 return this.getFilename().trim().equals(queryFilename.trim()); 110 } 111 112 public String toString() { 114 String fn, ft, revno, ts; 115 116 fn=this.getFilename(); 117 ft=this.getFiletype(); 118 revno=this.getRevno(); 119 ts=this.getTimestamp(); 120 121 String fullEntry="FileName:\t" 122 +fn+"\nFileType:\t"+ft +"\nRevno:\t"+revno 123 +"\nTimeStamp:\t" +ts+"\n"; 124 return fullEntry; 125 } 126 127 public void setFilename(String str) { 129 this.filename=str; 130 } 131 132 public String getFilename() { 133 return filename; 134 } 135 136 public void setFiletype(String str) { 137 this.filetype=str; 138 } 139 140 public String getFiletype() { 141 return filetype; 142 } 143 144 public void setRevno(String str) { 145 this.revno=str; 146 } 147 148 public String getRevno() { 149 return revno; 150 } 151 152 public void setTimestamp(String str) { 153 this.timestamp=str; 154 } 155 156 public String getTimestamp() { 157 return timestamp; 158 } 159 160 } 161 | Popular Tags |