import java.util.*;
import RunnerHistory;

public class Runner {
  static final int YLOCATION = 0;
  static final int XLOCATION = 1;
  static final int HEARTRATE = 2;
  static final int TEMPERATURE = 3;
  static final int STEPS = 4;
  static String[] datanames = {
    "yloc",
    "xloc",
    "speed",
    "dir",
    "heartrate",
    "temp",
    "newsteps",
    "totalsteps"
  };
  static int datatypes = 8;
  
  RunnerHistory dataset[] = new RunnerHistory[datatypes];
  RunnerHistory summary[] = new RunnerHistory[datatypes];
  long[] mostRecentData;
  public String name;
  
  static Hashtable runnerLookup = new Hashtable();
  
  Runner(String s) {
    int ct;
    
    name = s;
    for(ct=0;ct<datatypes;ct++) {
      dataset[ct] = new RunnerHistory(ct);
    }		
    mostRecentData = new long[Runner.datatypes];
    runnerLookup.put(name, this);
  }
  
  public Runner getRunnerByName(String n){
    return (Runner) runnerLookup.get(n);
  }	
  
  public void add(int type, RunnerData d){
    dataset[type].add(d);
  }
  public void add(int type, long when, double val) {
    this.add(type, when, val, val, val);
  }
  public void add(int type, long when, double val, 
		  double high, double low) {
    dataset[type].add(when, val, high, low);
  }

}
