1 19 20 package org.polepos.reporters; 21 22 import java.io.*; 23 24 import org.polepos.framework.*; 25 26 27 30 public abstract class Reporter { 31 32 protected final static String WEBSITE="http://www.polepos.org"; 33 34 protected final static String PATH="doc/results"; 35 36 protected Car mCar; 37 38 protected Team mTeam; 39 40 protected TeamCar mTeamCar; 41 42 private boolean mTaskListPrinted; 43 44 public Reporter(){ 45 new File(PATH).mkdirs(); 46 } 47 48 public abstract String file(); 49 50 public abstract boolean append(); 51 52 public abstract void startSeason(); 53 54 public abstract void endSeason(); 55 56 public String path(){ 57 return new File(PATH).getAbsolutePath(); 58 } 59 60 public void sendToCircuit(Circuit circuit) { 61 mTaskListPrinted = false; 62 } 63 64 public void noDriver(Team team, Circuit circuit) { 65 } 67 68 public void report( Team team, Car car, TurnSetup[] setups, TurnResult[] results ){ 69 70 if(! mTaskListPrinted){ 71 results[0].requestTaskNames(this); 72 mTaskListPrinted = true; 73 } 74 75 if(team != mTeam){ 76 mTeam = team; 77 reportTeam(team); 78 } 79 80 if(car != mCar){ 81 mCar = car; 82 reportCar(car); 83 } 84 85 mTeamCar = new TeamCar(team, car); 86 87 reportSetups(setups); 88 89 for ( int i = 0; i < results.length; i++ ){ 90 beginResults(); 91 if(results[i] != null){ 92 results[i].report(this); 93 } 94 } 95 } 96 97 public abstract void reportTaskName(int number, String name); 98 99 protected abstract void reportTeam(Team team); 100 101 protected abstract void reportCar(Car car); 102 103 public void reportSetups(TurnSetup[] setups){ 104 105 } 106 107 protected abstract void beginResults(); 108 109 public abstract void reportResult(Result result); 110 111 } 112
| Popular Tags
|