/** * Add a shape to the name lookup table. */ public void addName(String nom, PShape shape) { if (parent != null) { parent.addName(nom, shape); } else { if (nameTable == null) { nameTable = new HashMap<String,PShape>(); } nameTable.put(nom, shape); } }
/** * Add a shape to the name lookup table. */ public void addName(String nom, PShape shape) { if (parent != null) { parent.addName(nom, shape); } else { if (nameTable == null) { nameTable = new HashMap<String,PShape>(); } nameTable.put(nom, shape); } }
/** * @param idx the layer position in which to insert the new child */ public void addChild(PShape who, int idx) { if (idx < childCount) { if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } // Copy [idx, childCount - 1] to [idx + 1, childCount] for (int i = childCount - 1; i >= idx; i--) { children[i + 1] = children[i]; } childCount++; children[idx] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } } }
/** * @webref pshape:method * @brief Adds a new child * @param who any variable of type PShape * @see PShape#getChild(int) */ public void addChild(PShape who) { if (children == null) { children = new PShape[1]; } if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } children[childCount++] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } }
/** * @webref pshape:method * @brief Adds a new child * @param who any variable of type PShape * @see PShape#getChild(int) */ public void addChild(PShape who) { if (children == null) { children = new PShape[1]; } if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } children[childCount++] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } }
/** * @param idx the layer position in which to insert the new child */ public void addChild(PShape who, int idx) { if (idx < childCount) { if (childCount == children.length) { children = (PShape[]) PApplet.expand(children); } // Copy [idx, childCount - 1] to [idx + 1, childCount] for (int i = childCount - 1; i >= idx; i--) { children[i + 1] = children[i]; } childCount++; children[idx] = who; who.parent = this; if (who.getName() != null) { addName(who.getName(), who); } } }