@webref pshape:method @brief Adds a new child @param who any variable of type PShape @see PShape#getChild(int)
(PShape who)
| 2036 | * @see PShape#getChild(int) |
| 2037 | */ |
| 2038 | public void addChild(PShape who) { |
| 2039 | if (children == null) { |
| 2040 | children = new PShape[1]; |
| 2041 | } |
| 2042 | if (childCount == children.length) { |
| 2043 | children = (PShape[]) PApplet.expand(children); |
| 2044 | } |
| 2045 | children[childCount++] = who; |
| 2046 | who.parent = this; |
| 2047 | |
| 2048 | if (who.getName() != null) { |
| 2049 | addName(who.getName(), who); |
| 2050 | } |
| 2051 | } |
| 2052 | |
| 2053 | |
| 2054 | // adds child who exactly at position idx in the array of children. |
no test coverage detected