Java Reference
In-Depth Information
private void
doNotify(
int
type, String info){
setChanged();
notifyObservers(
new
JavaParseEvent(type,info));
}
private void
doNotify(int type){
setChanged();
notifyObservers(
new
JavaParseEvent(type));
}}
Class
JavaParseEvent
contains the information about the events that
occurs during parsing. There are four types of events (as defined in
Table 8.1). The additional information is specific for each type of event and
consists of a string.
public class
JavaParseEvent {
public static final int
BEGIN_PARSING
#
0;
public static final int
FOUND_CLASS
#
1;
public static final int
FOUND_MEMBER
#
2;
public static final int
END_PARSING
#
3;
public int
type;
public
String info;
public
JavaParseEvent(
int
type, String info){
this
.type
#
type;
this
.info
#
info;
}
public
JavaParseEvent(
int
type){
this
.type
#
type;
this
.info
#
null
;
}
}
The interface
Documenter
represent a generic documenter, it extends the
Observer
interface and defines the method
getResult()
that returns the
element containing the generated documentation.
public interface
Documenter
extends
Observer {
Element getResult();
}
The last class in this component is
SimpleDocumenter
. This class imple-
ments the
Documenter
interface providing implementation of the abstract
method in that class. The constructor initializes some attributes that repre-
sent the colours of the background, title and information text.
public class
SimpleDocumenter
implements
Documenter {
// These attributes define the colour schema.
private
String bgColor, titleColor, infoColor;
// Initializes the documenter, the parameters define the
// colour schema that will be used in the HTML page.