Debian Codegraph @

current/pacbio/SiteR.java

raw symbols SCIP
1 package pacbio;
2
3 import shared.Shared;
4 import stream.SiteScore;
5 import stream.SiteScoreR;
6
7 /**
8 * @author Brian Bushnell
9 * @date Jul 24, 2012
10 *
11 */
12 public class SiteR {
13
14 public SiteR(SiteScoreR ssr){
15 this(ssr.start, ssr.stop, ssr.chrom, ssr.strand, ssr.numericID, ssr.pairnum);
16 }
17
18 public SiteR(int start_, int stop_, int chrom, byte strand, long numericID, int pairnum){
19 start=start_;
20 stop=stop_;
21 if((pairnum&1)==0){
22 idPairnum=numericID;
23 }else{
24 idPairnum=-numericID;
25 }
26 if(strand==Shared.PLUS){
27 chromStrand=chrom;
28 }else{
29 chromStrand=-chrom;
30 }
31 assert(chrom==chrom());
32 assert(strand==strand());
33 assert(numericID==numericID());
34 assert(pairnum==pairNum());
35 }
36
37 public boolean equals(SiteScore other){
38 if(other.start!=start){return false;}
39 if(other.stop!=stop){return false;}
40 if(other.chrom!=chrom()){return false;}
41 if(other.strand!=strand()){return false;}
42 return true;
43 }
44
45 public boolean equals(SiteScoreR other){
46 if(other.start!=start){return false;}
47 if(other.stop!=stop){return false;}
48 if(other.chrom!=chrom()){return false;}
49 if(other.strand!=strand()){return false;}
50 return true;
51 }
52
53 public StringBuilder toTextRecursive(StringBuilder sb){
54 if(sb==null){sb=new StringBuilder();}else{sb.append(" ");}
55 sb.append("("+toText()+")");
56 if(next!=null){next.toTextRecursive(sb);}
57 return sb;
58 }
59
60 public StringBuilder toText(){
61 StringBuilder sb=new StringBuilder();
62 sb.append(start).append(',');
63 sb.append(stop).append(',');
64 sb.append(chrom()).append(',');
65 sb.append(strand()).append(',');
66 sb.append(numericID()).append(',');
67 sb.append(pairNum());
68 return sb;
69 }
70
71 @Override
72 public String toString(){
73 return toText().toString();
74 }
75
76 public final int start;
77 public final int stop;
78 public final int chromStrand;
79 public final long idPairnum;
80 public SiteR next;
81
82 public long numericID(){return idPairnum>=0 ? idPairnum : -idPairnum;}
83 public int pairNum(){return idPairnum>=0 ? 0 : 1;}
84 public int chrom(){return chromStrand>=0 ? chromStrand : -chromStrand;}
85 public byte strand(){return chromStrand>=0 ? (byte)0 : (byte)1;};
86 public int listLength(){
87 int i=1;
88 SiteR sr=this;
89 while(sr.next!=null){
90 sr=sr.next;
91 i++;
92 }
93 return i;
94 }
95
96 }