private SortData makeData(int begin, int end, int left, int right, int pivot) { SortData d = makeData(); Bar[] b = d.getBars(); for (int i = 0; i < begin; i++) { b[i].setBg(unsel_bg); b[i].setFg(unsel_fg); } for (int i = left; i < right; i++) { b[i].setBg(unsort_bg); } for (int i = end; i < a.length; i++) { b[i].setBg(unsel_bg); b[i].setFg(unsel_fg); } if (pivot < a.length) { b[pivot].setFg(pivot_fg); List<Line> l = d.getLines(); l.add(new HorizontalLine(pivot_hl, 1, a[pivot])); if (left != right) { l.add(new VerticalLine(left_vl, 2, left)); l.add(new VerticalLine(right_vl, 2, right)); } else { l.add(new VerticalLine(lr_vl, 2, left)); } } return d; }
private void unpackData(SortData d) { this.bars = Arrays.asList(d.getBars()); this.lines = d.getLines(); this.barwidth = d.getBarwidth(); this.gapwidth = d.getGapwidth(); this.unitheight = d.getUnitheight(); }
private SortData makeData( int begin, int end, int left, int right, int pivot, int swap0, int swap1) { SortData d = makeData(begin, end, left, right, pivot); Bar[] b = d.getBars(); b[swap0].setFg(swap_fg); b[swap1].setFg(swap_fg); return d; }