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:

  • Easy opening of Simulator and Controller,
  • Automatic connection of all hovlets on execution,
  • Useful window coordination,
  • Regard to the command line parameters [[host]:port],
  • Simple registration of units for Graphical Debugging by extended add(...)-methods,
  • Automatic setting of the follow mode for units on showing their hovlets,
  • Termination by window closing.
  • 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]

  • (without) - Opens a Simulator and a Controller.
  • :port - Opens a Simulator at the specified port and a Controller.
  • host:port#hash - Opens a Controller and connects to the Simulator at the specified address.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Controller controller
      Executed Controller
      Simulator simulator
      Executed Simulator
      java.awt.Dimension size
      Required browser size

      Fields inherited from class hoverball.Hovlet

      background, BANNER, foreground, hovlets, icon, main, menubar, parent, title
    • Constructor Summary

      Constructors 
      Constructor Description
      Session()
      Opens a Hoverball session.
      Session​(java.lang.String name)
      Opens a Hoverball session.
      Session​(java.lang.String name, java.lang.Object server)
      Opens a Hoverball session.
    • 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

      Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Details

    • 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 session
        server - 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]
        Overrides:
        browse in class Hovlet
        Parameters:
        browser - frame of the browser
      • add

        public boolean add​(Hovlet hovlet)
        Adds a hovlet to this session.
        Overrides:
        add in class Hovlet
        Parameters:
        hovlet - hovlet
        Returns:
        true, if connection succeeded false, if connection failed
        See Also:
        Hovlet.add(...)
      • add

        public boolean add​(Unit unit)
        Adds a unit to the session.
        Parameters:
        unit - unit
      • add

        public boolean add​(Team team)
        Adds all units of a team to the session.
        Parameters:
        team - team
      • add

        public boolean add​(Unit unit, boolean debug)
        Adds a unit to the session and registers it at the Controller for Graphical Debugging.
        Parameters:
        unit - unit
        debug - graphical output enabled?
      • add

        public boolean add​(Team team, boolean debug)
        Adds all units of a team to the session and registers them at the Controller for Graphical Debugging.
        Parameters:
        team - team
        debug - 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

        public void start​(Unit unit)
        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