コード例 #1
0
ファイル: RandomWalker.java プロジェクト: jehanson4/lorenz
  @Override
  public void doStep() {
    final String mtdName = "doStep";
    if (logger.isLoggable(Level.FINER)) logger.logp(Level.FINER, clsName, mtdName, "entering");
    currentX += stepSize * (2 * rng.nextDouble() - 1);
    currentY += stepSize * (2 * rng.nextDouble() - 1);
    currentZ += stepSize * (2 * rng.nextDouble() - 1);
    currentT += timeStep;

    currentX = bounce(currentX, bounds.getXMin(), bounds.getXMax());
    currentY = bounce(currentY, bounds.getYMin(), bounds.getYMax());
    currentZ = bounce(currentZ, bounds.getZMin(), bounds.getZMax());
  }
コード例 #2
0
ファイル: IDGenerator.java プロジェクト: linlicliff/nbcal
 public long next() {
   if (persist && current >= max) {
     lock.lock();
     try {
       if (seed == null) {
         seed = DataBox.get().getGlobalTable();
       }
       String ss = seed.getRecord(name);
       if (ss == "") {
         current = 1;
       } else {
         current = Convert.toLong(ss);
       }
       max = current + 100;
       String bb = Convert.toString(max);
       seed.putRecord(name, bb);
     } finally {
       lock.unlock();
     }
   }
   current++;
   return current - 1;
 }
コード例 #3
0
 public int compare(DataBox a, DataBox b) {
   TimeStamp ta = a.getTargetTime();
   TimeStamp tb = b.getTargetTime();
   return ta.timeFormatted().compareTo(tb.timeFormatted());
 }
コード例 #4
0
 @Override
 public void run() {
   for (int i = 1; i <= 3; i++) {
     String data = dataBox.getData();
   }
 }