Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: SmokingControl.java   Sprache: JAVA

Original von: VDM©

package gui;

import org.overture.interpreter.debug.RemoteInterpreter;
import org.overture.interpreter.values.Value;

public class SmokingControl implements ISmokingControl
{

 private RemoteInterpreter interpreter;

 public SmokingControl(RemoteInterpreter intrprtr)
 {
  interpreter = intrprtr;
  Controller.smoke = this;
 }

 public void init()
 {
  try
  {
   execute("create w := new World(100)");
   execute("w.Run()");
  } catch (Exception e)
  {
   e.printStackTrace();
  }
 }

 @Override
 public void AddPaper()
 {
  try
  {
   execute("w.agent.AddPaper()");
   execute("w.Yield()"); // Optimization for thread fairness
  } catch (Exception e)
  {
   e.printStackTrace();
  }
 }

 @Override
 public void AddMatch()
 {
  try
  {
   execute("w.agent.AddMatch()");
   execute("w.Yield()");
  } catch (Exception e)
  {
   e.printStackTrace();
  }
 }

 @Override
 public void AddTobacco()
 {
  try
  {
   execute("w.agent.AddTobacco()");
   execute("w.Yield()");
  } catch (Exception e)
  {
   e.printStackTrace();
  }
 }

 private Value execute(String arguments) throws Exception
 {
  String cmd = arguments;
  if (cmd.toLowerCase().startsWith("create"))
  {
   cmd = cmd.substring(cmd.indexOf(" "));
   cmd = cmd.trim();
   String name = cmd.substring(0, cmd.indexOf(" "));
   String exp = cmd.substring(cmd.indexOf(":=") + 2);
   System.out.println("CREATE: var: " + name + " exp: " + exp);
   interpreter.create(name, exp);
   return null;
  } else if (cmd.toLowerCase().startsWith("debug")
    || cmd.toLowerCase().startsWith("print"))
  {
   cmd = /* "p" + */cmd.substring(cmd.indexOf(" "));

   cmd = cmd.trim();
  }

  try
  {
   System.out.println("Calling VDMJ with: " + cmd);
   Value result = interpreter.valueExecute(cmd);
   return result;
  } catch (Exception e)
  {
   throw e;
  }
 }

 /**
 * Notifies Overture that the remote interface is being disposed and that interpretation is finished. After this
 * Overture is allowed to terminate the current process.
 */

 public void finish()
 {
  this.interpreter.finish();
 }
}

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




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.


Bot Zugriff



                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik