- added some Todo docs
This commit is contained in:
2025-01-23 20:38:21 +01:00
parent 67c5a465a1
commit 4601e76438
2 changed files with 17 additions and 7 deletions

View File

@@ -8,7 +8,10 @@ import java.util.function.Consumer;
import net.berack.upo.valpre.rand.Rng; import net.berack.upo.valpre.rand.Rng;
/** /**
* TODO * A class that represents a network of queues, each with its own servers.
* The network in question is created by adding a node and then establishing
* connections between nodes. In order to start a simulation, at least one node
* must be a Source or must generate at least one event to be processed.
*/ */
public final class Net { public final class Net {
private final HashMap<String, Integer> indices = new HashMap<>(); private final HashMap<String, Integer> indices = new HashMap<>();
@@ -119,6 +122,9 @@ public final class Net {
this.servers.stream().forEach(consumer); this.servers.stream().forEach(consumer);
} }
/**
* A static inner class used to represent the connection between two nodes
*/
public static class Connection { public static class Connection {
public final int index; public final int index;
public double weight; public double weight;

View File

@@ -4,7 +4,7 @@ import java.util.Map;
/** /**
* Represents the statistics of a network simulation. * Represents the statistics of a network simulation.
* It is used by the simulation to track the behavior of the network and its * It is used by the simulation to save the final results of the network and its
* nodes, including the number of arrivals and departures, the maximum queue * nodes, including the number of arrivals and departures, the maximum queue
* length, the busy time, and the response time. * length, the busy time, and the response time.
*/ */
@@ -15,11 +15,13 @@ public class Result {
public final long timeElapsedNano; public final long timeElapsedNano;
/** /**
* Creates a new statistics object for the given collection of server nodes and * Creates a new result object for the given parameters obtained by the
* random number generator. * simulation.
* *
* @param nodes The collection of server nodes to track. * @param seed the initial seed used by the simulation
* @param rng The random number generator to use. * @param time the final time of the simulation
* @param elapsed the real time elapsed while running the simulation in ns
* @param nodes all the stats collected by the simulation saved per node
*/ */
public Result(long seed, double time, long elapsed, Map<String, Statistics> nodes) { public Result(long seed, double time, long elapsed, Map<String, Statistics> nodes) {
this.seed = seed; this.seed = seed;
@@ -56,7 +58,9 @@ public class Result {
} }
/** /**
* TODO * Get the global information of the simulation. In particular this method build
* a string that contains the seed and the time elapsed in the simulation and in
* real time
*/ */
public String getHeader() { public String getHeader() {
var size = (int) Math.ceil(Math.log10(this.simulationTime)); var size = (int) Math.ceil(Math.log10(this.simulationTime));