// Path: src/com/ndtorrent/client/RollingTotal.java
// public final class RollingTotal {
// 
// 	private double[] buckets;
// 	private double total;
// 
// 	public RollingTotal(int nbuckets) {
// 		if (nbuckets < 1)
// 			throw new IllegalArgumentException(
// 					"nbuckets must be greater than zero");
// 
// 		buckets = new double[nbuckets];
// 	}
// 
// 	public void add(double amount) {
// 		buckets[0] += amount;
// 		total += amount;
// 	}
// 
// 	public void roll() {
// 		// Roll after you have queried the total.
// 
// 		total -= buckets[buckets.length - 1];
// 
// 		for (int i = buckets.length - 1; i >= 1; i--) {
// 			buckets[i] = buckets[i - 1];
// 		}
// 
// 		buckets[0] = 0;
// 	}
// 
// 	public double total() {
// 		return total;
// 	}
// 
// 	public double average() {
// 		return total / buckets.length;
// 	}
// 
// 	public double[] array() {
// 		return buckets;
// 	}
// 
// }


import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.geom.Rectangle2D;
import javax.swing.JComponent;
import com.ndtorrent.client.RollingTotal;
package com.ndtorrent.gui;




public final class SpeedGraph extends JComponent {

	private static final long serialVersionUID = 1L;

	// TODO use a timer to repaint

	private Color bg_color = new Color(0xE3EADA);
	private Color color1 = new Color(0xFF8800);
	private Color color2 = new Color(0x1F8800);
	private Color color3 = new Color(0x8B8E87);

// Path: src/com/ndtorrent/client/RollingTotal.java
// public final class RollingTotal {
// 
// 	private double[] buckets;
// 	private double total;
// 
// 	public RollingTotal(int nbuckets) {
// 		if (nbuckets < 1)
// 			throw new IllegalArgumentException(
// 					"nbuckets must be greater than zero");
// 
// 		buckets = new double[nbuckets];
// 	}
// 
// 	public void add(double amount) {
// 		buckets[0] += amount;
// 		total += amount;
// 	}
// 
// 	public void roll() {
// 		// Roll after you have queried the total.
// 
// 		total -= buckets[buckets.length - 1];
// 
// 		for (int i = buckets.length - 1; i >= 1; i--) {
// 			buckets[i] = buckets[i - 1];
// 		}
// 
// 		buckets[0] = 0;
// 	}
// 
// 	public double total() {
// 		return total;
// 	}
// 
// 	public double average() {
// 		return total / buckets.length;
// 	}
// 
// 	public double[] array() {
// 		return buckets;
// 	}
// 
// }


// Path: src/com/ndtorrent/gui/SpeedGraph.java
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.geom.Rectangle2D;
import javax.swing.JComponent;
import com.ndtorrent.client.RollingTotal;

package com.ndtorrent.gui;




public final class SpeedGraph extends JComponent {

	private static final long serialVersionUID = 1L;

	// TODO use a timer to repaint

	private Color bg_color = new Color(0xE3EADA);
	private Color color1 = new Color(0xFF8800);
	private Color color2 = new Color(0x1F8800);
	private Color color3 = new Color(0x8B8E87);

	private RollingTotal input_rate = new RollingTotal(5 * 60);