2723
2724 /**
2725 * Returns the Element this <code>ElementInfo</code> represents.
2726 */
2727 public Element getElement() {
2728 return element;
2729 }
2730
2731 /**
2732 * Returns the parent of this Element, or null for the root.
2733 */
2734 public ElementInfo getParent() {
2735 return parent;
2736 }
2737
2738 /**
2739 * Returns the index of the specified child, or -1 if
2740 * <code>child</code> isn't a valid child.
2741 */
2742 public int indexOf(ElementInfo child) {
2743 ArrayList children = this.children;
2744
2745 if (children != null) {
2746 return children.indexOf(child);
2747 }
2748 return -1;
2749 }
2750
2751 /**
2752 * Returns the child ElementInfo at <code>index</code>, or null
2753 * if <code>index</code> isn't a valid index.
2754 */
2755 public ElementInfo getChild(int index) {
2756 if (validateIfNecessary()) {
2757 ArrayList<ElementInfo> children = this.children;
2758
2759 if (children != null && index >= 0 &&
2760 index < children.size()) {
2761 return children.get(index);
2762 }
2763 }
|
2723
2724 /**
2725 * Returns the Element this <code>ElementInfo</code> represents.
2726 */
2727 public Element getElement() {
2728 return element;
2729 }
2730
2731 /**
2732 * Returns the parent of this Element, or null for the root.
2733 */
2734 public ElementInfo getParent() {
2735 return parent;
2736 }
2737
2738 /**
2739 * Returns the index of the specified child, or -1 if
2740 * <code>child</code> isn't a valid child.
2741 */
2742 public int indexOf(ElementInfo child) {
2743 ArrayList<ElementInfo> children = this.children;
2744
2745 if (children != null) {
2746 return children.indexOf(child);
2747 }
2748 return -1;
2749 }
2750
2751 /**
2752 * Returns the child ElementInfo at <code>index</code>, or null
2753 * if <code>index</code> isn't a valid index.
2754 */
2755 public ElementInfo getChild(int index) {
2756 if (validateIfNecessary()) {
2757 ArrayList<ElementInfo> children = this.children;
2758
2759 if (children != null && index >= 0 &&
2760 index < children.size()) {
2761 return children.get(index);
2762 }
2763 }
|