1 package org.catacomb.druid.build;
2
3
4 import org.catacomb.druid.dialog.Dialoguer;
5 import org.catacomb.interlish.structure.InfoExporter;
6 import org.catacomb.interlish.structure.InfoReceiver;
7 import org.catacomb.report.E;
8
9
10
11 public class InfoAggregator implements InfoReceiver, InfoExporter {
12
13
14 InfoReceiver infoReceiver;
15
16 String bufTitle;
17 String bufText;
18
19 int nbuf;
20
21 public InfoAggregator() {
22 nbuf = 0;
23 }
24
25
26
27 public void setInfoReceiver(InfoReceiver ir) {
28 infoReceiver = ir;
29
30 if (bufTitle != null) {
31 receiveInfo(bufTitle, bufText);
32
33 } else if (bufText != null) {
34 receiveInfo("Introduction", bufText);
35 }
36 }
37
38
39 public void receiveInfo(String s) {
40 receiveInfo("", s);
41
42 }
43
44 public void receiveInfo(String title, String text) {
45 if (infoReceiver != null) {
46 infoReceiver.receiveInfo(title, text);
47 } else {
48 bufTitle = title;
49 bufText = text;
50
51 if (nbuf == 0) {
52
53 nbuf = 1;
54 }
55
56
57 }
58 }
59
60 private void checkNbuf() {
61 nbuf += 1;
62 if (nbuf > 4) {
63 E.oneLineWarning("multiple info sent to agregator without outlet");
64 }
65 }
66
67
68 }