Update of /cvsroot/freenet/freenet/src/freenet/node/rt
In directory sc8-pr-cvs1:/tmp/cvs-serv30464/src/freenet/node/rt

Modified Files:
        ResponseTimeEstimator.java 
Log Message:
Fixed the missing red crosses and non-clipped estimator graphs.

Index: ResponseTimeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/ResponseTimeEstimator.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -w -r1.34 -r1.35
--- ResponseTimeEstimator.java  4 Nov 2003 17:05:40 -0000       1.34
+++ ResponseTimeEstimator.java  4 Nov 2003 21:55:13 -0000       1.35
@@ -602,19 +602,17 @@
                        if (recentPtr >= RECENT_LENGTH)
                                recentPtr = 0;
                }
-               synchronized LowestHighestPair getLowestAndHighest(boolean 
dontClipPoints) {
+               synchronized LowestHighestPair getLowestAndHighest() {
                        LowestHighestPair l = new LowestHighestPair();
                        int x = recentPtr;
                        if (recentCount > RECENT_LENGTH)
                                x = RECENT_LENGTH;
-                       if (dontClipPoints) {
                                for (int i = 0; i < x; i++) {
                                        if (recentTimes[i] < l.lowest)
                                                l.lowest = recentTimes[i];
                                        if (recentTimes[i] > l.highest)
                                                l.highest = recentTimes[i];
                                }
-                       }
                        return l;
                }
 
@@ -734,8 +732,8 @@
                public void drapGraphOnImage(boolean dontClipPoints, Bitmap 
bmp,boolean drawHistoryIfPossible, Color lineCol, Color crossCol) {
                        
                        LinkedList l = new LinkedList();
-                       int lowest=Integer.MAX_VALUE;
-                       int highest=0;
+                       long lowest=Long.MAX_VALUE;
+                       long highest=0;
                        BigInteger keyspaceLastKey = 
Key.keyspace.subtract(BigInteger.ONE);
                        BigInteger keyspaceStepLength = 
keyspaceLastKey.divide(BigInteger.valueOf(bmp.getWidth())); //Pregenerate these values 
to save us some later calculations
                        
@@ -754,10 +752,18 @@
                                        l.addFirst(g); //Make sure we draw the 
recentmost graph last (=on top of the others)
                                        if(i2>1)
                                                lineCol = Color.add(lineCol, new 
Color(4, 4, 4)); //The older in the history, the lighter
-                                       else
+                                       else {
+                                               if(dontClipPoints){
+                                                       g.lowest = Math.min(g.lowest, 
lowestRaw());
+                                                       g.highest = 
Math.max(g.highest, highestRaw());
+                                                       lowest = Math.min(g.lowest, 
lowest);
+                                                       highest = Math.max(g.highest, 
highest);
+                                               }
+                                               g.crossCol = crossCol; //Only support 
drawing of crosses on the current-data graph
                                                lineCol = Color.add(lineCol, new 
Color(50, 50, 50)); //Make a larger step when we initially go into history values
                                }
                        }
+                       }
                        Iterator it = l.iterator();
                        while(it.hasNext()){
                                GraphDataSet n = (GraphDataSet)it.next();
@@ -769,13 +775,13 @@
                private class GraphDataSet{
                        int[] val;
                        Color lineCol,crossCol;
-                       int lowest=Integer.MAX_VALUE;
-                       int highest=0;
+                       long lowest=Integer.MAX_VALUE;
+                       long highest=0;
                }
                private void drapGraphOnImage(boolean dontClipPoints, Bitmap bmp, 
GraphDataSet g,BigInteger keyspaceStepLength) {
                
-                       if(g.crossCol != null){ //Only consider recent max/min if we 
are actually going to draw the crosses
-                               RecentReports.LowestHighestPair lowestAndHighestRecent 
= recent.getLowestAndHighest(dontClipPoints);
+                       if(dontClipPoints){
+                               RecentReports.LowestHighestPair lowestAndHighestRecent 
= recent.getLowestAndHighest();
                                g.lowest = Math.min(lowestAndHighestRecent.lowest, 
g.lowest);
                                g.highest = Math.max(lowestAndHighestRecent.highest, 
g.highest);
                        }

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to