• No results found

CHAPTER 5: THE JAVA CLASSES

N/A
N/A
Protected

Academic year: 2021

Share "CHAPTER 5: THE JAVA CLASSES"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

C

HAPTER

5: T

HE

J

AVA

C

LASSES

This chapter deals solely with the Java programming aspects of FriOWL-v3.1. Because of the large number of Java classes and many thousands of lines of code contained in the software, it is only possible to give brief explanations of the classes here. Full Java documentation and source code is provided on the FriOWL-v3.1 website. This chapter has been prepared by Eddie Graham, with the class documentation provided by Moritz Neun.

5.1: I

NTRODUCTION TO

J

AVA

Java is a computer programming language developed by Sun Microsystems (USA) and was first released publicly in 1995. It soon became popular after the introduction of Java applets in webpages around 1996, and the Java language and technologies grew quickly thereafter. As of 2007, the language became an “open-source” software, meaning that the language has become freely available to anyone under the “GNU” free public software licence (see http://www.gnu.org/licenses/gpl-3.0.txt for more information; website accessed 1 March 2008).

Java was chosen for FriOWL-v3.1 because it is a platform independent language, meaning that code which is written and compiled with a Java compiler may be run on any computer thereafter, regardless of platform (e.g. Windows, Linux, Macintosh, etc..). It also has a reputation as being stable and secure, because the Java programs are client-based. Powerful web or standalone graphical applications can be built relatively easily with Java, and it is used widely in the mobile-phone industry today.

Java is a object-orientated langauge, meaning that the code is composed of classes or objects. Class definitions may be placed almost anywhere in a Java program. This is unlike procedural languages such as Fortran or BASIC, where the code is actioned sequentially (e.g. line 2 of the code is actioned after line 1, and so on).

Every Java class must have certain pre-defined characteristics. Each class must also descend from pre-defined hierarchy of Java classes, meaning that certain classes have precedence over others. Child classes automatically inherit the properties of their parent's class. Classes can also be bunched together into packages, which are an organised collection of classes.

(2)

For example, a tree could be described as a parent class. Every tree has a trunk, branches, twigs and leaves; these are the properties defining the original class “tree”. An instance of the “tree” class can then be created to define a particular tree e.g. an Oak tree or a Maple tree, but every tree will have similar properties or attributes (trunk, twigs, leaves), regardless of tree type. Likewise, the tree may shed an acorn, which a few years later grows in another tree; this “child” class inherits exactly the same properties as its parent. The Java language hierarchy works in a similar way.

What follows next are brief descriptions and explanations of the main Java classes in

FriOWL-v3.1, which are provided for documentation purposes. Due to space considerations, however, full source codes are not provided; these can be found on the FriOWL-v3.1

website.

5.2: N

OTES ON AUTHORS AND WRITING OF CODE

The code of FriOWL-v3.1 was written mostly by Moritz Neun of the University of Zürich, Switzerland, under the instruction, design and guidance of Eddie Graham. However, it followed on largely from the previous FriOWL versions 2.1 and 2.2 (2004-2006), which were designed, built and written by Moritz Neun, Michael Hayoz and Eddie Graham, then at the University of Fribourg, Switzerland (Graham et al., 2005b). This was based, in turn, on on earlier version of FriOWL (version 1.0), which was written in the PHP language (Graham, 2003), also by Hayoz, Neun and Graham.

Most of actual Java code was not manually typed, but was written using integrated development environments (IDE), which are themselves graphical applications designed to aid programmers to write code very quickly (even a small Java application may contain several hundred lines of code). The IDE used by Eddie Graham for FriOWL-v2.2 was Borland

Jbuilder, although the open-source Eclipse software is more widely used today. The statistical operators of the software were mostly manually coded by Graham and Neun.

5.3. J

AVA CLASSES AND PACKAGES OF

F

RI

OWL-

V

3.1

At the time of writing (1 March 2008), FriOWL-v3.1 contains approximately fifty Java classes in total, containing many thousands of lines of code. The classes are organised into five different packages, namely;

(3)

(ii) org.eso.friowl.actions (iii)org.eso.friowl.operators (iv)org.eso.friowl.timeseries (v) org.eso.friowl.tools

Each package refers to a particular part of the software. Many of the package and class names are self-explantory. Each of these are now briefly described in the following sections.

5.3.1: PACKAGE “ORG.ESO.FRIOWL

Package org.eso.friowl consists of 18 different classes; these control the main application window and layout of the software.

Class Name Description

AboutFrame This is the frame showing the About-Message in FriOWL.

ColorScheme A ColorScheme contains the complete color table of a RDC file.

ColorsPanel The panel of the right side of the MainWindow showing the color-bar.

FilesPanel The panel of the upper left side of the MainWindow showing the file-tree.

FilesPanelMonitor A status bar can be used for displaying the progress of opening a file.

FriOWLApplet The small Applet in the homepage where a user enters a username and password.

MainWindow This is the main class of FriOWL.

MapHistoryFrame Window to display the history of a map.

MapImage The panel of the upper middle of the MainWindow containing the map display.

MapImagePanel The scroll-panel of the upper middle of the MainWindow containing the MapImage.

MenuBar The menu-bar at the top of FriOWL.

MenuSaveDialog The dialog which opens when a map is being saved.

OptionsPanel The panel of the lower left of the MainWindow.

RasterMap Each file which is opened and added to the SelectedMapsTable is represented by a RasterMap-Object.

Resources Utility class containing settings and methods to open and save files at the server.

SelectedMaps Container to hold all selected maps which are then displayed by the SelectedMapsTable in the SelectedMapsPanel.

SelectedMapsPanel The panel of the lower middle of the MainWindow containing the SelectedMapsTable.

StatusBar Status-bar at the bottom of the MainWindow.

5.3.2: PACKAGE “ORG.ESO.FRIOWL.ACTIONS

Package org.eso.friowl.actions consists of nine different classes, but the only action they need to control is the Undo function. This package also implements a Java interface 'Iundo'

(4)

class relationship e.g. both trees and humans tend to grow with time, but one would not classify them together as similar objects).

