private ContourDataset createDataset() { List dirs = content.getDirectories(); List dateList = new ArrayList(); Date firstDate = content.getFirstDate(); Date lastDate = content.getLastDate(); Calendar cal = new GregorianCalendar(); cal.setTime(firstDate); while (cal.getTime().before(lastDate)) { dateList.add(cal.getTime()); cal.add(Calendar.DATE, 1); } dateList.add(lastDate); Double[][] values = new Double[dateList.size()][dirs.size()]; for (int i = 0; i < dateList.size(); i++) { Iterator dirsIt = dirs.iterator(); IntegerMap changesMap = new IntegerMap(); while (dirsIt.hasNext()) { Directory dir = (Directory) dirsIt.next(); RevisionIterator revIt = new RevisionSortIterator(dir.getRevisionIterator()); while (revIt.hasNext()) { CvsRevision rev = revIt.next(); Date revDate = rev.getDate(); Date currDate = (Date) dateList.get(i); Date nextDate = null; if (i < dateList.size() - 1) { nextDate = (Date) dateList.get(i + 1); } if (revDate.equals(currDate) || (revDate.after(currDate) && revDate.before(nextDate))) { changesMap.inc(dir); } } } Iterator cIt = changesMap.iteratorSortedByKey(); while (cIt.hasNext()) { Directory dir = (Directory) cIt.next(); int dirIndex = dirs.indexOf(dir); // values[i][dirIndex] = new Double(changesMap.getPercent(dir)); values[i][dirIndex] = new Double(changesMap.getPercentOfMaximum(dir)); } } int numValues = dateList.size() * dirs.size(); Date[] oDateX = new Date[numValues]; Double[] oDoubleY = new Double[numValues]; Double[] oDoubleZ = new Double[numValues]; for (int x = 0; x < dateList.size(); x++) { for (int y = 0; y < dirs.size(); y++) { int index = (x * dirs.size()) + y; oDateX[index] = (Date) dateList.get(x); oDoubleY[index] = new Double(y); if ((values[x][y] != null) && ((values[x][y].isNaN()) || (values[x][y].equals(new Double(0))))) { values[x][y] = null; } oDoubleZ[index] = values[x][y]; } } oDoubleZ[0] = new Double(0.0); return new DefaultContourDataset(getTitle(), oDateX, oDoubleY, oDoubleZ); }
public int visit(CvsRevision rev) { fileCount += rev.getFileCountDelta(); return fileCount; }