Yurttas/PL/OOL/Java/F/09/02/01/00/CircleSeeding.java

From ZCubes Wiki
Revision as of 16:21, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="java" line start="1" enclose="div">import java.util.*; public class CircleSeeding extends StraightSeeding { public CircleSeeding(Vector sw, ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1import java.util.*;
 2
 3public class CircleSeeding extends StraightSeeding {
 4
 5  public CircleSeeding(Vector sw,
 6                       int lanes) {
 7    super(sw, lanes); //straight seed first
 8    seed();
 9  }
10
11  protected void seed() {
12    super.seed();        //do straight seed as default
13
14    int circle; 
15
16    if(numHeats>=2 ) {
17      if(numHeats>=3)
18        circle = 3;
19      else
20        circle = 2; 
21
22      int i = 0;
23      for(int j=0; j<numLanes; ++j)
24        for(int k=0; k<circle; ++k) {
25          swmrs[i].setLane(lanes[j]);
26          swmrs[i++].setHeat(numHeats-k);
27        }
28    }
29  }
30
31}