Keeps track of wikipage references:
- What pages a given page refers to
- What pages refer to a given page
This is a quick'n'dirty approach without any finesse in storage and
searching algorithms; we trust java.util.*.
This class contains two HashMaps, m_refersTo and m_referredBy. The
first is indexed by WikiPage names and contains a Collection of all
WikiPages the page refers to. (Multiple references are not counted,
naturally.) The second is indexed by WikiPage names and contains
a Set of all pages that refer to the indexing page. (Notice -
the keys of both Maps should be kept in sync.)
When a page is added or edited, its references are parsed, a Collection
is received, and we crudely replace anything previous with this new
Collection. We then check each referenced page name and make sure they
know they are referred to by the new page.
Based on this information, we can perform non-optimal searches for
e.g. unreferenced pages, top ten lists, etc.
The owning class must take responsibility of filling in any pre-existing
information, probably by loading each and every WikiPage and calling this
class to update the references when created.
author: ebu@memecry.net since: 1.6.1 |