private TypeDefinitionContainer getTypeDescendants(
        int depth,
        TypeDefinitionContainer tc,
        boolean includePropertyDefinitions) {

        TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl();

        TypeDefinition type = copyTypeDefintion(tc.getTypeDefinition());
        if (!includePropertyDefinitions) {
            type.getPropertyDefinitions().clear();
        }

        result.setTypeDefinition(type);

        if (depth != 0) {
            if (tc.getChildren() != null) {
                result.setChildren(new ArrayList<TypeDefinitionContainer>());
                for (TypeDefinitionContainer tdc : tc.getChildren()) {
                    result.getChildren().add(
                        getTypeDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions));
                }
            }
        }

        return result;
    }
private TypeDefinitionContainer getTypeDescendants ( int depth , TypeDefinitionContainer tc , boolean includePropertyDefinitions ) { TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl ( ) ; TypeDefinition type = copyTypeDefintion ( tc . getTypeDefinition ( ) ) ; if ( ! includePropertyDefinitions ) { type . getPropertyDefinitions ( ) . clear ( ) ; } result . setTypeDefinition ( type ) ; if ( depth != 0 ) { if ( tc . getChildren ( ) != null ) { result . setChildren ( new ArrayList < TypeDefinitionContainer > ( ) ) ; for ( TypeDefinitionContainer tdc : tc . getChildren ( ) ) { result . getChildren ( ) . add ( getTypeDescendants ( depth < 0 ? - 1 : depth - 1 , tdc , includePropertyDefinitions ) ) ; } } } return result ; }
Collects the descendants of a type.<p>

@param depth the depth up to which the descendants should be collected
@param tc the parent type
@param includePropertyDefinitions true if the property definitions should be included

@return the descendants of the type