Class KineticsSimulation

java.lang.Object
edu.cnu.mdi.mdi3D.view3D.kineticsDemo.KineticsSimulation
All Implemented Interfaces:
edu.cnu.mdi.sim.Simulation

public class KineticsSimulation extends Object implements edu.cnu.mdi.sim.Simulation
Simulation wrapper for the kinetic-gas demo.

This class contains no UI code. It is executed on the simulation thread by SimulationEngine. Any UI updates must be requested through the engine (SimulationEngine.requestRefresh(), SimulationEngine.postProgress(ProgressInfo), etc.).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a KineticsSimulation with the given model.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the physics model.
    void
    init(edu.cnu.mdi.sim.SimulationContext ctx)
     
    void
    setEngine(edu.cnu.mdi.sim.SimulationEngine engine)
    Attach the engine so this simulation can post messages/progress/refresh.
    void
    setMaxSteps(int maxSteps)
    Set a safety cap on the number of steps.
    boolean
    step(edu.cnu.mdi.sim.SimulationContext ctx)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface edu.cnu.mdi.sim.Simulation

    cancel, shutdown
  • Constructor Details

    • KineticsSimulation

      public KineticsSimulation(KineticsModel model)
      Constructs a KineticsSimulation with the given model.
      Parameters:
      model - The KineticsModel to use. Must not be null.
  • Method Details

    • getModel

      public KineticsModel getModel()
      Returns the physics model.
      Returns:
      model (never null)
    • setEngine

      public void setEngine(edu.cnu.mdi.sim.SimulationEngine engine)
      Attach the engine so this simulation can post messages/progress/refresh.

      Called by the hosting view after it constructs the SimulationEngine.

      Parameters:
      engine - engine executing this simulation (may be null)
    • setMaxSteps

      public void setMaxSteps(int maxSteps)
      Set a safety cap on the number of steps.
      Parameters:
      maxSteps - max steps (>= 1)
    • init

      public void init(edu.cnu.mdi.sim.SimulationContext ctx) throws Exception
      Specified by:
      init in interface edu.cnu.mdi.sim.Simulation
      Throws:
      Exception
    • step

      public boolean step(edu.cnu.mdi.sim.SimulationContext ctx) throws Exception
      Specified by:
      step in interface edu.cnu.mdi.sim.Simulation
      Throws:
      Exception