Home of: [Atelier "FUJIGURUMA"] >> [PageMixer hosted by SourceForge.net]

SEE "For Readers of English Version",
or Japanese version of this page

Concrete base class

This section explains the reason to design Token class as one bound to HTML tag characteristics.

Class names

In this document, abbreviated class names are used. Complete names are shown below.

NotationFull name
Filter jp.ne.dti.lares.foozy.pagemixer.mixer.Filter
Symbol jp.ne.dti.lares.foozy.pagemixer.Symbol
Token jp.ne.dti.lares.foozy.pagemixer.Token

Ordinary design

In Object-Oriented-Design, base class is designed as abstract and generic one, which does not have any derived class specific methods.

For example, neither javax.swing.JComponent, its base class java.awt.Container, or java.awt.Component have getUnitIncrement(int) method, whih is specific to javax.swing.JScrollBar.

The way of thinking described above makes base classes robust against for changes and re-useful.

Decision in PageMixer

At first, Token class is designed as generic one in PageMixer framework. It had only getName() and isNamedAs(Symbol) at that time.

But it causes belows:

Invocation of instanceof and casting cost so much because almost all Filters(*Watchers, in fact) want to know whether given Token is of start/end tag or not, and has specified attribute or not.

So, for performance reason, it is natural to define in Token class below examination methods, which depends on HTML tag Token specific characteristics.