diff --git a/src/main/java/lu/jpt/csparqltest/Main.java b/src/main/java/lu/jpt/csparqltest/Main.java index 108fccc..c4575e2 100644 --- a/src/main/java/lu/jpt/csparqltest/Main.java +++ b/src/main/java/lu/jpt/csparqltest/Main.java @@ -7,6 +7,13 @@ import org.slf4j.LoggerFactory; import lu.jpt.csparqltest.gui.SimulationControlWindow; import lu.jpt.csparqltest.rentacar.RentACarSimulation; +/** + * This is the main entry point of the whole project. A logger is being set up + * and the SimulationContext gets initialized to allow a control window to be + * hooked up to it. + * The SimulationContext class takes it from there. The window merely provides a + * control interface for the user. + */ public class Main { public static Logger logger = LoggerFactory.getLogger(Main.class); diff --git a/src/main/java/lu/jpt/csparqltest/SimulationContext.java b/src/main/java/lu/jpt/csparqltest/SimulationContext.java index 0237c02..d84e7f3 100644 --- a/src/main/java/lu/jpt/csparqltest/SimulationContext.java +++ b/src/main/java/lu/jpt/csparqltest/SimulationContext.java @@ -14,6 +14,18 @@ import eu.larkc.csparql.core.engine.CsparqlQueryResultProxy; import lu.jpt.csparqltest.gui.TextObserverWindow; import lu.jpt.csparqltest.rentacar.RentACarSimulation; +/** + * This class encapsulates the use of the C-SPARQL Engine. Here, the RentACarSimulation, + * which provides the needed event streams is being initialized, and its event streams + * are being registered with the engine. + * + * Also, the neccessary C-SPARQL queries are fetched from the RentACarSimulation and + * also getting registered with the engine. This way, everything you may need to know + * about how to use the engine itself lies within here. + * + * Take a look at the methods setup() + * and teardown(), since they contain the most important parts. + */ public class SimulationContext { public static Logger logger = LoggerFactory.getLogger(SimulationContext.class); diff --git a/src/main/java/lu/jpt/csparqltest/gui/SimulationControlWindow.java b/src/main/java/lu/jpt/csparqltest/gui/SimulationControlWindow.java index e5d25be..ee164ef 100644 --- a/src/main/java/lu/jpt/csparqltest/gui/SimulationControlWindow.java +++ b/src/main/java/lu/jpt/csparqltest/gui/SimulationControlWindow.java @@ -11,6 +11,10 @@ import javax.swing.JPanel; import lu.jpt.csparqltest.SimulationContext; +/** + * Basically a window with control buttons that trigger actions + * in the SimulationContext. Think of it as a basic remote control. + */ public class SimulationControlWindow extends JFrame { private static final long serialVersionUID = 1L; diff --git a/src/main/java/lu/jpt/csparqltest/misc/TestStreamGenerator.java b/src/main/java/lu/jpt/csparqltest/misc/TestStreamGenerator.java index c1cccc0..581bad4 100644 --- a/src/main/java/lu/jpt/csparqltest/misc/TestStreamGenerator.java +++ b/src/main/java/lu/jpt/csparqltest/misc/TestStreamGenerator.java @@ -7,6 +7,10 @@ import eu.larkc.csparql.cep.api.RdfQuadruple; import lu.jpt.csparqltest.util.RandomHelper; import lu.jpt.csparqltest.util.WindowLoggingRdfStream; +/** + * This event stream generator was used for debugging and experimenting + * with C-SPARQL queries. It is not actively used for the RentACarSimulation. + */ public class TestStreamGenerator extends WindowLoggingRdfStream implements Runnable { protected final Logger logger = LoggerFactory.getLogger(TestStreamGenerator.class); diff --git a/src/main/java/lu/jpt/csparqltest/rentacar/Car.java b/src/main/java/lu/jpt/csparqltest/rentacar/Car.java index d8c79be..bcbb4c2 100644 --- a/src/main/java/lu/jpt/csparqltest/rentacar/Car.java +++ b/src/main/java/lu/jpt/csparqltest/rentacar/Car.java @@ -9,6 +9,11 @@ import org.slf4j.LoggerFactory; import eu.larkc.csparql.cep.api.RdfQuadruple; import lu.jpt.csparqltest.util.RandomHelper; +/** + * This class is all about simulating aspects of different cars. + * Nothing too special and unfortunately, it got a little out of hand. + * View at your own risk. + */ public class Car { public static Logger logger = LoggerFactory.getLogger(Car.class); diff --git a/src/main/java/lu/jpt/csparqltest/rentacar/CarPool.java b/src/main/java/lu/jpt/csparqltest/rentacar/CarPool.java index 6359352..78612aa 100644 --- a/src/main/java/lu/jpt/csparqltest/rentacar/CarPool.java +++ b/src/main/java/lu/jpt/csparqltest/rentacar/CarPool.java @@ -4,6 +4,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; +/** + * The simulation contains a pool of cars from which the drivers + * can pick a vehicle to (ab)use. + */ public class CarPool { private List cars; diff --git a/src/main/java/lu/jpt/csparqltest/rentacar/Driver.java b/src/main/java/lu/jpt/csparqltest/rentacar/Driver.java index e81bde2..b74ebc1 100644 --- a/src/main/java/lu/jpt/csparqltest/rentacar/Driver.java +++ b/src/main/java/lu/jpt/csparqltest/rentacar/Driver.java @@ -9,6 +9,12 @@ import org.slf4j.LoggerFactory; import eu.larkc.csparql.cep.api.RdfQuadruple; import lu.jpt.csparqltest.util.RandomHelper; +/** + * Since simulating cars is boring without simulating persons that drive these cars, + * this class is all about simulating a driver. A driver is basically an entity that + * makes use of the car, resulting in triggering actions on the car. + * This part is not that beautiful, either. View at own risk! + */ public class Driver { public static Logger logger = LoggerFactory.getLogger(Driver.class); diff --git a/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java b/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java index 4fa59ce..a938115 100644 --- a/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java +++ b/src/main/java/lu/jpt/csparqltest/rentacar/RentACarSimulation.java @@ -10,6 +10,14 @@ import eu.larkc.csparql.cep.api.RdfQuadruple; import eu.larkc.csparql.cep.api.RdfStream; import lu.jpt.csparqltest.util.WindowLoggingRdfStream; +/** + * This is the main simulation part of the project. + * It is being run within a separate thread, continously feeding its + * data into the rdf event streams which are registered with the engine. + * + * The simulation itself is not that sophisticated and based on a lot of + * random numbers. + */ public class RentACarSimulation implements Runnable { public static Logger logger = LoggerFactory.getLogger(RentACarSimulation.class); diff --git a/src/main/java/lu/jpt/csparqltest/util/RandomHelper.java b/src/main/java/lu/jpt/csparqltest/util/RandomHelper.java index cb8a11f..a74ea2b 100644 --- a/src/main/java/lu/jpt/csparqltest/util/RandomHelper.java +++ b/src/main/java/lu/jpt/csparqltest/util/RandomHelper.java @@ -2,6 +2,11 @@ package lu.jpt.csparqltest.util; import java.util.Random; +/** + * Since the simulation needs a lot of random numbers and keeps asking + * about whether something by a given chance happens, this class provides + * helper methods for this. + */ public class RandomHelper { private static Random myRandom = new Random(); diff --git a/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java b/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java index e0008a5..5bbbb45 100644 --- a/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java +++ b/src/main/java/lu/jpt/csparqltest/util/WindowLoggingRdfStream.java @@ -3,6 +3,10 @@ package lu.jpt.csparqltest.util; import eu.larkc.csparql.cep.api.RdfQuadruple; import lu.jpt.csparqltest.gui.TextObserverWindow; +/** + * Using this class, RdfStreams can automatically be made visible + * within the TextObserverWindow. + */ public class WindowLoggingRdfStream extends LoggableRdfStream { private TextObserverWindow observerWindow;