| 1 |
package icecream; |
| 2 |
|
| 3 |
import shared.Parse; |
| 4 |
|
| 5 |
public class PBHeader { |
| 6 |
|
| 7 |
public PBHeader(String s){ |
| 8 |
setFrom(s); |
| 9 |
} |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public void setFrom(final String header){ |
| 17 |
original=header; |
| 18 |
int slash1=header.indexOf('/'); |
| 19 |
assert(slash1>=0) : "Misformatted PBHeader: "+header; |
| 20 |
int slash2=header.indexOf('/', slash1+1); |
| 21 |
assert(slash2>=0) : "Misformatted PBHeader: "+header; |
| 22 |
int under3=header.indexOf('_', slash2+1); |
| 23 |
assert(under3>=0) : "Misformatted PBHeader: "+header; |
| 24 |
int terminator=under3+1; |
| 25 |
while(terminator<header.length() && Character.isDigit(header.charAt(terminator))){terminator++;} |
| 26 |
runID=header.substring(0, slash1); |
| 27 |
|
| 28 |
zmwID=Parse.parseInt(header, slash1+1, slash2); |
| 29 |
start=Parse.parseInt(header, slash2+1, under3); |
| 30 |
stop=Parse.parseInt(header, under3+1, terminator); |
| 31 |
} |
| 32 |
|
| 33 |
public static int parseZMW(final String header){ |
| 34 |
int slash1=header.indexOf('/'); |
| 35 |
assert(slash1>=0) : "Misformatted PBHeader: "+header; |
| 36 |
int slash2=header.indexOf('/', slash1+1); |
| 37 |
assert(slash2>=0) : "Misformatted PBHeader: "+header; |
| 38 |
int zmwID=Parse.parseInt(header, slash1+1, slash2); |
| 39 |
return zmwID; |
| 40 |
} |
| 41 |
|
| 42 |
public String original; |
| 43 |
public String runID; |
| 44 |
public int zmwID; |
| 45 |
public int start; |
| 46 |
public int stop; |
| 47 |
|
| 48 |
} |