<p>Return a child with the specified component id from the specified
component, if any; otherwise, return <code>null</code>.</p>

@param component {@link UIComponent} to be searched
@param componentId Component id to search for
508591
private static UIComponent getChild(
            UIComponentClassicTagBase tag, UIComponent component, String componentId)
    {
        int childCount = component.getChildCount();

        // we only need to bother to check if we even have children
        if (childCount > 0)
        {
            List<UIComponent> children = component.getChildren();

            // Most Lists implement RandomAccess, so iterate directly rather than creating
            // and iterator
            if (children instanceof RandomAccess)
            {
                // in the most common case, the first component we are asked for will be the
                // our first child, the second, our second, etc.  Take advantage of this by
                // remembering the index to check for the next child.  This changes this code
                // from O(n^2) for all of the children to O(n)
                int startIndex;

                if (tag != null)
                    startIndex = tag._nextChildIndex;
                else
                    startIndex = 0;

                // start searching from location remembered from last time
                for (int i = startIndex; i < childCount; i++)
                {
                    UIComponent child = children.get(i);

                    if (componentId.equals(child.getId()))
                    {
                        // bump up the index to search next and wrap around
                        i++;

                        tag._nextChildIndex = (i < childCount) ? i : 0;
                        return child;
                    }
                }

                // handle case where we started past the first item and didn't find our
                // child.  Now search from the beginning to where we started
                if (startIndex > 0)
                {
                    for (int i = 0; i < startIndex; i++)
                    {
                        UIComponent child = children.get(i);

                        if (componentId.equals(child.getId()))
                        {
                            i++;

                            tag._nextChildIndex = i;
                            return child;
                        }
                    }
                }
            }
            else
            {
                // List doesn't support RandomAccess, do it the iterator way
                for (UIComponent child : children)
                {
                    if (componentId.equals(child.getId()))
                        return child;
                }
            }
        }

        return null;
    }
988510
@Deprecated
    public static void finalizeForDeletion(UIComponent component)
    {
        // remove any existing marks of deletion
        component.getAttributes().remove(MARK_DELETED);

        // finally remove any children marked as deleted
        if (component.getChildCount() > 0)
        {
            for (Iterator<UIComponent> iter = component.getChildren().iterator(); iter.hasNext();)
            {
                UIComponent child = iter.next();
                if (child.getAttributes().containsKey(MARK_DELETED))
                {
                    iter.remove();
                }
            }
        }

        // remove any facets marked as deleted
        if (component.getFacetCount() > 0)
        {
            Map<String, UIComponent> facets = component.getFacets();
            Collection<UIComponent> col = facets.values();
            for (Iterator<UIComponent> itr = col.iterator(); itr.hasNext();)
            {
                UIComponent fc = itr.next();
                if (fc.getAttributes().containsKey(MARK_DELETED))
                {
                    itr.remove();
                }
            }
        }
    }
937556
private UIForm getForm(UIComponent component) {
		while (component != null) {
			if (component instanceof UIForm) {
				break;
			}
			component = component.getParent();
		}
		return (UIForm) component;
	}
1014335
protected function addToComponentTree($componentId, array $componentPath, array &$tree)
    {
        // If the component has to be placed in a subpath
        if (count($componentPath)) {
            $subpath = array_shift($componentPath);
            if (empty($tree[$subpath])) {
                $tree[$subpath] = [];
            }
            $this->addToComponentTree($componentId, $componentPath, $tree[$subpath]);

            return;
        }

        $tree[] = $componentId;
    }
215708
public CmsTreeItem getChild(String itemId) {

        CmsTreeItem result = m_children.getItem(itemId);
        return result;
    }
10813
protected Component lookForComponent(String name, ObservableList<Node> components) {
        for (int i = 0; i < components.size() && !mFindWithEqual; i++) {
            //String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]);
            Node c = components.get(i);
            checkName(name, c);
            if (!mFindWithEqual) {
                if (c instanceof Parent) {
                    Component result = lookForComponent(name, ((Parent) c).getChildrenUnmodifiable());
                    if (result != null) {
                        return result;
                    }
                }
            }
        }
        return null;
    }
409500
public void removeControlComponent(IControlComponent component)
	{
		if (component.getParent() != this)
			return;

		controlComponents.remove(component);
		component.setParent(null);
	}
320215
public function componentsVersion($componentId = null)
    {
        $components = $this->components ?: $this->loadComponents();

        array_walk($components, function (&$component) {
            $component = $component['version'];
        });

        return $componentId
            ? [$componentId => $components[$componentId]]
            : $components;
    }
765923
public Fields getComponentOutputFields(String componentId, String streamId) {
    return new Fields(delegate.getComponentOutputFields(componentId, streamId));
  }
394025
WComponent getChildAt(final int index) {
		ComponentModel model = getComponentModel();
		return model.getChildren().get(index);
	}
304659
public static UIComponentTag getParentUIComponentTag(PageContext pageContext)
    {
        UIComponentClassicTagBase parentTag = getParentUIComponentClassicTagBase(pageContext);

        return parentTag instanceof UIComponentTag ? (UIComponentTag)parentTag : new UIComponentTagWrapper(parentTag);

    }
672057
public static WComponent getComponentWithId(final WComponent root, final String id,
			final boolean visibleOnly) {
		ComponentWithContext comp = getComponentWithContextForId(root, id, visibleOnly);
		return comp == null ? null : comp.getComponent();
	}
566038
public void deleteComponent(String componentName) throws IOException {
    String path = RegistryUtils.componentPath(
        user, jstormServiceClass, instanceName,
        componentName);
    registryOperations.delete(path, false);
  }
48814
public List<Integer> getComponentTasks(String componentId) {
    List<Integer> retVal = new LinkedList<>();
    for (Map.Entry<Integer, String> entry : taskToComponentMap.entrySet()) {
      if (entry.getValue().equals(componentId)) {
        retVal.add(entry.getKey());
      }
    }
    return retVal;
  }
473249
public void add(UIComponent... components)
	{
		for (UIComponent component : components)
		{
			if (component != null && component != this)
			{
				content.components.add(component);
				component.setParent(this);
				component.register(this);
			}
		}
		onContentUpdate();
	}
749597
static TypeName arrayComponent(TypeName type) {
    return type instanceof ArrayTypeName
        ? ((ArrayTypeName) type).componentType
        : null;
  }
439946
public static String getComponentClientId(final String componentId) {
		FacesContext context = FacesContext.getCurrentInstance();
		UIViewRoot root = context.getViewRoot();

		UIComponent c = findComponent(root, componentId);
		if (c==null) {
			return null;
		}
		return c.getClientId(context);
	}