previous up next
Go up to 4.1 Types
Go forward to Node: Network Nodes
RISC-Linz logo

Application: Network Applications

abstract class Application
{
  // constructing the application
  Application()
  Application(String t, int w, int h)

  // called for constructing the network
  abstract void construct()

  // used for standalone mode
  void run()

  // used for applet mode
  String getText()

  // to be used by construct()
  Node node(Program p)
  Node node(Program p, String t, int x, int y)
  void link(Node n1, Node n2)
  void link(Node n1, Node n2, Selector s)

  // customizing the execution
  void setScheduler(Scheduler s)
  void setSelector(Selector s)

  // customizing the visualization
  void setNodeRadius(int r)
  void setNodeFonts(Font f1, Font f2)
  void setChannelWidth(int w)
  void setBrowser(String b)
}

An object of (a non-abstract subtype of) this type is the starting point of program execution and visualization. The default constructor creates an application without visualization (usable only in standalone mode), the other constructor creates an application visualized by a window titled t and a visualization area of width w and height h4.

The programmer must override the method construct to create and to link the nodes of the corresponding network.

If the application shall be usable in standalone mode, the programmer must create an object of this type and call its method run, e.g.,

public class Main extends Application
{
  public static void main(String[] args)
  {
    new Main().run();
  }
  ...
}

If the application shall be usable as an applet, the programmer must override its default constructor to call the constructor with title, width, and height:

public class Main extends Application
{
  ...
  public Main()
  {
    super("Title", 400, 300);
  }
}

The method getText returns an applet information string that can be displayed by the applet viewer or Web browser (default "(no information)").

The other methods may be used for constructing the network, customizing the execution, and customizing the visualization


Maintainer: Wolfgang Schreiner
Last Modification: October 1, 1998

previous up next