sclass WebNode implements _SetField { Web web; O labels; public void _setField(S f, O x) { if (f.equals('web)) web = (Web) x; else if (f.equals('labels)) labels = (L) x; } void _doneLoading { if (labels instanceof L) labels = smallestList_fromList((L) labels); } *() {} *(Web *web) { web.fireNewNode(this); } final O rawLabels() { ret labels; } void addLabel(S label) { labels = smallestList_add(rawLabels(), label); } void addLabel(Lisp label) { addLabel(web.unparseLabel(label)); } void addLabels(Collection l) { for (Lisp lbl : l) addLabel(lbl); } void addStrings(Collection l) { for (S lbl : l) addLabel(lbl); } bool hasLabel(Lisp label) { ret hasLabel(web.unparseLabel(label)); } bool hasLabel(S label) { ret smallestList_contains(rawLabels(), label); } toString { ret smallestList_l(rawLabels()) == 1 ? str(smallestList_first(rawLabels())) : str(smallestList_toList(rawLabels())); } int count() { ret 1 + smallestList_l(rawLabels()); } final S text() { ret (S) smallestList_first(rawLabels()); } final L texts() { ret smallestList_toList(rawLabels()); } void relation(S arrow, S b) { web.getRelation(this, web.node(b)).addLabel(arrow); } Lisp parseLabel(S l) { ret web.parseLabel(l); } S unparseLabel(Lisp l) { ret web.unparseLabel(l); } L labels() { ret web.parseLabels(texts()); } bool hasLabels() { ret smallestList_nempty(rawLabels()); } void setLabel(int i, Lisp l) { labels = smallestList_set(rawLabels(), i, web.unparseLabel(l)); } O visInfo() { ret null; } void visInfo(O o) {} }