inserts the given child object of the given type at the given index.
(int index, int type, Object child)
| 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 |
no test coverage detected