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
69c69915
Commit
69c69915
authored
Jan 17, 2019
by
Daniel Lehmberg
Browse files
misleading function name, change from header -> indices
parent
db0d0d24
Pipeline
#84804
passed with stages
in 100 minutes and 15 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereGui/src/org/vadere/gui/projectview/view/DataProcessingView.java
View file @
69c69915
...
...
@@ -584,7 +584,7 @@ class DataProcessingView extends JPanel implements IJsonView {
c
.
gridx
=
1
;
c
.
gridy
=
2
;
panel
.
add
(
new
JLabel
(
outputFile
.
get
Header
()),
c
);
panel
.
add
(
new
JLabel
(
outputFile
.
get
Indices
()),
c
);
c
.
gridx
=
0
;
c
.
gridy
=
3
;
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/outputfile/OutputFile.java
View file @
69c69915
...
...
@@ -29,7 +29,12 @@ import java.util.stream.Stream;
*/
public
abstract
class
OutputFile
<
K
extends
DataKey
<
K
>>
{
private
String
[]
keyHeaders
;
//Note: Only header information from data keys are written in this, therefore, these are the indices
// Each processor attached to this processor itself attaches also headers, but they are not listed in this
// attribute.
private
String
[]
dataIndices
;
/**
* The file name without the path to the file
...
...
@@ -48,8 +53,8 @@ public abstract class OutputFile<K extends DataKey<K>> {
private
VadereWriterFactory
writerFactory
;
private
VadereWriter
writer
;
protected
OutputFile
(
final
String
...
keyHeader
s
)
{
this
.
keyHeaders
=
keyHeader
s
;
protected
OutputFile
(
final
String
...
dataIndice
s
)
{
this
.
dataIndices
=
dataIndice
s
;
this
.
dataProcessors
=
new
ArrayList
<>();
this
.
writerFactory
=
VadereWriterFactory
.
getFileWriterFactory
();
}
...
...
@@ -84,7 +89,7 @@ public abstract class OutputFile<K extends DataKey<K>> {
if
(!
isEmpty
())
{
try
(
VadereWriter
out
=
writerFactory
.
create
(
absoluteFileName
))
{
writer
=
out
;
print
Header
(
out
);
print
Indices
(
out
);
this
.
dataProcessors
.
stream
().
flatMap
(
p
->
p
.
getKeys
().
stream
())
.
distinct
().
sorted
()
...
...
@@ -101,16 +106,16 @@ public abstract class OutputFile<K extends DataKey<K>> {
return
this
.
dataProcessors
.
isEmpty
();
}
private
List
<
String
>
get
FieldHeader
s
()
{
return
composeLine
(
keyHeader
s
,
p
->
Arrays
.
stream
(
p
.
getHeaders
()));
private
List
<
String
>
get
DataIndice
s
()
{
return
composeLine
(
dataIndice
s
,
p
->
Arrays
.
stream
(
p
.
getHeaders
()));
}
public
void
print
Header
(
VadereWriter
out
)
{
writeLine
(
out
,
get
FieldHeader
s
());
public
void
print
Indices
(
VadereWriter
out
)
{
writeLine
(
out
,
get
DataIndice
s
());
}
public
String
get
Header
()
{
return
String
.
join
(
this
.
separator
,
get
FieldHeader
s
());
public
String
get
Indices
()
{
return
String
.
join
(
this
.
separator
,
get
DataIndice
s
());
}
private
void
printRow
(
final
VadereWriter
out
,
final
K
key
)
{
...
...
@@ -133,7 +138,7 @@ public abstract class OutputFile<K extends DataKey<K>> {
}
/**
* Return the column
header
s as string or the empty array.
* Return the column
indice
s as string or the empty array.
*/
public
String
[]
toStrings
(
K
key
)
{
return
new
String
[]{
key
.
toString
()};
...
...
VadereSimulator/tests/org/vadere/simulator/dataprocessing/TestOutputFileAfterMultipleRuns.java
View file @
69c69915
...
...
@@ -40,19 +40,19 @@ public class TestOutputFileAfterMultipleRuns {
@Test
()
public
void
testFileFormatAfterMultipleSimulationRuns
()
{
ArrayList
<
String
>
header
AfterFirstRun
=
new
ArrayList
<>();
ArrayList
<
String
>
header
AfterSecondRun
=
new
ArrayList
<>();
ArrayList
<
String
>
indices
AfterFirstRun
=
new
ArrayList
<>();
ArrayList
<
String
>
indices
AfterSecondRun
=
new
ArrayList
<>();
ProcessorManager
manager
=
testScenario
.
getDataProcessingJsonManager
()
.
createProcessorManager
(
mainModel
);
manager
.
initOutputFiles
();
List
<
OutputFile
<?>>
outputFiles
=
testScenario
.
getDataProcessingJsonManager
().
getOutputFiles
();
outputFiles
.
forEach
(
f
->
header
AfterFirstRun
.
add
(
f
.
get
Header
()));
outputFiles
.
forEach
(
f
->
indices
AfterFirstRun
.
add
(
f
.
get
Indices
()));
manager
.
initOutputFiles
();
outputFiles
.
forEach
(
f
->
header
AfterSecondRun
.
add
(
f
.
get
Header
()));
outputFiles
.
forEach
(
f
->
indices
AfterSecondRun
.
add
(
f
.
get
Indices
()));
assertEquals
(
"Duplicated Processors in OutputFile after multiple Simulations"
,
header
AfterFirstRun
,
header
AfterSecondRun
);
indices
AfterFirstRun
,
indices
AfterSecondRun
);
}
}
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