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
fb4e4409
Commit
fb4e4409
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
Utility methods and constructors
parent
3bb9b902
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/ExampleSimulation.java
+60
-3
60 additions, 3 deletions
examples/src/OpenDis7Examples/ExampleSimulation.java
with
60 additions
and
3 deletions
examples/src/OpenDis7Examples/ExampleSimulation.java
+
60
−
3
View file @
fb4e4409
...
...
@@ -21,15 +21,68 @@ public class ExampleSimulation
DisThreadedNetworkInterface
.
PduListener
pduListener
;
Pdu
receivedPdu
;
String
networkAddress
=
"239.1.2.3"
;
int
networkPort
=
3000
;
private
String
networkAddress
=
"239.1.2.3"
;
private
int
networkPort
=
3000
;
/**
* Constructor design goal: additional built-in initialization conveniences can go here
* to keep student efforts focused on the runSimulation() method.
*/
public
ExampleSimulation
()
{
// Under consideration.
}
/**
* Utility Constructor
* @param address network address to use
* @param port corresponding network port to use
*/
public
ExampleSimulation
(
String
address
,
int
port
)
{
setNetworkAddress
(
address
);
setNetworkPort
(
port
);
}
/**
* @return the networkAddress
*/
public
String
getNetworkAddress
()
{
return
networkAddress
;
}
/**
* @param networkAddress the networkAddress to set
*/
public
final
void
setNetworkAddress
(
String
networkAddress
)
{
this
.
networkAddress
=
networkAddress
;
}
/**
* @return the networkPort
*/
public
int
getNetworkPort
()
{
return
networkPort
;
}
/**
* @param networkPort the networkPort to set
*/
public
final
void
setNetworkPort
(
int
networkPort
)
{
this
.
networkPort
=
networkPort
;
}
/**
* Initialize network interface, choosing best available network interface
*/
public
void
setUpNetworkInterface
()
{
disNetworkInterface
=
new
DisThreadedNetworkInterface
(
n
etworkAddress
,
n
etworkPort
);
disNetworkInterface
=
new
DisThreadedNetworkInterface
(
getN
etworkAddress
(),
getN
etworkPort
()
);
System
.
out
.
println
(
"Network confirmation: address="
+
disNetworkInterface
.
getMcastGroup
()
+
" port="
+
disNetworkInterface
.
getDisPort
());
pduListener
=
new
DisThreadedNetworkInterface
.
PduListener
()
...
...
@@ -102,6 +155,10 @@ public class ExampleSimulation
public
static
void
main
(
String
[]
args
)
{
// initial execution: can handle args array of initialization arguments here
if
(
args
.
length
==
2
)
{
}
ExampleSimulation
thisProgram
=
new
ExampleSimulation
();
// creates instance
...
...
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