public String get(Component c) { return get(Group.Alphabetic, c); }
public boolean contains(Group g, Component c) { return get(g, c) != null; }
public String toString(Group g, boolean trim) { int totLen = 0; Component lastCompOfGroup = Component.FamilyName; for (Component c : Component.values()) { String s = get(g, c); if (s != null) { totLen += s.length(); lastCompOfGroup = c; } } totLen += trim ? lastCompOfGroup.ordinal() : 4; char[] ch = new char[totLen]; int wpos = 0; for (Component c : Component.values()) { String s = get(g, c); if (s != null) { int d = s.length(); s.getChars(0, d, ch, wpos); wpos += d; } if (trim && c == lastCompOfGroup) break; if (wpos < ch.length) ch[wpos++] = '^'; } return new String(ch); }
private void writePNGroup(String qname, PersonName pn, PersonName.Group group) throws SAXException { if (pn.contains(group)) { startElement(qname); writeElement("FamilyName", pn.get(group, PersonName.Component.FamilyName)); writeElement("GivenName", pn.get(group, PersonName.Component.GivenName)); writeElement("MiddleName", pn.get(group, PersonName.Component.MiddleName)); writeElement("NamePrefix", pn.get(group, PersonName.Component.NamePrefix)); writeElement("NameSuffix", pn.get(group, PersonName.Component.NameSuffix)); endElement(qname); } }
Component lastCompOfGroup = Component.FamilyName; for (Component c : Component.values()) { String s = get(g, c); if (s != null) { totLen += s.length(); Component lastCompOfGroup = Component.FamilyName; for (Component c : Component.values()) { String s = get(g, c); if (s != null) { int d = c.ordinal() - lastCompOfGroup.ordinal();