Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Conversion
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vladislav Kiselev
Conversion
Commits
6d484cf5
Commit
6d484cf5
authored
Jun 20, 2019
by
Vladislav Kiselev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправлена ошибка с направлением грузопотока при погрузке бункеровщика.
parent
f75c0cc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
13 deletions
+26
-13
src/inport/TaskCase.java
src/inport/TaskCase.java
+26
-13
No files found.
src/inport/TaskCase.java
View file @
6d484cf5
...
...
@@ -13,6 +13,7 @@ import java.io.IOException;
import
java.io.InputStreamReader
;
import
java.util.*
;
import
java.util.function.BiFunction
;
import
java.util.function.Consumer
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
...
...
@@ -617,38 +618,47 @@ public class TaskCase {
mt
.
setId
(
Integer
.
parseInt
(
tokens
[
0
].
trim
()));
mt
.
setTimeWindow
(
tokens
[
2
].
trim
());
int
direction
=
1
;
BiFunction
<
Integer
,
Integer
,
Integer
>
addLoaderOrStorage
=
(
Integer
key
,
Integer
loaderDirection
)
->
{
BiFunction
<
Integer
,
Integer
,
Integer
>
extractDirection
=
(
Integer
key
,
Integer
loaderDirection
)
->
{
int
dir
=
1
;
if
((
vesselTypes
.
containsKey
(
key
))
||
(
m_vessel
.
containsKey
(
key
)))
{
dir
=
loaderDirection
;
}
else
if
(
m_storage
.
containsKey
(
key
))
{
dir
=
-
loaderDirection
;
}
else
if
((
m_bunker
.
containsKey
(
key
))
||
(
bunkerTypes
.
containsKey
(
key
)))
{
if
(
mt
.
getStorage
()
!=
null
)
{
dir
=
loaderDirection
;
}
else
{
dir
=
-
loaderDirection
;
}
}
return
dir
;
};
Consumer
<
Integer
>
addLoaderOrStorage
=
(
Integer
key
)
->
{
if
(
vesselTypes
.
containsKey
(
key
))
{
mt
.
setLoaderType
(
OptionalInt
.
of
(
key
));
dir
=
loaderDirection
;
}
else
if
(
m_vessel
.
containsKey
(
key
))
{
mt
.
setLoader
((
TransportShip
)
m_vessel
.
get
(
key
));
dir
=
loaderDirection
;
}
else
if
(
m_storage
.
containsKey
(
key
))
{
mt
.
setStorage
(
m_storage
.
get
(
key
));
dir
=
-
loaderDirection
;
}
else
if
(
m_bunker
.
containsKey
(
key
))
{
mt
.
setBunker
(
Optional
.
of
(
m_bunker
.
get
(
key
)));
dir
=
-
loaderDirection
;
}
else
if
(
bunkerTypes
.
containsKey
(
key
))
{
}
else
if
(
bunkerTypes
.
containsKey
(
key
))
{
mt
.
setBunkerType
(
OptionalInt
.
of
(
key
));
dir
=
-
loaderDirection
;
}
return
dir
;
};
int
key
;
// Источник.
key
=
Integer
.
parseInt
(
tokens
[
3
].
trim
());
direction
=
addLoaderOrStorage
.
apply
(
key
,
-
1
);
addLoaderOrStorage
.
accept
(
key
);
// Груз.
key
=
Integer
.
parseInt
(
tokens
[
4
].
trim
());;
for
(
Cargo
cargo
:
cargoes
)
{
...
...
@@ -658,7 +668,10 @@ public class TaskCase {
}
// Приемник.
key
=
Integer
.
parseInt
(
tokens
[
5
].
trim
());
direction
=
addLoaderOrStorage
.
apply
(
key
,
1
);
addLoaderOrStorage
.
accept
(
key
);
int
direction
=
extractDirection
.
apply
(
key
,
1
);
key
=
Integer
.
parseInt
(
tokens
[
6
].
trim
());
mt
.
setStartLocation
(
m_berth
.
get
(
key
));
String
[]
rs
=
tokens
[
7
].
trim
().
replace
(
"["
,
""
).
replace
(
"]"
,
""
).
split
(
","
);
...
...
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