Package hoverball
Class Session
java.lang.Object
hoverball.Hovlet
hoverball.Session
public class Session extends Hovlet
The class Session allows to run all required
Hoverball components simultaneously and to configure them
by little programming code.
The Hoverball Session assumes the following services:
Moreover, the Hoverball Session can be extended at will by the full Hoverball command pool.Note: The Session's hovlet tree must be displayed for a correct working of the session!
Example:
This code creates a Hoverball Session which opens the team
MyTeam
, sets the game duration to one minute and
runs the simulation.
import hoverball.*; public class MySession extends Session { public static void main (String[] args) { new MySession(args); } public MySession (String[] args) { super("My Session",args); // open Hoverball-Session add(new MyTeam(),true); // open MyTeam with Graphical Debugging controller.show(); // show browser with Controller controller.viewer.show(); // show screen if (simulator == null) return; // external Simulator? return! simulator.set("game.duration",60); // set game duration to 1 minute simulator.state(1); // check in simulator.state(2); // start! } }
The class Session can also be run as an application:
java hoverball.Session [host][:port][#hash]
-
Field Summary
Fields Modifier and Type Field Description Controller
controller
Executed ControllerSimulator
simulator
Executed Simulatorjava.awt.Dimension
size
Required browser sizeFields inherited from class hoverball.Hovlet
background, BANNER, foreground, hovlets, icon, main, menubar, parent, title
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
add(Hovlet hovlet)
Adds a hovlet to this session.boolean
add(Team team)
Adds all units of a team to the session.boolean
add(Team team, boolean debug)
Adds all units of a team to the session and registers them at the Controller for Graphical Debugging.boolean
add(Unit unit)
Adds a unit to the session.boolean
add(Unit unit, boolean debug)
Adds a unit to the session and registers it at the Controller for Graphical Debugging.void
browse(javax.swing.JInternalFrame browser)
[Implementation]static void
main(java.lang.String[] args)
Runs a standard session (application!).void
start()
Comfortable method to start the session.void
start(Unit unit)
Comfortable method to start the session.Methods inherited from class hoverball.Hovlet
close, connect, connecting, disconnect, disconnecting, locate, locate, show, status, title
-
Field Details
-
simulator
Executed Simulator -
controller
Executed Controller -
size
public java.awt.Dimension sizeRequired browser size
-
-
Constructor Details
-
Session
public Session()Opens a Hoverball session. -
Session
public Session(java.lang.String name)Opens a Hoverball session.- Parameters:
name
- name of the Hoverball session
-
Session
public Session(java.lang.String name, java.lang.Object server)Opens a Hoverball session.You can specify the address of an external Simulator (as a string in the form of
"host:port#hash"
) or the required port (as a string in the form of":port"
). The handoff of a string array is also valid so that the argument array of a main(...)-method can directly be passed. In this case the string with index 0 is read out.- Parameters:
name
- name of the Hoverball sessionserver
- address or port of the Simulator
-
-
Method Details
-
main
public static void main(java.lang.String[] args)Runs a standard session (application!). -
browse
public void browse(javax.swing.JInternalFrame browser)[Implementation] -
add
Adds a hovlet to this session.- Overrides:
add
in classHovlet
- Parameters:
hovlet
- hovlet- Returns:
true
, if connection succeededfalse
, if connection failed- See Also:
- Hovlet.add(...)
-
add
Adds a unit to the session.- Parameters:
unit
- unit
-
add
Adds all units of a team to the session.- Parameters:
team
- team
-
add
Adds a unit to the session and registers it at the Controller for Graphical Debugging.- Parameters:
unit
- unitdebug
- graphical output enabled?
-
add
Adds all units of a team to the session and registers them at the Controller for Graphical Debugging.- Parameters:
team
- teamdebug
- graphical output enabled?
-
start
public void start()Comfortable method to start the session. This method executes:controller.show(); controller.viewer.show(); simulator.state(1); simulator.state(2);
-
start
Comfortable method to start the session. This method executes:unit.show(); controller.viewer.show(); simulator.state(1); simulator.state(2);
- Parameters:
unit
- unit to show and follow
-