Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.6 feladat #329

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ To compile and run tests also execute:
```
./gradlew test
```
## | Tables | Are | Cool |
## | ------------- |:-------------:| -----:|
## | col 3 is | right-aligned | $1600 |
## | col 2 is | centered | $12 |
## | zebra stripes | are neat | $1 |

## [I'm an inline-style link](https://www.google.com)

## Overview

Expand All @@ -50,7 +57,8 @@ The application represents a simple train controller system with the following t

Setting the reference speed of the train works in the following way.
* The user can set the position of a joystick, which can be zero or a positive/negative number.
* In each time unit, the controller adds the position of the joystick to the current reference speed. Therefore the reference speed does not change if the position is zero, it is incremented if the position is positive and it is decremented if the position is negative.
* In each time unit, the controller adds the position of the joystick to the current reference speed.
Therefore the reference speed does not change if the position is zero, it is incremented if the position is positive and it is decremented if the position is negative.
* After each change, the speed limit is checked and enforced.

The figure below illustrates this behavior using an example.
Expand Down
77 changes: 77 additions & 0 deletions exit
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
commit deb65e016adf8a2e6fdfee788c47b1c594f96a88 (HEAD -> 4.6-Feladat, origin/4.6-Feladat)
Author: ZambellyMarton <[email protected]>
Date: Mon Jun 5 16:28:10 2023 +0200

4.6-Feladat implementálva

commit 1a8f2ffd5d9f66e6ae713f8cfc0c12672c8c28f1 (origin/master, origin/HEAD, master)
Author: zambelly <[email protected]>
Date: Sun Jun 4 21:09:02 2023 +0200

Markdown feldatok

commit dda7f232ea91d15e2a9e8cc78fb73d7926169b3c
Author: Richárd Szabó <[email protected]>
Date: Tue Mar 14 18:47:07 2023 +0100

Updated README for 2023

commit 7c1872428c80ac7b6ec8cb46bfc2148cd74646c1
Author: Szabó Richárd <[email protected]>
Date: Tue Feb 28 18:49:10 2023 +0100

Added maven files

commit b74044cf56d108795afb21bdca966be368c629e2
Author: Zoltan Szatmari <[email protected]>
Date: Sun Feb 20 22:22:08 2022 +0100

Updated for GitHub workflows

commit 2badaac5f79271a41ac6c0925f72a9924db6bfff
Author: Gabor Szarnyas <[email protected]>
Date: Mon Mar 2 20:13:05 2020 +0100

Bump Gradle version to 6.2.1

commit b9c01be97b0fb134de01f7ef3f71e6568428b3f3
Author: Zoltan Micskei <[email protected]>
Date: Thu Jan 31 00:33:44 2019 +0100

Update README with Getting started

commit 3d43ac417d53acc0413f04604363f1ab4a29f8c9
Author: Gabor Szarnyas <[email protected]>
Date: Mon Mar 13 08:39:14 2017 +0100

Update README

commit a4d46b60c7a4880e0cd20a8150d8615dc93f8936
Author: Dávid Honfi <[email protected]>
Date: Sun Mar 12 21:24:10 2017 +0100

Added mockito to Gradle build

commit 26b5c78451b1a7f5eb76c92d08710ab3269d0532
Author: Hajdu Ákos <[email protected]>
Date: Thu Mar 9 12:11:14 2017 +0100

Extended readme

commit 0174157d9a581fbd466736ece14668e434dd14b3
Author: Dávid Honfi <[email protected]>
Date: Wed Mar 8 22:24:36 2017 +0100

Changes for testing lab

commit 77f7fa5fe69591ac7eea4c2b8a7a377e6bc357ec
Author: Gabor Szarnyas <[email protected]>
Date: Mon Mar 6 15:36:27 2017 +0100

Add .idea directory to gitignore

commit 9b5d53c38d3032968a714d910f86fae5b55f10f2
Author: Gabor Szarnyas <[email protected]>
Date: Mon Feb 27 13:58:39 2017 +0100

