MCPcopy Create free account
hub / github.com/dumbledore/AlbiteREADER / addChild

Method addChild

src/org/kxml2/kdom/Node.java:47–68  ·  view source on GitHub ↗

inserts the given child object of the given type at the given index.

(int index, int type, Object child)

Source from the content-addressed store, hash-verified

45 given index. */
46
47 public void addChild(int index, int type, Object child) {
48
49 if (child == null)
50 throw new NullPointerException();
51
52 if (children == null) {
53 children = new Vector();
54 types = new StringBuffer();
55 }
56
57 if (type == ELEMENT) {
58 if (!(child instanceof Element))
59 throw new RuntimeException("Element obj expected)");
60
61 ((Element) child).setParent(this);
62 }
63 else if (!(child instanceof String))
64 throw new RuntimeException("String expected");
65
66 children.insertElementAt(child, index);
67 types.insert(index, (char) type);
68 }
69
70 /** convenience method for addChild (getChildCount (), child) */
71

Callers 2

parseMethod · 0.95
parseMethod · 0.45

Calls 2

getChildCountMethod · 0.95
setParentMethod · 0.80

Tested by

no test coverage detected