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
10add7b3
Commit
10add7b3
authored
Dec 03, 2018
by
Vladislav Kiselev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Обновлён формат тестов, исправлено пару багов.
parent
62bd0d72
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
237 deletions
+103
-237
src/inport/CargoFlow.java
src/inport/CargoFlow.java
+7
-10
src/inport/ConversionUtil.java
src/inport/ConversionUtil.java
+2
-2
src/inport/LoadingTemplate.java
src/inport/LoadingTemplate.java
+18
-1
src/inport/TaskCase.java
src/inport/TaskCase.java
+74
-222
tests/cargo_handling_and_moving.ipp
tests/cargo_handling_and_moving.ipp
+1
-1
tests/simple_cargo_flow.ipp
tests/simple_cargo_flow.ipp
+1
-1
No files found.
src/inport/CargoFlow.java
View file @
10add7b3
...
...
@@ -4,10 +4,7 @@
*/
package
inport
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
java.util.*
;
/**
*
...
...
@@ -17,14 +14,14 @@ public class CargoFlow {
private
Storage
storage
;
private
Cargo
cargo
;
Map
<
Double
,
Double
>
flow
;
Sorted
Map
<
Double
,
Double
>
flow
;
public
Map
<
Double
,
Double
>
getFlow
()
{
return
flow
;
}
public
void
setFlow
(
Map
<
Double
,
Double
>
flow
)
{
this
.
flow
=
flow
;
this
.
flow
=
new
TreeMap
<>(
flow
)
;
}
/**
...
...
@@ -54,7 +51,7 @@ public class CargoFlow {
}
public
CargoFlow
()
{
this
.
flow
=
new
Hash
Map
<>();
this
.
flow
=
new
Tree
Map
<>();
}
public
CargoFlow
(
Storage
storage
,
Cargo
cargo
)
{
...
...
@@ -71,7 +68,7 @@ public class CargoFlow {
double
prevKey
=
-
1.0
;
for
(
Double
keyTime
:
keyTimes
)
{
if
(
forTime
>=
prevKey
&&
forTime
<
keyTime
)
if
(
forTime
>=
prevKey
&&
forTime
<
keyTime
)
{
res
=
flow
.
get
(
prevKey
);
isFound
=
true
;
...
...
@@ -92,7 +89,7 @@ public class CargoFlow {
double
prevKey
=
-
1.0
;
for
(
Double
keyTime
:
keyTimes
)
{
if
(
forTime
>
prevKey
&&
forTime
<
keyTime
)
if
(
forTime
>=
prevKey
&&
forTime
<
keyTime
)
{
res
+=
flow
.
get
(
prevKey
)*(
forTime
-
prevKey
);
isFound
=
true
;
...
...
@@ -103,7 +100,7 @@ public class CargoFlow {
prevKey
=
keyTime
;
}
}
if
(!
isFound
&&
forTime
>
prevKey
)
if
(!
isFound
&&
forTime
>=
prevKey
)
res
+=
flow
.
get
(
prevKey
)*(
forTime
-
prevKey
);
return
res
;
}
...
...
src/inport/ConversionUtil.java
View file @
10add7b3
...
...
@@ -478,7 +478,7 @@ public class ConversionUtil {
// TODO ресурсы у операции погрузки.
operationsResources
.
set
(
i
,
s
);
operationsStartLoc
.
set
(
i
,
getLocNById
.
apply
(
op
.
getStartLocation
().
getId
(),
true
)
+
1
);
operationsStartLoc
.
set
(
i
,
getLocNById
.
apply
(
op
.
getStartLocation
().
getId
(),
op
.
getWithMooring
()
)
+
1
);
}
// TODO швартовка, погрузка.
}
...
...
@@ -616,7 +616,7 @@ public class ConversionUtil {
LoadingTemplate
op
=
(
LoadingTemplate
)
operationTemplates
.
get
(
i
);
int
storageN
=
storNById
.
get
(
op
.
getStorage
().
getId
());
int
shipN
=
mObjToN
.
apply
(
op
.
getLoader
());
int
cargoN
=
cargoNById
.
get
(
op
.
get
Storage
().
getCargo
().
getId
());
// TODO в TaskCase пока не реализовано, пересмотреть.
int
cargoN
=
cargoNById
.
get
(
op
.
get
Cargo
().
getId
());
loadingOpDelta
.
add
(-(
int
)
op
.
getIntensity
());
loadingOpN
.
add
(
i
);
...
...
src/inport/LoadingTemplate.java
View file @
10add7b3
...
...
@@ -17,7 +17,8 @@ public class LoadingTemplate extends OperationTemplate {
private
Storage
storage
;
private
List
<
LoadingEquipment
>
resources
;
private
double
intensity
;
private
boolean
withMooring
;
private
Cargo
cargo
;
/**
* Get the value of resources
...
...
@@ -61,6 +62,22 @@ public class LoadingTemplate extends OperationTemplate {
this
.
storage
=
storage
;
}
public
void
setWithMooring
(
boolean
withMooring
)
{
this
.
withMooring
=
withMooring
;
}
public
boolean
getWithMooring
()
{
return
withMooring
;
}
public
void
setCargo
(
Cargo
cargo
)
{
this
.
cargo
=
cargo
;
}
public
Cargo
getCargo
()
{
return
cargo
;
}
public
LoadingTemplate
(
TransportShip
loader
,
Berth
berth
,
Storage
storage
,
double
intensity
,
int
id
)
{
super
(
id
,
berth
);
this
.
loader
=
loader
;
...
...
src/inport/TaskCase.java
View file @
10add7b3
This diff is collapsed.
Click to expand it.
tests/cargo_handling_and_moving.ipp
View file @
10add7b3
...
...
@@ -31,7 +31,7 @@ Templates
201; mrn; []; 11; 5; []; 1
202; unm; []; 11; 5; []; 1
301; loa; []; 1001; 0; 11; 5; []; 2
301; loa; []; 1001; 0; 11; 5; []; 2
; M
Cargo Flows
Initial Vessel State
...
...
tests/simple_cargo_flow.ipp
View file @
10add7b3
...
...
@@ -16,7 +16,7 @@ Templates
103; mov; []; 11; 1; 2;[]; 1
201; mrn; []; 11; 2; []; 1
202; unm; []; 11; 2; []; 1
301; loa; []; 1001; 0; 11; 2; []; 1
301; loa; []; 1001; 0; 11; 2; []; 1
; M
Cargo Flows
1001; 0; [0:0, 5:1, 8:0]
...
...
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