Initial commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hu/bme/mit/train/controller/TrainControllerImpl.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/cloud/base/train-controller/src/main/java/hu/bme/mit/train/controller/TrainControllerImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hu/bme/mit/train/interfaces/TrainController.class
hu/bme/mit/train/interfaces/TrainSensor.class
hu/bme/mit/train/interfaces/TrainUser.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/home/cloud/base/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainUser.java
/home/cloud/base/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainController.java
/home/cloud/base/train-interfaces/src/main/java/hu/bme/mit/train/interfaces/TrainSensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ public class TrainSensorImpl implements TrainSensor {
private TrainController controller;
private TrainUser user;
private int speedLimit = 5;
private boolean IsBrakeOn = false;
private int CurrentSpeed = 100;


public TrainSensorImpl(TrainController controller, TrainUser user) {
this.controller = controller;
this.user = user;
}

public int EmergencyBrake(boolean IsBrakeOn,int CurrentSpeed, int speedLimit){
if (CurrentSpeed > speedLimit )
{IsBrakeOn = true;}
return 0;}


@Override
public int getSpeedLimit() {
return speedLimit;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hu/bme/mit/train/sensor/TrainSensorImpl.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/cloud/base/train-sensor/src/main/java/hu/bme/mit/train/sensor/TrainSensorImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hu/bme/mit/train/sensor/TrainSensorTest.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/cloud/base/train-sensor/src/test/java/hu/bme/mit/train/sensor/TrainSensorTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="1" failures="0" name="hu.bme.mit.train.sensor.TrainSensorTest" time="0.007" errors="0" skipped="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="11.0.18+10-post-Ubuntu-0ubuntu118.04.1"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/>
<property name="maven.multiModuleProjectDirectory" value="/home/cloud/base"/>
<property name="java.vm.vendor" value="Ubuntu"/>
<property name="java.vendor.url" value="https://ubuntu.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="path.separator" value=":"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="/home/cloud/base"/>
<property name="java.vm.compressedOopsMode" value="32-bit"/>
<property name="java.runtime.version" value="11.0.18+10-post-Ubuntu-0ubuntu118.04.1"/>
<property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="line.separator" value="
"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="os.name" value="Linux"/>
<property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/>
<property name="maven.conf" value="/usr/share/maven/conf"/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="55.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="4.15.0-206-generic"/>
<property name="library.jansi.path" value="/usr/share/maven/lib/jansi-native"/>
<property name="user.home" value="/home/cloud"/>
<property name="user.timezone" value="Europe/Budapest"/>
<property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.specification.version" value="11"/>
<property name="user.name" value="cloud"/>
<property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.x.jar"/>
<property name="java.vm.specification.version" value="11"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher test"/>
<property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="java.vm.info" value="mixed mode, sharing"/>
<property name="java.version" value="11.0.18"/>
<property name="securerandom.source" value="file:/dev/./urandom"/>
<property name="java.vendor" value="Ubuntu"/>
<property name="maven.home" value="/usr/share/maven"/>
<property name="file.separator" value="/"/>
<property name="java.version.date" value="2023-01-17"/>
<property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-lts"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.cpu.isalist" value=""/>
</properties>
<testcase classname="hu.bme.mit.train.sensor.TrainSensorTest" name="ThisIsAnExampleTestStub" time="0.007"/>
</testsuite>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: hu.bme.mit.train.sensor.TrainSensorTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.067 sec
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ public class TrainSystem {
private TrainController controller = new TrainControllerImpl();
private TrainUser user = new TrainUserImpl(controller);
private TrainSensor sensor = new TrainSensorImpl(controller, user);
private boolean IsBrakeOn = false;
private int CurrentSpeed = 100;

public TrainController getController() {
return controller;
}


public TrainSensor getSensor() {
return sensor;
}
Expand All @@ -25,4 +28,12 @@ public TrainUser getUser() {
return user;
}

public int EmergencyBrake(boolean IsBrakeOn,int CurrentSpeed){
if (CurrentSpeed > 160 ){
IsBrakeOn = true;
}
return 0;
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hu/bme/mit/train/system/TrainSystem.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/cloud/base/train-system/src/main/java/hu/bme/mit/train/system/TrainSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hu/bme/mit/train/system/TrainSystemTest.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/cloud/base/train-system/src/test/java/hu/bme/mit/train/system/TrainSystemTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite tests="2" failures="0" name="hu.bme.mit.train.system.TrainSystemTest" time="0.005" errors="0" skipped="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="11.0.18+10-post-Ubuntu-0ubuntu118.04.1"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/>
<property name="maven.multiModuleProjectDirectory" value="/home/cloud/base"/>
<property name="java.vm.vendor" value="Ubuntu"/>
<property name="java.vendor.url" value="https://ubuntu.com/"/>
<property name="path.separator" value=":"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="user.dir" value="/home/cloud/base"/>
<property name="java.vm.compressedOopsMode" value="32-bit"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="java.runtime.version" value="11.0.18+10-post-Ubuntu-0ubuntu118.04.1"/>
<property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="line.separator" value="
"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="os.name" value="Linux"/>
<property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/>
<property name="maven.conf" value="/usr/share/maven/conf"/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="55.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="4.15.0-206-generic"/>
<property name="library.jansi.path" value="/usr/share/maven/lib/jansi-native"/>
<property name="user.home" value="/home/cloud"/>
<property name="user.timezone" value="Europe/Budapest"/>
<property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.specification.version" value="11"/>
<property name="user.name" value="cloud"/>
<property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds-2.x.jar"/>
<property name="java.vm.specification.version" value="11"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher test"/>
<property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="java.vm.info" value="mixed mode, sharing"/>
<property name="java.version" value="11.0.18"/>
<property name="securerandom.source" value="file:/dev/./urandom"/>
<property name="java.vendor" value="Ubuntu"/>
<property name="maven.home" value="/usr/share/maven"/>
<property name="file.separator" value="/"/>
<property name="java.version.date" value="2023-01-17"/>
<property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-lts"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.isalist" value=""/>
</properties>
<testcase classname="hu.bme.mit.train.system.TrainSystemTest" name="OverridingJoystickPositionToNegative_SetsReferenceSpeedToZero" time="0.004"/>
<testcase classname="hu.bme.mit.train.system.TrainSystemTest" name="OverridingJoystickPosition_IncreasesReferenceSpeed" time="0.001"/>
</testsuite>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: hu.bme.mit.train.system.TrainSystemTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.129 sec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hu/bme/mit/train/user/TrainUserImpl.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/cloud/base/train-user/src/main/java/hu/bme/mit/train/user/TrainUserImpl.java