Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/VDM/VDMSL/ConwayGameLifeSL/src/gui/   (Wiener Entwicklungsmethode ©)  Datei vom 13.4.2020 mit Größe 1 kB image not shown  

Quelle  Graphics.java   Sprache: JAVA

 
package gui;
import java.awt.Point;
import java.io.Serializable;

import org.overture.interpreter.runtime.ValueException;
import org.overture.interpreter.values.IntegerValue;
import org.overture.interpreter.values.Value;


public class Graphics implements Serializable  {

 private static final long serialVersionUID = 1L;
 
 Controller ctrl;
    Model model;
    
    int sleepTime;
    
    public Value initialise(Value cellSideCount, Value timeTosleep) throws ValueException  {
     
     sleepTime = (int) timeTosleep.nat1Value(null);
     int sideCount = (int) cellSideCount.nat1Value(null);
     
        ctrl = new Controller(sideCount);
        model = ctrl.getModel();
        
        return new IntegerValue(0);
    }
    
    public void sleep(long time) {
      try {
    Thread.sleep(time);
   } catch (InterruptedException e) {
    e.printStackTrace();
   }
    }

    public Value sleep(Value time) throws ValueException{
        sleep(time.intValue(null));
     
        return new IntegerValue(0);
    }

    public Value newRound() throws ValueException {
     sleep(sleepTime);
        model.newSimulationRound();
        return new IntegerValue(0);
    }

 public Value newLivingCell(Value x, Value y) throws ValueException {
  model.newLivingCell(new Point((int)x.intValue(null), (int) y.intValue(null)));
  return new IntegerValue(0);
 }
}

92%


¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.