Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Projet GORDYJAN_BAGNOLY_GARCIA_POIGNONNEC
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POIGNONNEC
Projet GORDYJAN_BAGNOLY_GARCIA_POIGNONNEC
Commits
98cf7f2e
Commit
98cf7f2e
authored
May 16, 2019
by
Gaetan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gvipers.imt-lille-douai.fr/arthur.poignonnec/geometry
parents
98b859b5
f40c3037
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
192 additions
and
3 deletions
+192
-3
geometry.iml
.idea/geometry.iml
+10
-0
misc.xml
.idea/misc.xml
+1
-1
Task.java
garage/src/garage/Task.java
+19
-0
TestBench.java
garage/src/garage/TestBench.java
+59
-0
Vehicle.java
garage/src/vehicle/Vehicle.java
+21
-0
VehicleModel.java
garage/src/vehicle/VehicleModel.java
+2
-1
Frame.java
garage/src/vehicle/part/frame/Frame.java
+3
-0
HotSeat.java
garage/src/vehicle/part/option/HotSeat.java
+0
-1
TestBenchTest.java
garage/test/TestBenchTest.java
+77
-0
No files found.
.idea/geometry.iml
View file @
98cf7f2e
...
@@ -8,5 +8,15 @@
...
@@ -8,5 +8,15 @@
</content>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"module-library"
scope=
"TEST"
>
<library
name=
"JUnit4"
>
<CLASSES>
<root
url=
"jar://$USER_HOME$/.m2/repository/junit/junit/4.12/junit-4.12.jar!/"
/>
<root
url=
"jar://$USER_HOME$/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/"
/>
</CLASSES>
<JAVADOC
/>
<SOURCES
/>
</library>
</orderEntry>
</component>
</component>
</module>
</module>
\ No newline at end of file
.idea/misc.xml
View file @
98cf7f2e
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_11"
project-jdk-name=
"1
2
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_11"
project-jdk-name=
"1
1
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/classes"
/>
<output
url=
"file://$PROJECT_DIR$/classes"
/>
</component>
</component>
</project>
</project>
\ No newline at end of file
garage/src/garage/Task.java
0 → 100644
View file @
98cf7f2e
package
garage
;
import
java.lang.reflect.Method
;
import
java.util.List
;
public
class
Task
{
private
Class
clazz
;
private
Method
method
;
private
List
<
Object
>
args
;
private
Integer
t
;
public
Task
(
Class
clazz
,
Method
method
,
List
<
Object
>
args
,
Integer
t
)
{
this
.
clazz
=
clazz
;
this
.
method
=
method
;
this
.
args
=
args
;
this
.
t
=
t
;
}
}
garage/src/garage/TestBench.java
View file @
98cf7f2e
package
garage
;
package
garage
;
import
vehicle.Vehicle
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
TestBench
{
public
class
TestBench
{
private
Vehicle
vehicle
;
private
List
<
Task
>
tasks
;
private
Double
distance
;
public
TestBench
()
{
tasks
=
new
ArrayList
<>();
vehicle
=
null
;
}
public
void
addVehicle
(
Vehicle
vehicle
){
if
(
this
.
vehicle
==
null
){
this
.
vehicle
=
vehicle
;
}
else
{
System
.
out
.
println
(
"A car is already on the testbench"
);
}
}
public
void
removeVehicle
(){
if
(
this
.
vehicle
!=
null
){
this
.
vehicle
=
null
;
}
else
{
System
.
out
.
println
(
"No vehicle in the test bench."
);
}
}
public
Vehicle
swapVehicle
(
Vehicle
vehicule
){
if
(
this
.
vehicle
!=
null
){
Vehicle
temp
=
this
.
vehicle
;
this
.
vehicle
=
vehicule
;
return
temp
;
}
else
{
System
.
out
.
println
(
"No vehicle in the test bench."
);
return
null
;
}
}
public
void
addTask
(
Task
task
){
tasks
.
add
(
task
);
}
public
void
removeTask
(
Task
task
){
tasks
.
remove
(
task
);
}
public
Vehicle
getVehicle
(){
return
this
.
vehicle
;
}
public
List
<
Task
>
getTasks
(){
return
tasks
;
}
}
}
garage/src/vehicle/Vehicle.java
View file @
98cf7f2e
...
@@ -11,6 +11,7 @@ import vehicle.part.pedal.PedalAccelerator;
...
@@ -11,6 +11,7 @@ import vehicle.part.pedal.PedalAccelerator;
import
vehicle.part.pedal.PedalBrake
;
import
vehicle.part.pedal.PedalBrake
;
import
vehicle.part.pedal.PedalClutch
;
import
vehicle.part.pedal.PedalClutch
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
public
class
Vehicle
{
public
class
Vehicle
{
...
@@ -49,11 +50,13 @@ public class Vehicle {
...
@@ -49,11 +50,13 @@ public class Vehicle {
}
}
// CREATING BRAKES
// CREATING BRAKES
brakes
=
new
ArrayList
<>();
for
(
Integer
i
=
0
;
i
<
model
.
getNbOfWheels
();
i
++
){
for
(
Integer
i
=
0
;
i
<
model
.
getNbOfWheels
();
i
++
){
brakes
.
add
(
new
Brake
(
model
.
getBrakesType
()));
brakes
.
add
(
new
Brake
(
model
.
getBrakesType
()));
}
}
// CREATING PEDALS
// CREATING PEDALS
pedals
=
new
ArrayList
<>();
pedals
.
add
(
new
PedalAccelerator
(
engine
));
pedals
.
add
(
new
PedalAccelerator
(
engine
));
pedals
.
add
(
new
PedalBrake
(
brakes
));
pedals
.
add
(
new
PedalBrake
(
brakes
));
if
(
"MANUAL"
.
equals
(
model
.
getEngineModel
().
getGearBoxType
()))
{
if
(
"MANUAL"
.
equals
(
model
.
getEngineModel
().
getGearBoxType
()))
{
...
@@ -63,6 +66,10 @@ public class Vehicle {
...
@@ -63,6 +66,10 @@ public class Vehicle {
// METHODS /////////////////////////////////////////////////////////////////////////////////////////////////////////
// METHODS /////////////////////////////////////////////////////////////////////////////////////////////////////////
public
void
update
(){
}
// Print the name of the car with the options and the price.
// Print the name of the car with the options and the price.
// public String toString()
// public String toString()
// return "\t" + this.brandName + "is a " + name + " with that options : + " ?? " + ". Price : " + price.
// return "\t" + this.brandName + "is a " + name + " with that options : + " ?? " + ". Price : " + price.
...
@@ -89,6 +96,20 @@ public class Vehicle {
...
@@ -89,6 +96,20 @@ public class Vehicle {
return
frame
.
getWeight
();
return
frame
.
getWeight
();
}
}
// DISPLAY /////////////////////////////////////////////////////////////////////////////////////////////////////////
public
void
displayVehicleInformation
(){
// Clear screen
System
.
out
.
print
(
"\033[H\033[2J"
);
System
.
out
.
flush
();
System
.
out
.
println
(
"|------------------------------------------------------------------|"
);
System
.
out
.
println
(
"| VEHICULE INFORMATION |"
);
System
.
out
.
println
(
"|------------------------------------------------------------------|"
);
System
.
out
.
println
(
" BRAND: "
+
brand
+
" MODEL: "
+
name
+
" PRICE: "
+
price
);
System
.
out
.
println
(
"|-----------------------------------------------------------------|"
);
}
// Get the brand of the car
// Get the brand of the car
// public VehicleBrand getBrand()
// public VehicleBrand getBrand()
...
...
garage/src/vehicle/VehicleModel.java
View file @
98cf7f2e
...
@@ -6,7 +6,8 @@ import vehicle.part.frame.FrameType;
...
@@ -6,7 +6,8 @@ import vehicle.part.frame.FrameType;
public
enum
VehicleModel
{
public
enum
VehicleModel
{
FIAT500
(
VehicleBrand
.
FIAT
,
"500"
,
EngineModel
.
TDI_A_D
,
FrameType
.
MICRO
,
BrakeType
.
PAD_FX200
,
4
);
FIAT_500
(
VehicleBrand
.
FIAT
,
"500"
,
EngineModel
.
TDI_A_D
,
FrameType
.
MICRO
,
BrakeType
.
PAD_FX200
,
4
),
PEUGEOT_5008
(
VehicleBrand
.
PEUGEOT
,
"5008"
,
EngineModel
.
TDI_A_P
,
FrameType
.
SUV
,
BrakeType
.
DISC_FX200
,
4
);
private
final
VehicleBrand
brand
;
private
final
VehicleBrand
brand
;
private
final
String
name
;
private
final
String
name
;
...
...
garage/src/vehicle/part/frame/Frame.java
View file @
98cf7f2e
...
@@ -2,6 +2,7 @@ package vehicle.part.frame;
...
@@ -2,6 +2,7 @@ package vehicle.part.frame;
import
vehicle.part.door.Door
;
import
vehicle.part.door.Door
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
public
class
Frame
{
public
class
Frame
{
...
@@ -18,6 +19,8 @@ public class Frame {
...
@@ -18,6 +19,8 @@ public class Frame {
length
=
type
.
getLength
();
length
=
type
.
getLength
();
width
=
type
.
getWidth
();
width
=
type
.
getWidth
();
height
=
type
.
getHeight
();
height
=
type
.
getHeight
();
doors
=
new
ArrayList
<>();
for
(
Integer
i
=
0
;
i
<
type
.
getNbOfDoors
();
i
++)
doors
.
add
(
new
Door
());
for
(
Integer
i
=
0
;
i
<
type
.
getNbOfDoors
();
i
++)
doors
.
add
(
new
Door
());
}
}
...
...
garage/src/vehicle/part/option/HotSeat.java
View file @
98cf7f2e
...
@@ -9,5 +9,4 @@ public class HotSeat implements Option {
...
@@ -9,5 +9,4 @@ public class HotSeat implements Option {
public
String
toString
()
{
public
String
toString
()
{
return
"Hot seat ("
+
this
.
getPrice
()
+
" €)"
;
return
"Hot seat ("
+
this
.
getPrice
()
+
" €)"
;
}
}
}
}
}
garage/test/TestBenchTest.java
0 → 100644
View file @
98cf7f2e
import
garage.Task
;
import
garage.TestBench
;
import
org.junit.Before
;
import
org.junit.Test
;
import
vehicle.Vehicle
;
import
vehicle.VehicleModel
;
import
vehicle.part.pedal.PedalAccelerator
;
import
static
junit
.
framework
.
TestCase
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
public
class
TestBenchTest
{
private
TestBench
testBench
;
private
Vehicle
fiat500
;
private
Vehicle
peugeot5008
;
@Before
public
void
setUp
(){
testBench
=
new
TestBench
();
fiat500
=
new
Vehicle
(
VehicleModel
.
FIAT_500
);
peugeot5008
=
new
Vehicle
(
VehicleModel
.
PEUGEOT_5008
);
}
@Test
public
void
addVehicleTest
(){
assertNull
(
testBench
.
getVehicle
());
testBench
.
addVehicle
(
fiat500
);
assertEquals
(
fiat500
,
testBench
.
getVehicle
());
}
@Test
public
void
addVehicleImpossibleTest
(){
assertNull
(
testBench
.
getVehicle
());
testBench
.
addVehicle
(
fiat500
);
testBench
.
addVehicle
(
peugeot5008
);
assertEquals
(
fiat500
,
testBench
.
getVehicle
());
}
@Test
public
void
removeVehicleTest
(){
testBench
.
addVehicle
(
fiat500
);
assertEquals
(
fiat500
,
testBench
.
getVehicle
());
testBench
.
removeVehicle
();
assertNull
(
testBench
.
getVehicle
());
}
@Test
public
void
removeVehicleImpossibleTest
(){
testBench
.
removeVehicle
();
assertNull
(
testBench
.
getVehicle
());
}
@Test
public
void
swapVehicleTest
(){
testBench
.
addVehicle
(
fiat500
);
assertEquals
(
fiat500
,
testBench
.
getVehicle
());
Vehicle
swapped
=
testBench
.
swapVehicle
(
peugeot5008
);
assertEquals
(
fiat500
,
swapped
);
assertEquals
(
peugeot5008
,
testBench
.
getVehicle
());
}
@Test
public
void
swapVehicleImpossibleTest
(){
Vehicle
swapped
=
testBench
.
swapVehicle
(
peugeot5008
);
assertNull
(
swapped
);
assertNull
(
testBench
.
getVehicle
());
}
@Test
public
void
addTaskTest
(){
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment