Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For the sake of completeness I post my solution here:</p> <pre><code>abstract class Renderable { String id; //used to create links and pages String javadoc; //contains actual commentText Renderer renderer; //output-specifc renderer abstract String renderLink(); abstract String renderFull(); } class Component extends Renderable { /** renders a link to this component */ public String renderLink() { renderer.renderComponentLink(this); } /** renders the details of this component */ public String renderLink() { renderer.renderComponentFull(this); } } class Rule extends Renderable { List&lt;Component&gt; usedBy; /** renders a link to this rule */ public String renderLink() { renderer.renderRuleLink(this); } /** renders the details of this rule */ public String renderLink() { renderer.renderRuleFull(this); } } class Model { Map&lt;String,Component&gt; components; Map&lt;String,Rule&gt; rules; ... } /** May be subclassed for specific types of output */ class Renderer { public String renderRuleLink(Rule r) { ... }; public String renderRuleFull(Rule r) { ... for (Component c : r.getUsedBy() { //Components can render themselves in the same way. c.renderLink(); } }; public String renderComponentLink(Component c) { ... }; public String renderComponentFull(Component c) { ... }; public void generate(Model m) { for (Component c : m.getComponents()) { //add link to overview-pages using c.renderLink(); //add page with full docs using c.renderFull(); } for (Rule r : m.getRules()) { //add link to overview-pages using r.renderLink(); //add page with full docs using r.renderFull(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload