Package net.geco.model

Examples of net.geco.model.RunnerRaceData


    runnersTable.setRowSorter(sorter);
  }

 
  private void updateRunnerMap() {
    RunnerRaceData runnerData = registry().findRunnerData(selectedChip());
    if( runnerData!=null ) {
      liveComponent.displayRunnerMap(runnerData);
    }
  }
View Full Code Here


  public List<RankedRunner> getRanking() {
    if( this.memoRanking==null ) {
      this.memoRanking = new Vector<RankedRunner>(rankedRunners.size());
      int rank = 1;
      int counter = 1;
      RunnerRaceData previous = null;
      for (RunnerRaceData runner : this.rankedRunners) {
        if( previous!=null &&
            previous.getResult().getRacetime()!=runner.getResult().getRacetime() ) {
          rank = counter; // increment or jump to current counter
        } // else: same rank, do not increment
        this.memoRanking.add(new RankedRunnerImpl(rank, runner));
        previous = runner;
        counter++;
View Full Code Here

  private void appendHtmlResultsWithSplits(Result result, Map<RunnerRaceData, SplitTime[]> allSplits,
                          SplitTime[] bestSplit, ResultConfig config, Html html) {
    html.nl().tag("h2", "class=\"pool\"", result.getIdentifier()).nl(); //$NON-NLS-1$ //$NON-NLS-2$
    html.open("table").nl(); //$NON-NLS-1$
    for (RankedRunner runner : result.getRanking()) {
      RunnerRaceData data = runner.getRunnerData();
      generateHtmlSplitsFor(
          data,
          Integer.toString(runner.getRank()),
          data.getResult().formatRacetime(),
          allSplits.get(data),
          bestSplit,
          html);
    }
    emptyTr(html);
View Full Code Here

  public RunnerBuilder(Factory factory) {
    super(factory);
  }

  public RunnerRaceData buildRunnerData() {
    RunnerRaceData data = factory().createRunnerRaceData();
    data.setResult(factory().createRunnerResult());
    return data;
  }
View Full Code Here

  private void appendCsvResult(Result result, ResultConfig config, CsvWriter writer) throws IOException {
    String id = result.getIdentifier();
    // Format: result id, rank/status, first name, last name, club, [, time/status [, real time, nb mps]]
    for (RankedRunner rRunner : result.getRanking()) {
      RunnerRaceData runnerData = rRunner.getRunnerData();
      writeCsvResult(
          id,
          runnerData,
          Integer.toString(rRunner.getRank()),
          runnerData.getResult().formatRacetime(),
          config.showPenalties,
          writer);
    }
    for (RunnerRaceData runnerData : result.getNRRunners()) {
      Runner runner = runnerData.getRunner();
      if( !runner.isNC() ) {
        writeCsvResult(
            id,
            runnerData,
            runnerData.getResult().formatStatus(),
            runnerData.getResult().formatStatus(),
            config.showPenalties,
            writer);
      } else if( config.showNC ) {
        writeCsvResult(
            id,
            runnerData,
            "NC", //$NON-NLS-1$
            runnerData.getResult().shortFormat(), // time or status
            config.showPenalties,
            writer);
      }
    }
    if( config.showOthers ) {
      for (RunnerRaceData runnerData : result.getOtherRunners()) {
        writeCsvResult(
            id,
            runnerData,
            runnerData.getResult().formatStatus(),
            runnerData.getResult().formatStatus(),
            config.showPenalties,
            writer);
      }     
    }
  }
View Full Code Here

  }

  @Test
  public void testData363786B() {
//    363786;0:00:00;11:16:07;11:16:12;11:31:41;187;11:17:10;186;11:17:59;177;11:18:46;174;11:20:04;175;11:22:25;176;11:23:47;182;11:25:27;163;11:27:19;184;11:27:56;185;11:28:12;161;11:30:33;162;11:30:54;190;11:31:27;
    RunnerRaceData data = registryB.findRunnerData("363786");
    assertEquals("Jonathan", data.getRunner().getFirstname());
    assertEquals("Quinn", data.getRunner().getLastname());
    assertEquals("0:00", TimeManager.time(data.getErasetime()));
    assertEquals("11:16:07", TimeManager.time(data.getControltime()));
    assertEquals("11:16:12", TimeManager.time(data.getStarttime()));
    assertEquals("11:31:41", TimeManager.time(data.getFinishtime()));
    Punch[] punches = data.getPunches();
    assertEquals(13, punches.length);
    assertArrayEquals(data.getRunner().getCourse().getCodes(),
              collectPunchCodes(punches));
    testPunch(187, "11:17:10", punches[0]);
    testPunch(174, "11:20:04", punches[3]);
    testPunch(190, "11:31:27", punches[12]);
    long raceTime = data.getFinishtime().getTime() - data.getStarttime().getTime();
    assertEquals("15:29", TimeManager.time(new Date(raceTime)));
  }
View Full Code Here

 
  @Test
  public void testCardDataImport(){
    runnerFactory(66);
    CardDataIO cardDataIO = new CardDataIO(factory, null, null, registry);
    RunnerRaceData runnerData = cardDataIO.importTData(new String[]{
      "66", "--:--", "1:00:00", "1:00:15", "1:05:00", "2:10:05", "31", "1:06:15", "32", "1:32:42"       
//    Start id,Read time,Clear time,Check time,Start time,Finish time,Control,Split time, ...
    });
    cardDataIO.register(runnerData, registry);
    assertEquals(TimeManager.NO_TIME, runnerData.getReadtime());
    assertEquals(TimeManager.safeParse("1:00:00"), runnerData.getErasetime());
    assertEquals(TimeManager.safeParse("1:00:15"), runnerData.getControltime());
    assertEquals(TimeManager.safeParse("1:05:00"), runnerData.getStarttime());
    assertEquals(TimeManager.safeParse("2:10:05"), runnerData.getFinishtime());
    Punch[] punches = runnerData.getPunches();
    assertEquals(2, punches.length);
    assertEquals(31, punches[0].getCode());
    assertEquals(TimeManager.safeParse("1:06:15"), punches[0].getTime());
    assertEquals(32, punches[1].getCode());
    assertEquals(TimeManager.safeParse("1:32:42"), punches[1].getTime());
View Full Code Here

  @Test
  public void testCardDataImportMigration12(){ // MIGR12
    CardDataIO cardDataIO = new CardDataIO(factory, null, null, registry, false);
    runnerFactory(67, "501aa");
    RunnerRaceData runnerData = cardDataIO.importTData(new String[]{
      "501aa", "1:00:00", "--:--", "1:00:15", "1:05:00", "2:10:05", "33", "1:06:15"       
    });
    cardDataIO.register(runnerData, registry);
    assertEquals(TimeManager.safeParse("1:00:00"), runnerData.getReadtime());
    assertEquals(TimeManager.NO_TIME, runnerData.getErasetime());
    assertEquals(TimeManager.safeParse("1:00:15"), runnerData.getControltime());
    assertEquals(TimeManager.safeParse("1:05:00"), runnerData.getStarttime());
    assertEquals(TimeManager.safeParse("2:10:05"), runnerData.getFinishtime());
    Punch[] punches = runnerData.getPunches();
    assertEquals(1, punches.length);
    assertEquals(33, punches[0].getCode());
    assertEquals(TimeManager.safeParse("1:06:15"), punches[0].getTime());
  }
View Full Code Here

    runnerFactory(66);
    CardDataIO cardDataIO = new CardDataIO(factory, null, null, registry);
    String[] record = new String[]{
      "66", "--:--", "1:00:00", "1:00:15", "1:05:00", "2:10:05", "31", "1:06:15", "32", "1:32:42"       
    };
    RunnerRaceData runnerData = cardDataIO.importTData(record);
    cardDataIO.register(runnerData, registry);
    assertArrayEquals(record, cardDataIO.exportTData(runnerData));
  }
View Full Code Here

  @Test
  public void testResultDataImport(){
    testCardDataImport();
    ResultDataIO resultDataIO = new ResultDataIO(factory, null, null, registry);
    RunnerRaceData raceData = resultDataIO.importTData(new String[]{
      "66", "NOS", "0:59:25"
      // start id, status, racetime
    });
    assertEquals(Status.NOS, raceData.getStatus());
    assertEquals(TimeManager.safeParse("0:59:25").getTime(), raceData.getResult().getRacetime());
  }
View Full Code Here

TOP

Related Classes of net.geco.model.RunnerRaceData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.