Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PO²Engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PO2-Tools
PO²Engine
Commits
b1a6b681
Commit
b1a6b681
authored
1 year ago
by
Stéphane Dervaux
Browse files
Options
Downloads
Patches
Plain Diff
change. Create 1 obs by ingredient
parent
0819a8c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/inrae/po2engine/model/dataModel/CompositionFile.java
+22
-10
22 additions, 10 deletions
...a/fr/inrae/po2engine/model/dataModel/CompositionFile.java
with
22 additions
and
10 deletions
src/main/java/fr/inrae/po2engine/model/dataModel/CompositionFile.java
+
22
−
10
View file @
b1a6b681
...
...
@@ -40,10 +40,7 @@ import org.json.JSONObject;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
public
class
CompositionFile
extends
GenericFile
{
...
...
@@ -91,12 +88,27 @@ public class CompositionFile extends GenericFile{
}
if
(
p
.
getType
().
equals
(
DataPartType
.
RAW_DATA
)
||
p
.
getType
().
equals
(
DataPartType
.
CALC_DATA
))
{
if
(
p
.
getNBLine
()
>
1
)
{
// first line is for header (attri / value / object / unit/ comment )
// need to create new Observation
ObservationFile
obsFile
=
new
ObservationFile
(
stepFile
);
obsFile
.
setId
(
"Composition for "
+
this
.
getCompositionID
().
getValue
().
get
());
obsFile
.
setFoi
(
this
.
getFileName
());
TablePart
newTable
=
obsFile
.
createObsData
(
true
);
newTable
.
mapPart
(
p
);
// need to create new Observations
for
(
int
i
=
1
;
i
<
p
.
getNBLine
();
i
++)
{
// line 0 is header
// create new DataPart. Only keeping currentLine
DataPart
newPart
=
new
DataPart
(
data
);
newPart
.
setType
(
p
.
getType
());
newPart
.
setLineTable
(
p
.
getLineTable
());
newPart
.
addLine
(
new
ArrayList
<>(
p
.
getHeader
()));
// clone header
newPart
.
addLine
(
new
ArrayList
<>(
p
.
getLine
(
i
)));
// clone ingredient description
ObservationFile
obsFile
=
new
ObservationFile
(
stepFile
);
obsFile
.
setFoi
(
this
.
getFileName
());
obsFile
.
setId
(
"composition for "
+
this
.
getCompositionID
().
getValue
().
get
());
TablePart
newTable
=
obsFile
.
createObsData
(
true
);
newTable
.
mapPart
(
newPart
);
SimpleTable
st
=
((
SimpleTable
)
newTable
.
getTable
());
if
(
st
.
getSize
()
>=
0
&&
st
.
getLine
(
0
).
get
(
SimpleTable
.
ObjK
)
!=
null
)
{
String
ingr
=
st
.
getLine
(
0
).
get
(
SimpleTable
.
ObjK
).
getValue
().
get
();
obsFile
.
setId
(
"composition in "
+
ingr
+
" for "
+
this
.
getCompositionID
().
getValue
().
get
());
}
}
}
}
if
(
p
.
getType
().
equals
(
DataPartType
.
MATERIAL_USED
))
{
///////////////////////////////////////////:: on remonte ces infos sur l'étape
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment