public String toString() { StringBuilder s = new StringBuilder(); s.append("["); for (GenomeLoc e : this) { s.append(" "); s.append(e.toString()); } s.append("]"); return s.toString(); }
/** * add a genomeLoc to the collection, simply inserting in order into the set * * @param e the GenomeLoc to add * @return true */ public boolean add(GenomeLoc e) { // assuming that the intervals coming arrive in order saves us a fair amount of time (and it's // most likely true) if (mArray.size() > 0 && e.isPast(mArray.get(mArray.size() - 1))) { mArray.add(e); return true; } else { int loc = Collections.binarySearch(mArray, e); if (loc >= 0) { throw new ReviewedStingException( "Genome Loc Sorted Set already contains the GenomicLoc " + e.toString()); } else { mArray.add((loc + 1) * -1, e); return true; } } }