public double nthHighestPeakValue(int n) { double result = 0d; TreeMap peaks = peakResults(); Iterator iter = peaks.values().iterator(); peakResult next = new peakResult(); if (peaks.size() > 0) { for (int i = 0; i < n && iter.hasNext(); i++) { next = (peakResult) (iter.next()); } if (null != next) result = next.peak; else result += -1d; } else { result = -1d; return result; } return result; }
public String nthHighestPeakItem(int n) { String result = ""; TreeMap peaks = peakResults(); Iterator iter = peaks.values().iterator(); iter = peaks.values().iterator(); peakResult next = new peakResult(); if (peaks.size() > 0) { for (int i = 0; i < n && iter.hasNext(); i++) { next = (peakResult) (iter.next()); // System.out.print(next.name+" "); } // System.out.println(); if (null != next) result = next.name; else result += "(null)"; return result; } else { return "(null)"; } }
public String nthItemToThreshold(int n, double threshold) { String result = ""; TreeMap decisions = decisionResults(threshold); Iterator iter = decisions.values().iterator(); decisResult next = new decisResult(); if (decisions.size() > 0) { /*for(int i=0;i<n&&decisions.size()>0;i++){ next = (decisResult)(decisions.remove(decisions.firstKey())); }*/ for (int i = 0; i < n && iter.hasNext(); i++) { next = (decisResult) iter.next(); } if (null != next) result = next.name; else result += "(null)"; } else { result += "(null)"; return result; } return result; }