At the lowest level, StreamTokenizer from java.io is used to tokenize the inputstream. PICSTokenizer is a wrapper around StreamTokenizer, providing high-level PICS-specific parsing services. It is used by Service, Category, Enum, Filter and Range. For example, StreamTokenizer.checkVersion() verifies the version number of the pics-service to be 1.0 or 1.1; StreamTokenizer.nextPair(String,int) reads the value of a pair in parentheses.
Service has a constructor with a single parameter of Inputstream. A PICSTokenizer is constructed from the Inputstream, which is not used again. Service, with the help of PICSTokenizer, parses the pics-service according to the PICS specification, gathering information of rating-system, rating-service and so on. In the process, intances of Category are created, recursively if necessary.
Category optionally contains instances of Enum, which represents a single labeled value.
Service, Category and Enum are the core data structures to represent and manipulate pics-service machine-readable.
Filter and Range have similar constructors to parse filter descriptions.
The parsing action can be reversed by calling toString()
in these objects.
There are two options for displaying labeled values. The default is list, which has the advantage of showing a variable number of label values in a fixed area. However, the user can choose to display labeld values with checkboxes, which is more intuitive and convenient to use.
Gridlayout is used to partition the main window for the categories. There is a description area at the bottom of the window. Scrollable panel is the most complicated part of the user interfaces. Since the windows size is fixed, the windows will not be able to fit all the necessary interface widgets if there are too many categories. Scrollable panel is implemented to let the user scroll through the categories. Cardlayout is used instead of dynamic generation in order to improve the smoothness of scrolling.