sclass GazellePost { long id; long created, modified; // timestamps GazelleUser creator; S text, title, type, botInfo; bool creating, hidden; L postRefs; LS postRefTags; O importedFrom; *() {} *(Map map) { id = toLong(map.get("id")); created = toLong(map.get("created")); modified = toLong(map.get("_modified")); text = (S) map.get("text"); title = (S) map.get("title"); type = (S) map.get("type"); botInfo = (S) map.get("botInfo"); creating = isTrue(map.get("creating")); hidden = isTrue(map.get("hidden")); postRefs = allToLong((L) map.get("postRefs")); postRefTags = checkedListCast S(map.get("postRefTags")); long creatorID = toLong(map.get("creatorID")); S creatorName = toLong(map.get("creatorName")); if (creatorID != 0 || nempty(creatorName)) creator = new GazelleUser(creatorID, creatorName); } LPair taggedRefs() { ret zipTwoListsToPairs_lengthOfFirst(postRefs, postRefTags); } toString { S content = nempty(title) ? shorten(title) : shorten(text); S _type = isReply() ? "reply" : "post"; S author = or2(strOrNull(creator), "unknown"); if (isBotPost()) author += "'s bot " + quote(botInfo); if (hidden) _type += " (hidden)"; ret firstToUpper(_type) + " by " + author + ": " + content; } bool isReply() { ret nempty(postRefs); } bool isBotPost() { ret nempty(botInfo); } }