Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
7ee38247
Commit
7ee38247
authored
Oct 04, 2016
by
Jakob Schöttl
Browse files
Change visibility and add tests
parent
4bd6bd5d
Changes
2
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/models/seating/SeatingModel.java
View file @
7ee38247
...
...
@@ -135,11 +135,11 @@ public class SeatingModel implements ActiveCallback, Model {
}
}
private
boolean
isInnerCompartment
(
final
int
compartmentIndex
)
{
boolean
isInnerCompartment
(
final
int
compartmentIndex
)
{
return
compartmentIndex
>
0
&&
compartmentIndex
<
trainModel
.
getCompartmentCount
()
-
1
;
}
private
int
getDirectionFromEntranceAreaToCompartment
(
int
entranceAreaIndex
,
int
compartmentIndex
)
{
int
getDirectionFromEntranceAreaToCompartment
(
int
entranceAreaIndex
,
int
compartmentIndex
)
{
// entrance areas: 0 1 2 3
// compartments: 0 1 2 3 4
if
(
compartmentIndex
<=
entranceAreaIndex
)
...
...
VadereSimulator/tests/org/vadere/simulator/models/seating/TestSeatingModel.java
View file @
7ee38247
package
org.vadere.simulator.models.seating
;
import
static
org
.
junit
.
Assert
.*;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Random
;
...
...
@@ -18,6 +20,7 @@ public class TestSeatingModel {
private
Topography
topography
;
private
List
<
Attributes
>
attributes
;
private
AttributesAgent
attributesPedestrian
;
private
SeatingModel
seatingModel
;
@Before
public
void
setUp
()
{
...
...
@@ -26,6 +29,8 @@ public class TestSeatingModel {
attributes
=
new
ArrayList
<>();
attributes
.
add
(
new
AttributesSeating
());
attributesPedestrian
=
new
AttributesAgent
();
seatingModel
=
new
SeatingModel
();
seatingModel
.
initialize
(
attributes
,
topography
,
attributesPedestrian
,
random
);
}
@Test
(
expected
=
IllegalStateException
.
class
)
...
...
@@ -38,4 +43,29 @@ public class TestSeatingModel {
new
SeatingModel
().
initialize
(
new
ArrayList
<>(
0
),
topography
,
attributesPedestrian
,
random
);
}
@Test
public
void
testIsInnerCompartment
()
{
assertFalse
(
seatingModel
.
isInnerCompartment
(
0
));
assertTrue
(
seatingModel
.
isInnerCompartment
(
1
));
assertTrue
(
seatingModel
.
isInnerCompartment
(
TestTopographyAndModelBuilder
.
nCompartments
-
2
));
assertFalse
(
seatingModel
.
isInnerCompartment
(
TestTopographyAndModelBuilder
.
nCompartments
-
1
));
}
@Test
public
void
testGetDirectionFromEntranceAreaToCompartment
()
{
// entrance areas: 0 1 2 3
// compartments: 0 1 2 3 4
assertEquals
(-
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
0
,
0
));
assertEquals
(-
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
1
,
0
));
assertEquals
(-
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
2
,
0
));
assertEquals
(-
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
2
,
1
));
assertEquals
(-
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
2
,
2
));
assertEquals
(
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
0
,
1
));
assertEquals
(
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
1
,
2
));
assertEquals
(
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
1
,
3
));
assertEquals
(
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
1
,
4
));
assertEquals
(
1
,
seatingModel
.
getDirectionFromEntranceAreaToCompartment
(
3
,
4
));
}
}
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