summaryrefslogtreecommitdiff
path: root/src/main/java/simulator/engine/SimulationEngine.java
blob: d557aef1b474a11e029494a00a4df02d1217ba4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package simulator.engine;

import core.VSInternalProcess;
import core.VSTaskManager;
import core.VSMessage;
import java.util.List;

/**
 * Core simulation engine interface that defines all simulation operations
 * without any GUI dependencies.
 */
public interface SimulationEngine {
    
    /**
     * Send a message between processes.
     * @param message The message to send
     */
    void sendMessage(VSMessage message);
    
    /**
     * Add a process to the simulation.
     * @param process The process to add
     */
    void addProcess(VSInternalProcess process);
    
    /**
     * Remove a process from the simulation.
     * @param process The process to remove
     */
    void removeProcess(VSInternalProcess process);
    
    /**
     * Get all processes in the simulation.
     * @return List of processes
     */
    List<VSInternalProcess> getProcesses();
    
    /**
     * Get a specific process by index.
     * @param index The process index
     * @return The process or null if not found
     */
    VSInternalProcess getProcess(int index);
    
    /**
     * Get the number of processes.
     * @return Process count
     */
    int getNumProcesses();
    
    /**
     * Get the task manager.
     * @return The task manager
     */
    VSTaskManager getTaskManager();
    
    /**
     * Get the current simulation time.
     * @return Current time in milliseconds
     */
    long getTime();
    
    /**
     * Set the simulation time.
     * @param time Time in milliseconds
     */
    void setTime(long time);
    
    /**
     * Reset the simulation to initial state.
     */
    void reset();
    
    /**
     * Start or resume the simulation.
     */
    void play();
    
    /**
     * Pause the simulation.
     */
    void pause();
    
    /**
     * Check if simulation is paused.
     * @return true if paused
     */
    boolean isPaused();
    
    /**
     * Check if simulation has been reset.
     * @return true if reset
     */
    boolean isResetted();
    
    /**
     * Check if simulation has finished.
     * @return true if finished
     */
    boolean hasFinished();
    
    /**
     * Set finished state.
     * @param finished The finished state
     */
    void setFinished(boolean finished);
    
    /**
     * Add a visualization observer.
     * @param visualizer The visualizer to add
     */
    void addVisualizer(SimulationVisualizer visualizer);
    
    /**
     * Remove a visualization observer.
     * @param visualizer The visualizer to remove
     */
    void removeVisualizer(SimulationVisualizer visualizer);
}