Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
vadere
vadere
Commits
cc7405ff
Commit
cc7405ff
authored
Sep 05, 2016
by
Mario Teixeira Parente
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the separator sign adjustable
parent
c9472f6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
3 deletions
+36
-3
VadereGui/resources/outputTemplates/output_default.json
VadereGui/resources/outputTemplates/output_default.json
+2
-1
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing_mtp/DataProcessingJsonManager.java
...rojects/dataprocessing_mtp/DataProcessingJsonManager.java
+24
-0
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing_mtp/OutputFile.java
...ere/simulator/projects/dataprocessing_mtp/OutputFile.java
+10
-2
No files found.
VadereGui/resources/outputTemplates/output_default.json
View file @
cc7405ff
...
...
@@ -2,7 +2,8 @@
"files"
:
[
{
"type"
:
"org.vadere.simulator.projects.dataprocessing_mtp.TimestepPedestrianIdOutputFile"
,
"filename"
:
"output_ts_pid.txt"
,
"processors"
:
[
1
,
2
,
3
,
5
,
13
,
14
,
17
]
"processors"
:
[
1
,
2
,
3
,
5
,
13
,
14
,
17
],
"separator"
:
";"
},
{
"type"
:
"org.vadere.simulator.projects.dataprocessing_mtp.PedestrianIdOutputFile"
,
"filename"
:
"output_pid.txt"
,
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing_mtp/DataProcessingJsonManager.java
View file @
cc7405ff
...
...
@@ -25,12 +25,15 @@ public class DataProcessingJsonManager {
private
static
final
String
TYPE_KEY
=
"type"
;
private
static
final
String
FILENAME_KEY
=
"filename"
;
private
static
final
String
FILE_PROCESSORS_KEY
=
"processors"
;
private
static
final
String
SEPARATOR_KEY
=
"separator"
;
public
static
final
String
PROCESSORS_KEY
=
"processors"
;
private
static
final
String
PROCESSORID_KEY
=
"id"
;
public
static
final
String
ATTRIBUTES_KEY
=
"attributes"
;
private
static
final
String
DEFAULT_SEPARATOR
=
" "
;
private
static
ObjectMapper
mapper
;
public
static
ObjectWriter
writer
;
...
...
@@ -51,6 +54,21 @@ public class DataProcessingJsonManager {
String
type
;
String
filename
;
List
<
Integer
>
processors
;
private
String
separator
;
public
OutputFileStore
()
{
this
.
separator
=
DEFAULT_SEPARATOR
;
}
public
String
getSeparator
()
{
return
this
.
separator
;
}
public
void
setSeparator
(
String
separator
)
{
if
(
separator
!=
null
)
{
this
.
separator
=
separator
;
}
}
}
static
{
...
...
@@ -75,6 +93,7 @@ public class DataProcessingJsonManager {
OutputFile
<?>
file
=
outputFileInstantiator
.
createObject
(
fileStore
.
type
);
file
.
setFileName
(
fileStore
.
filename
);
file
.
setProcessorIds
(
fileStore
.
processors
);
file
.
setSeparator
(
fileStore
.
getSeparator
());
this
.
outputFiles
.
add
(
file
);
}
...
...
@@ -95,6 +114,11 @@ public class DataProcessingJsonManager {
node
.
put
(
FILENAME_KEY
,
outputFile
.
getFileName
());
node
.
set
(
FILE_PROCESSORS_KEY
,
mapper
.
convertValue
(
outputFile
.
getProcessorIds
(),
JsonNode
.
class
));
final
String
separator
=
outputFile
.
getSeparator
();
if
(
separator
!=
DEFAULT_SEPARATOR
)
{
node
.
put
(
SEPARATOR_KEY
,
separator
);
}
return
node
;
}
...
...
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing_mtp/OutputFile.java
View file @
cc7405ff
...
...
@@ -19,7 +19,7 @@ public abstract class OutputFile<K extends Comparable<K>> {
private
List
<
Integer
>
processorIds
;
private
List
<
Processor
<
K
,
?>>
processors
;
private
static
String
SEPARATOR
=
" "
;
private
String
separator
;
OutputFile
(
final
String
...
keyHeaders
)
{
this
.
keyHeaders
=
keyHeaders
;
...
...
@@ -35,6 +35,14 @@ public abstract class OutputFile<K extends Comparable<K>> {
this
.
processors
.
clear
();
}
public
String
getSeparator
()
{
return
this
.
separator
;
}
public
void
setSeparator
(
final
String
separator
)
{
this
.
separator
=
separator
;
}
@SuppressWarnings
(
"unchecked"
)
public
void
init
(
final
ProcessorManager
manager
)
{
processorIds
.
forEach
(
pid
->
this
.
processors
.
add
((
Processor
<
K
,
?>)
manager
.
getProcessor
(
pid
)));
...
...
@@ -76,7 +84,7 @@ public abstract class OutputFile<K extends Comparable<K>> {
}
private
void
writeLine
(
PrintWriter
out
,
final
List
<
String
>
fields
)
{
out
.
println
(
String
.
join
(
SEPARATOR
,
fields
));
out
.
println
(
String
.
join
(
this
.
separator
,
fields
));
}
/** Return the column headers as string or the empty array. */
...
...
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