Returns true if this element may accept the specified element as a parent. Updates the reject
reason with the result.

@param parent Parent instance to test.
@return True if this element may accept the specified element as a parent.
182108
public boolean canAcceptParent(ElementBase parent) {
        if (!canAcceptParent()) {
            return false;
        }
        
        if (!canAcceptParent(getClass(), parent.getClass())) {
            rejectReason = getDisplayName() + " does not accept " + parent.getDisplayName() + " as a parent.";
        } else {
            rejectReason = null;
        }
        
        return rejectReason == null;
    }
751050
public static boolean failSafeRemoveFromParent(Element element) {
        return failSafeRemove(element != null ? element.parentNode : null, element);
    }
522816
public boolean canAcceptChild(Class<? extends ElementBase> childClass) {
        if (!canAcceptChild()) {
            return false;
        }

        Cardinality cardinality = allowedChildClasses.getCardinality(getClass(), childClass);
        int max = cardinality.getMaxOccurrences();
        
        if (max == 0) {
            rejectReason = getDisplayName() + " does not accept " + childClass.getSimpleName() + " as a child.";
        } else if (max != Integer.MAX_VALUE && getChildCount(cardinality.getTargetClass()) >= max) {
            rejectReason = getDisplayName() + " cannot accept more than " + max + " of "
                    + cardinality.getTargetClass().getSimpleName() + ".";
        }

        return rejectReason == null;
    }
8216
private List<TreeNode> getSelected(TreeNode parent) {
        List<TreeNode> result = new ArrayList<>();
        for (TreeNode n : parent.getChildren()) {
            if (n.isSelected()) {
                result.add(n);
            }
            result.addAll(getSelected(n));
        }
        return result;
    }
237430
public boolean accepts(final String ct) {
        for (final Object element : accepts) {
            final String accept = (String) element;
            if (accept != null && accept.trim().equals("*/*")) {
                return true;
            }
            final String entryType = "application/atom+xml";
            final boolean entry = entryType.equals(ct);
            if (entry && null == accept) {
                return true;
            } else if (entry && "entry".equals(accept)) {
                return true;
            } else if (entry && entryType.equals(accept)) {
                return true;
            } else {
                final String[] rules = accepts.toArray(new String[accepts.size()]);
                for (final String rule2 : rules) {
                    String rule = rule2.trim();
                    if (rule.equals(ct)) {
                        return true;
                    }
                    final int slashstar = rule.indexOf("/*");
                    if (slashstar > 0) {
                        rule = rule.substring(0, slashstar + 1);
                        if (ct.startsWith(rule)) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }
37156
public boolean accepts(String type) {
        if (m_acceptsAll) {
            return true;
        }
        String[] parts = type.split("/");
        if (parts.length != 2) {
            return false;
        }
        for (String element : m_types) {
            if (element.equals(parts[0] + "/*") || element.equals(type)) {
                return true;
            }
        }
        return false;
    }
11211
void assertParent(Collection<Class<? extends Element>> permittedParents) throws InvalidInputException {
    if (!permittedParents.contains(this.getParent().getClass())) {
      throw new InvalidInputException("Element \"" + this.getMessageMLTag() + "\" is not allowed as a child of \""
          + this.getParent().getMessageMLTag() + "\"");
    }
  }
954482
public static boolean hasChildsOf(final Element parentElement, XsdElementEnum child) {
        NodeList nodeList = parentElement.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            final Node childNode = nodeList.item(i);
            if (childNode.getNodeType() == Node.ELEMENT_NODE) {
                final Element childElement = (Element) childNode;
                if (child.isTagNameEqual(childElement.getTagName())) {
                    return true;
                }

                if (childElement.hasChildNodes()) {
                    if (hasChildsOf(childElement, child)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
161545
@Override
    public boolean accepts(final MavenDependency dependency, final List<MavenDependency> dependenciesForResolution,
            final List<MavenDependency> dependencyAncestors) {
        if (bannedDependencies.contains(dependency)) {
            return false;
        }

        if (rejectTransitives) {
            if (dependencyAncestors != null && dependencyAncestors.size() != 0) {
                return dependencyAncestors.get(0).equals(dependency);
            }
        }

        return true;
    }
812507
public void setParents(java.util.Collection<Parent> parents) {
        if (parents == null) {
            this.parents = null;
            return;
        }

        this.parents = new java.util.ArrayList<Parent>(parents);
    }
1124806
private boolean ancestorIsTemplated(TypeElement type) {
        while (true) {
            TypeMirror parentMirror = type.getSuperclass();
            if (parentMirror.getKind() == TypeKind.NONE) {
                return false;
            }
            TypeElement parentElement = (TypeElement) typeUtils.asElement(parentMirror);
            if (parentElement.getAnnotation(Templated.class) != null) {
                return true;
            }
            type = parentElement;
        }
    }
769830
function isChild(child, parent) {
	while (child = child.parentNode) {
		if (child == parent) {
			return true;
		}
	}

	return false;
}
208031
def is_parent_of(self, parent, child):
        
        if parent == 'trunk':
            return True
        if child == 'trunk':
            return False
        if child not in self._branches:
            raise ValueError(
                "The branch {} seems not to have ever been created".format(
                    child
                )
            )
        if self._branches[child][0] == parent:
            return True
        return self.is_parent_of(parent, self._branches[child][0])
638418
private void setParentElement(Element parentElement) {
		synchronized(lock) {
			checkNotFrozen();
			if(this.parentElement != null) throw new IllegalStateException("parentElement already set");
			this.parentElement = parentElement;
		}
		assert checkPageAndParentElement();
	}
151586
@UiThread
    public void collapseParent(@NonNull P parent) {
        ExpandableWrapper<P, C> parentWrapper = new ExpandableWrapper<>(parent);
        int flatParentPosition = mFlatItemList.indexOf(parentWrapper);
        if (flatParentPosition == INVALID_FLAT_POSITION) {
            return;
        }

        collapseViews(mFlatItemList.get(flatParentPosition), flatParentPosition);
    }
937366
public boolean nextInnerElement(ElementContext parent, String childName) throws XMLException, IOException {
		while (nextInnerElement(parent)) {
			if (event.text.equals(childName))
				return true;
		}
		return false;
	}
1124386
public int setParent(Node parent)
    {
        if (parent != null)
        {
            depth = parent.getDepth() + 1;
        }
        this.parent = parent;
        return depth;
    }