01: package mlsub.typing.lowlevel;
02:
03: /**
04: * For pretty-printing lists separated by commas or semi-colons or, etc.
05: **/
06: public class Separator {
07: private boolean first;
08: private String content1;
09: private String content2;
10:
11: public Separator(String content1, String content2) {
12: this .first = true;
13: this .content1 = content1;
14: this .content2 = content2;
15: }
16:
17: public Separator(String content2) {
18: this ("", content2);
19: }
20:
21: public void setContent(String content) {
22: this .content2 = content;
23: }
24:
25: public String toString() {
26: if (first) {
27: first = false;
28: return content1;
29: } else {
30: return content2;
31: }
32: }
33:
34: public void reset() {
35: this .first = true;
36: }
37:
38: public void reset(String content2) {
39: this .first = true;
40: this .content2 = content2;
41: }
42:
43: public void reset(String content1, String content2) {
44: this .first = true;
45: this.content1 = content1;
46: this.content2 = content2;
47: }
48: }
|