Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
074ce266
Commit
074ce266
authored
Apr 19, 2021
by
Poulet Camille
Browse files
Change season to migrate in offshore basin
parent
d123799b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/species/MigrateToOffshore.java
View file @
074ce266
...
...
@@ -5,6 +5,8 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
import
environment.Basin
;
import
environment.InshoreBasin
;
import
environment.OffshoreBasin
;
import
environment.OffshoreBasin.OffshoreBasinFunction
;
import
environment.RiverBasin
;
import
environment.Time.Season
;
import
fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess
;
...
...
@@ -17,7 +19,8 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider
(
service
=
AquaNismsGroupProcess
.
class
)
public
class
MigrateToOffshore
extends
AquaNismsGroupProcess
<
DiadromousFish
,
DiadromousFishGroup
>
{
private
Season
migrationSeasonToReachSummeringOffshore
=
Season
.
SPRING
;
private
Season
migrationSeasonToReachOffshore
=
Season
.
AUTOMN
;
private
OffshoreBasinFunction
offshoreDestination
=
OffshoreBasinFunction
.
WINTERING
;
public
static
void
main
(
String
[]
args
)
{
...
...
@@ -31,7 +34,7 @@ public class MigrateToOffshore extends AquaNismsGroupProcess<DiadromousFish, Dia
Basin
destination
=
null
;
if
(
group
.
getEnvironment
().
getTime
().
getSeason
(
group
.
getPilot
())
==
migrationSeasonToReach
Summering
Offshore
){
if
(
group
.
getEnvironment
().
getTime
().
getSeason
(
group
.
getPilot
())
==
migrationSeasonToReachOffshore
){
for
(
InshoreBasin
inshoreBasin
:
group
.
getEnvironment
().
getInshoreBasins
()){
...
...
@@ -42,8 +45,10 @@ public class MigrateToOffshore extends AquaNismsGroupProcess<DiadromousFish, Dia
while
(
fishIterator
.
hasNext
())
{
DiadromousFish
fish
=
fishIterator
.
next
();
destination
=
((
RiverBasin
)
fish
.
getMemorisedBasin
()).
getConnectedSummeringOffshoreBasin
();
if
(
offshoreDestination
==
OffshoreBasinFunction
.
WINTERING
)
destination
=
((
RiverBasin
)
fish
.
getMemorisedBasin
()).
getConnectedWinteringOffshoreBasin
();
else
if
(
offshoreDestination
==
OffshoreBasinFunction
.
SUMMERING
)
destination
=
((
RiverBasin
)
fish
.
getMemorisedBasin
()).
getConnectedSummeringOffshoreBasin
();
// add fish with its new position to destination basin
fish
.
setPosition
(
destination
);
...
...
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