jpayne@68: package prok; jpayne@68: jpayne@68: import java.util.Arrays; jpayne@68: jpayne@68: import shared.Tools; jpayne@68: import stream.Read; jpayne@68: import structures.ByteBuilder; jpayne@68: import structures.LongHashSet; jpayne@68: jpayne@68: class StatsContainer { jpayne@68: jpayne@68: /*--------------------------------------------------------------*/ jpayne@68: /*---------------- Initialization ----------------*/ jpayne@68: /*--------------------------------------------------------------*/ jpayne@68: jpayne@68: StatsContainer(int type_, int kInner, int framesInner, int kStart, int framesStart, int offsetStart, int kStop, int framesStop, int offsetStop){ jpayne@68: type=type_; jpayne@68: name=ProkObject.typeStrings[type]; jpayne@68: setInner(kInner, framesInner); jpayne@68: setStart(kStart, framesStart, offsetStart); jpayne@68: setStop(kStop, framesStop, offsetStop); jpayne@68: } jpayne@68: jpayne@68: StatsContainer(int type_){ jpayne@68: type=type_; jpayne@68: name=ProkObject.typeStrings[type]; jpayne@68: } jpayne@68: jpayne@68: void setInner(int kInner, int framesInner){ jpayne@68: assert(inner==null); jpayne@68: statsArray[0]=inner=new FrameStats(name+" inner", kInner, framesInner, 0); jpayne@68: } jpayne@68: jpayne@68: void setStart(int kStart, int framesStart, int offsetStart){ jpayne@68: assert(start==null); jpayne@68: statsArray[1]=start=new FrameStats(name+" start", kStart, framesStart, offsetStart); jpayne@68: } jpayne@68: jpayne@68: void setStop(int kStop, int framesStop, int offsetStop){ jpayne@68: assert(stop==null); jpayne@68: statsArray[2]=stop=new FrameStats(name+" stop", kStop, framesStop, offsetStop); jpayne@68: } jpayne@68: jpayne@68: void setInner(FrameStats fs){ jpayne@68: assert(inner==null); jpayne@68: assert(fs!=null); jpayne@68: statsArray[0]=inner=fs; jpayne@68: } jpayne@68: jpayne@68: void setStart(FrameStats fs){ jpayne@68: assert(start==null); jpayne@68: statsArray[1]=start=fs; jpayne@68: } jpayne@68: jpayne@68: void setStop(FrameStats fs){ jpayne@68: assert(stop==null); jpayne@68: statsArray[2]=stop=fs; jpayne@68: } jpayne@68: jpayne@68: /*--------------------------------------------------------------*/ jpayne@68: /*---------------- Methods ----------------*/ jpayne@68: /*--------------------------------------------------------------*/ jpayne@68: jpayne@68: @Override jpayne@68: public String toString(){ jpayne@68: return appendTo(new ByteBuilder()).toString(); jpayne@68: } jpayne@68: jpayne@68: public ByteBuilder appendTo(ByteBuilder bb) { jpayne@68: bb.append("#name\t").append(name).nl(); jpayne@68: bb.append("#type\t").append(type).nl(); jpayne@68: bb.append("#count\t").append(lengthCount).nl(); jpayne@68: bb.append("#lengthSum\t").append(lengthSum).nl(); jpayne@68: //lengths jpayne@68: bb.append("#contains\t").append(3).nl(); jpayne@68: if(ProkObject.processType(type)) { jpayne@68: for(FrameStats fs : statsArray){ jpayne@68: fs.appendTo(bb); jpayne@68: } jpayne@68: }else{ jpayne@68: for(FrameStats fs : statsArray){ jpayne@68: fs.append0(bb); jpayne@68: } jpayne@68: } jpayne@68: return bb; jpayne@68: } jpayne@68: jpayne@68: public void clear(){ jpayne@68: for(int i=0; i