Skip to content

Commit 9d3ccbf

Browse files
committed
Merge branch 'master' of https://github.com/nmcl/JavaSim
2 parents e98c7db + fd50b98 commit 9d3ccbf

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed
File renamed without changes.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ JavaSIM has been available since 1997 and is an object-oriented simulation packa
44
- entity and set manipulation facilities similar to SIMSET.
55
- classes allow "non-causal" events, such as interrupts, to be handled.
66
- various statistical gathering routines, such as histogram and variance classes.
7-
- debugging classes.
87

98
The system also comes with complete examples and test routines which illustrate many of the issues raised in using the simulation package. It is used by many commercial and academic organisations.
109

1110
Prior to 2007 both C++SIM and JavaSim were freely available in source and binary from Newcastle University, under their own licence. However, in late 2007 the University decided that the code can be released into open source under LGPL.
1211

13-
We are in the process of providing new releases of JavaSim and C++SIM. In the meantime, if you want the old versions then you can find C++SIM 1.7.4 GA and JavaSim 0.3 GA available from the relevant distributions directory.
12+
You can find details of the releases in the https://github.com/nmcl/JavaSim/releases section as well as binary downloads.
1413

1514
In 2015 we moved from Codehaus due to that being closed down. All JIRAs from there were also migrated to github issues.
1615

docs/manual.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public class Simulation
111111
}
112112
----
113113

114-
To enable multiple simulation runs to occur within a single application, it is possible to reset it and the simulation clock by calling the reset() method of the Simulation class. This causes the simulation to remove all processes (simulation objects) currently registered on the scheduler queue and to invoke a class specific method on each of them which resets their states (detailed in the next section). Once this is finished the simulation is ready for an additional run. A suspended process is informed that it has been “reset” by having the method it called to originally suspend itself (i.e., place itself on the scheduler queue) raise the RestartSimulation exception, which the object should catch. It must then perform any work necessary to put itself back in a state ready for restarting the simulation, and should then suspend itself again before the simulation can be restarted (typically by calling cancel.)
114+
To enable multiple simulation runs to occur within a single application, it is possible to reset it and the simulation clock by calling the reset() method of the Simulation class. This causes the simulation to remove all processes (simulation objects) currently registered on the scheduler queue and to invoke a class specific method on each of them which resets their states (detailed in the next section). Once this is finished the simulation is ready for an additional run. A suspended process is informed that it has been “reset” by having the method it called to originally suspend itself (i.e., place itself on the scheduler queue) raise the RestartSimulation exception, which the object should catch. It must then perform any work necessary to put itself back in a state ready for restarting the simulation, and should then suspend itself again before the simulation can be restarted (typically by calling cancel, which is available on the SimulationProcess class.)
115115

116116
A process can use isReset() to determine whether or not the simulation has been reset. The start() and stop() operations allow the simulation to be halted or resumed respectively.
117117

@@ -370,7 +370,7 @@ public class Arrivals extends SimulationProcess
370370
{
371371
}
372372
}
373-
}
373+
}
374374
}
375375
----
376376

@@ -749,7 +749,7 @@ Semaphores are used within the simulation system. However, they can also be used
749749

750750
----
751751
public void test () throws Exception
752-
{
752+
{
753753
Semaphore sem = new Semaphore(2);
754754
DummyEntity e1 = new DummyEntity(10);
755755
DummyEntity e2 = new DummyEntity(20);
@@ -773,7 +773,7 @@ public void test () throws Exception
773773
774774
assertTrue(result == Semaphore.Outcome.DONE);
775775
assertTrue(sem.numberWaiting() == 1);
776-
}
776+
}
777777
----
778778

779779
As can be seen, the number of resources is passed to the Semaphore when it is created. We then create 3 SimulationEntities. At this stage there are no entities waiting (blocked waiting) on the Semaphore (numberWaiting returns 0). The first two entities gain access to the resources by calling Semaphore.get() before they would access or manipulate the resource(s). In this example we know that because no entity has yet released its access to the resource (e.g., lock on the resource), the next entity to try to acquire access via Semaphore.get() will block. To verify this we can use Semaphore.tryGet(), which in this case returns Outcome.WOULD_BLOCK to indicate this fact. Regardless, we then try to acquire access to the resource(s) and that entity is then blocked. This is verified by checking the number of entities waiting on the semaphore being released, i.e., numberWaiting() returns 1 in this case.

src/main/java/org/javasim/Semaphore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public Outcome get (SimulationEntity toWait)
110110
catch (SimulationException e)
111111
{
112112
}
113-
113+
114114
toWait.cancel();
115115
}
116116

src/test/java/org/javasim/examples/basic/BasicExampleUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testNoBreaks ()
4444
{
4545
}
4646
}
47-
47+
4848
@Test
4949
public void testBreaks ()
5050
{

0 commit comments

Comments
 (0)