Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository 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
Savage
NetworkedGraphicsMV3500
Commits
708b7c02
Commit
708b7c02
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
improved output, test with upgraded library
parent
799a512b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/src/OpenDis7Examples/AllPduReceiver.java
+11
-8
11 additions, 8 deletions
examples/src/OpenDis7Examples/AllPduReceiver.java
with
11 additions
and
8 deletions
examples/src/OpenDis7Examples/AllPduReceiver.java
+
11
−
8
View file @
708b7c02
...
...
@@ -54,16 +54,16 @@ public class AllPduReceiver
String
currentPduFamilyName
=
pdu
.
getClass
().
getSuperclass
().
getSimpleName
();
StringBuilder
message
=
new
StringBuilder
();
message
.
append
(
DisTime
.
timeStampToString
(
pdu
.
getTimestamp
())
+
" "
);
message
.
append
(
"received DIS PDU "
);
if
(
currentPduType
.
getValue
()
<
10
)
message
.
append
(
" "
);
// column spacing
message
.
append
(
currentPduType
.
getValue
());
String
currentPduTypePadded
=
String
.
format
(
"%-34s"
,
currentPduType
);
// - indicates right padding of whitespace
message
.
append
(
" "
).
append
(
currentPduTypePadded
);
String
currentPduTypeNamePadded
=
String
.
format
(
"%-49s"
,
currentPduTypeName
);
// - indicates right padding of whitespace
message
.
append
(
" of type "
).
append
(
currentPduTypeNamePadded
);
// package.class name
message
.
append
(
" (protocolFamily "
).
append
(
currentProtocolFamilyID
);
// message.append(" ").append(currentPduFamilyName); // class name is also available
if
(
currentPduType
.
getValue
()
<
10
)
message
.
append
(
" "
);
// column spacing
// String currentPduTypeNamePadded = String.format("%-49s", currentPduTypeName); // - indicates right padding of whitespace
// message.append(" of type ").append(currentPduTypeNamePadded); // package.class name
message
.
append
(
" ("
).
append
(
currentProtocolFamilyID
);
// message.append(" ").append(currentPduFamilyName); // class name is also available
message
.
append
(
")"
);
System
.
out
.
println
(
message
.
toString
());
...
...
@@ -72,11 +72,14 @@ public class AllPduReceiver
case
COMMENT:
CommentPdu
commentPdu
=
(
CommentPdu
)
pdu
;
// cast to precise type
ArrayList
<
VariableDatum
>
payloadList
=
(
ArrayList
)
commentPdu
.
getVariableDatums
();
if
(!
payloadList
.
isEmpty
())
System
.
out
.
print
(
" messages: "
);
for
(
VariableDatum
variableDatum
:
payloadList
)
{
String
nextComment
=
new
String
(
variableDatum
.
getVariableDatumValue
());
// convert byte[] to String
System
.
out
.
print
ln
(
"\""
+
nextComment
+
"\""
);
System
.
out
.
print
(
"
\""
+
nextComment
+
"\""
);
}
System
.
out
.
println
();
}
}
else
...
...
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