1 43 44 package org.jfree.chart.renderer; 45 46 import java.util.ArrayList ; 47 import java.util.Iterator ; 48 import java.util.List ; 49 50 62 public class OutlierListCollection { 63 64 65 private List outlierLists; 66 67 71 private boolean highFarOut = false; 72 73 77 private boolean lowFarOut = false; 78 79 82 public OutlierListCollection() { 83 this.outlierLists = new ArrayList (); 84 } 85 86 92 public boolean isHighFarOut() { 93 return this.highFarOut; 94 } 95 96 102 public void setHighFarOut(boolean farOut) { 103 this.highFarOut = farOut; 104 } 105 106 112 public boolean isLowFarOut() { 113 return this.lowFarOut; 114 } 115 116 122 public void setLowFarOut(boolean farOut) { 123 this.lowFarOut = farOut; 124 } 125 136 public boolean add(Outlier outlier) { 137 138 if (this.outlierLists.isEmpty()) { 139 return this.outlierLists.add(new OutlierList(outlier)); 140 } 141 else { 142 boolean updated = false; 143 for (Iterator iterator = this.outlierLists.iterator(); 144 iterator.hasNext();) { 145 OutlierList list = (OutlierList) iterator.next(); 146 if (list.isOverlapped(outlier)) { 147 updated = updateOutlierList(list, outlier); 148 } 149 } 150 if (!updated) { 151 updated = this.outlierLists.add(new OutlierList(outlier)); 153 } 154 return updated; 155 } 156 157 } 158 159 164 public Iterator iterator() { 165 return this.outlierLists.iterator(); 166 } 167 168 169 179 private boolean updateOutlierList(OutlierList list, Outlier outlier) { 180 boolean result = false; 181 result = list.add(outlier); 182 list.updateAveragedOutlier(); 183 list.setMultiple(true); 184 return result; 185 } 186 187 } 188 | Popular Tags |