Class Name Description

UndoAdd Undo adding a map.

UndoChangeWeight Undo changing the weight in the SelectedMapsTable.

UndoClear Undo clearing the SelectedMapsTable.

UndoCrop Undo cropping the map.

UndoNormalize Undo normalizing the map.

UndoReclass Undo reclassing a map.

UndoRemove Undo removing a map from the SelectedMapsTable.

UndoResampling Undo resampling a map.

UndoZoom Undo zooming.

5.3.3: PACKAGE “ORG.ESO.FRIOWL.OPERATORS

Package org.eso.friowl.operators holds all the operator classes (e.g. Anomaly, Max, Min, Root Mean Square, etc..); their names are self-explantory. This package also implements the interface GridOperator. For a full explanation and definition of each operator, please see Chapter 4 (“Description of the GUI”).

Class Name Description

Anomaly The Anomaly Operator.

Crop The Crop Transformation.

Max The Maximum Operator.

Mean The Mean Operator.

Min The Minimum Operator.

Normalize The Normalize Transformation.

Reclassification The Reclassification Transformation.

Resampling The Resampling Transformation.

RootMeanSquare The RootMeanSquare Operator.

StandardDeviation The Standard Deviation Operator.

StandardError The Standard Error Operator.

Sum The Sum Operator.

5.3.4: PACKAGE “ORG.ESO.FRIOWL.TIMESERIES

Package org.eso.friowl.timeseries holds the four classes of the FriOWL-v3.1 time series applet. This package also implements the interface 'ISeries'.

(5)

Class Name Description

SeriesLocal Just a placeholder for allowing to select the Files in the SelectedFilesTable from the MainWindow as input for the time series.

SeriesMonthly Each time series is parameterized in a SeriesMonthly object and saved in the drop-down field in the TimeSeriesFrame.

TimeSeriesFrame The window containing the time series functionalities.

TimeSeriesGraphPanel Panel which shows the actual time series graph.

5.3.5: PACKAGE “ORG.ESO.FRIOWL.TOOLS

There are just two classes in the package org.eso.friowl.tools, namely:

Class Name Description

ClientHttpRequest Client HTTP Request class.

LifoStack A small utility implementing a "last in, first out stack".

5.4. F

INAL NOTE ON

F

RI

OWL-

V

2.2 J

AVA CLASSES

The previous version of FriOWL-v2.2 held a smaller number of Java classes (approximately twenty) in a single package. Since the new FriOWL-v3.1 has superseeded FriOWL-v2.2, it is decided as being not necessary to list or detail the classes here, but full listings and source code of these classes can be found on the FriOWL-v3.1 website†‡.

http://www.iapmw.unibe.ch/research/projects/FriOWL/org/eso/friowl/

References

Related documents

Our focus is not on the wider contribution of the humanities and social sciences to the study of mental (ill) health and clinical practice; more narrowly, we seek to show how work

Certifica- tion by the ABHP or by the ABMP in Medical Radiation Protection indicates competence only in radiation safety aspects of radiation oncology, and not in the practice

The SelfTest annotations allow one to annotate Java classes with test data, and the SelfTest annotation processor generates executable JUnit test classes from annotated Java classes

Bicolored or uniformly dark, with microsculpture mesh pattern slightly transverse, sculpticells slightly wider than long (Fig. 5C-D) in dorsal aspect slender, shaft subsinuate,

Dividends, therefore, do not offer excess rates of return, while a share buyback at a price lower than the value of the business will offer an excess rate of return?. I thought

This article set out to explore to which extent the delibera- tive potential of social media is realized on Twitter in the context of the Brazilian presidential elections in 2014..

• Contact the Scheduling Office if changes to credit hours need to be made. Our office can only make changes on variable credit hour courses, and the change must be within the

It with java classes in java language, declaring a notion of declaration contains is declared in the exact type instantiated to declare that all the compiler.. You declare an