text:
/* @internal */
namespace ts {
    export type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => (SymbolAccessibilityDiagnostic | undefined);

    export interface SymbolAccessibilityDiagnostic {
        errorNode: Node;
        diagnosticMessage: DiagnosticMessage;
        typeName?: DeclarationName | QualifiedName;
    }

    export type DeclarationDiagnosticProducing =
        | VariableDeclaration
        | PropertyDeclaration
        | PropertySignature
        | BindingElement
        | SetAccessorDeclaration
        | GetAccessorDeclaration
        | ConstructSignatureDeclaration
        | CallSignatureDeclaration
        | MethodDeclaration
        | MethodSignature
        | FunctionDeclaration
        | ParameterDeclaration
        | TypeParameterDeclaration
        | ExpressionWithTypeArguments
        | ImportEqualsDeclaration
        | TypeAliasDeclaration
        | ConstructorDeclaration
        | IndexSignatureDeclaration
        | PropertyAccessExpression
        | JSDocTypedefTag
        | JSDocCallbackTag
        | JSDocEnumTag;

    export function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing {
        return isVariableDeclaration(node) ||
            isPropertyDeclaration(node) ||
            isPropertySignature(node) ||
            isBindingElement(node) ||
            isSetAccessor(node) ||
            isGetAccessor(node) ||
            isConstructSignatureDeclaration(node) ||
            isCallSignatureDeclaration(node) ||
            isMethodDeclaration(node) ||
            isMethodSignature(node) ||
            isFunctionDeclaration(node) ||
            isParameter(node) ||
            isTypeParameterDeclaration(node) ||
            isExpressionWithTypeArguments(node) ||
            isImportEqualsDeclaration(node) ||
            isTypeAliasDeclaration(node) ||
            isConstructorDeclaration(node) ||
            isIndexSignatureDeclaration(node) ||
            isPropertyAccessExpression(node) ||
            isJSDocTypeAlias(node);
    }

    export function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing) {
        if (isSetAccessor(node) || isGetAccessor(node)) {
            return getAccessorNameVisibilityError;
        }
        else if (isMethodSignature(node) || isMethodDeclaration(node)) {
            return getMethodNameVisibilityError;
        }
        else {
            return createGetSymbolAccessibilityDiagnosticForNode(node);
        }
        function getAccessorNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) {
            const diagnosticMessage = getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult);
            return diagnosticMessage !== undefined ? {
                diagnosticMessage,
                errorNode: node,
                typeName: (node as NamedDeclaration).name
            } : undefined;
        }

        function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
            if (hasSyntacticModifier(node, ModifierFlags.Static)) {
                return symbolAccessibilityResult.errorModuleName ?
                    symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                        Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                        Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
            }
            else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
                return symbolAccessibilityResult.errorModuleName ?
                    symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                        Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                        Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
            }
            else {
                return symbolAccessibilityResult.errorModuleName ?
                    Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
            }
        }

        function getMethodNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic | undefined {
            const diagnosticMessage = getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult);
            return diagnosticMessage !== undefined ? {
                diagnosticMessage,
                errorNode: node,
                typeName: (node as NamedDeclaration).name
            } : undefined;
        }

        function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
            if (hasSyntacticModifier(node, ModifierFlags.Static)) {
                return symbolAccessibilityResult.errorModuleName ?
                    symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                        Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                        Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
            }
            else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
                return symbolAccessibilityResult.errorModuleName ?
                    symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                        Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                        Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1;
            }
            else {
                return symbolAccessibilityResult.errorModuleName ?
                    Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1;
            }
        }
    }

    export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing): GetSymbolAccessibilityDiagnostic {
        if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
            return getVariableDeclarationTypeVisibilityError;
        }
        else if (isSetAccessor(node) || isGetAccessor(node)) {
            return getAccessorDeclarationTypeVisibilityError;
        }
        else if (isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isIndexSignatureDeclaration(node)) {
            return getReturnTypeVisibilityError;
        }
        else if (isParameter(node)) {
            if (isParameterPropertyDeclaration(node, node.parent) && hasSyntacticModifier(node.parent, ModifierFlags.Private)) {
                return getVariableDeclarationTypeVisibilityError;
            }
            return getParameterDeclarationTypeVisibilityError;
        }
        else if (isTypeParameterDeclaration(node)) {
            return getTypeParameterConstraintVisibilityError;
        }
        else if (isExpressionWithTypeArguments(node)) {
            return getHeritageClauseVisibilityError;
        }
        else if (isImportEqualsDeclaration(node)) {
            return getImportEntityNameVisibilityError;
        }
        else if (isTypeAliasDeclaration(node) || isJSDocTypeAlias(node)) {
            return getTypeAliasDeclarationVisibilityError;
        }
        else {
            return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${(ts as any).SyntaxKind[(node as any).kind]}`);
        }

        function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) {
            if (node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement) {
                return symbolAccessibilityResult.errorModuleName ?
                    symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                        Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                        Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
                    Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
            }
            // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
            // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
            else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.PropertySignature ||
                (node.kind === SyntaxKind.Parameter && hasSyntacticModifier(node.parent, ModifierFlags.Private))) {
                // TODO(jfreeman): Deal with computed properties in error reporting.
                if (hasSyntacticModifier(node, ModifierFlags.Static)) {
                    return symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
                }
                else if (node.parent.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.Parameter) {
                    return symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1;
                }
                else {
                    // Interfaces cannot have types that cannot be named
                    return symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1;
                }
            }
        }

        function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic | undefined {
            const diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
            return diagnosticMessage !== undefined ? {
                diagnosticMessage,
                errorNode: node,
                typeName: (node as NamedDeclaration).name
            } : undefined;
        }

        function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
            let diagnosticMessage: DiagnosticMessage;
            if (node.kind === SyntaxKind.SetAccessor) {
                // Getters can infer the return type from the returned expression, but setters cannot, so the
                // "_from_external_module_1_but_cannot_be_named" case cannot occur.
                if (hasSyntacticModifier(node, ModifierFlags.Static)) {
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1;
                }
                else {
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_type_of_public_setter_0_from_exported_class_has_or_is_using_private_name_1;
                }
            }
            else {
                if (hasSyntacticModifier(node, ModifierFlags.Static)) {
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Return_type_of_public_static_getter_0_from_exported_class_has_or_is_using_private_name_1;
                }
                else {
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Return_type_of_public_getter_0_from_exported_class_has_or_is_using_private_name_1;
                }
            }
            return {
                diagnosticMessage,
                errorNode: (node as NamedDeclaration).name!,
                typeName: (node as NamedDeclaration).name
            };
        }

        function getReturnTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
            let diagnosticMessage: DiagnosticMessage;
            switch (node.kind) {
                case SyntaxKind.ConstructSignature:
                    // Interfaces cannot have return types that cannot be named
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
                        Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
                    break;

                case SyntaxKind.CallSignature:
                    // Interfaces cannot have return types that cannot be named
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
                        Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
                    break;

                case SyntaxKind.IndexSignature:
                    // Interfaces cannot have return types that cannot be named
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
                        Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
                    break;

                case SyntaxKind.MethodDeclaration:
                case SyntaxKind.MethodSignature:
                    if (hasSyntacticModifier(node, ModifierFlags.Static)) {
                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                            symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                                Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
                                Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
                            Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
                    }
                    else if (node.parent.kind === SyntaxKind.ClassDeclaration) {
                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                            symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                                Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
                                Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
                            Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0;
                    }
                    else {
                        // Interfaces cannot have return types that cannot be named
                        diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                            Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
                            Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
                    }
                    break;

                case SyntaxKind.FunctionDeclaration:
                    diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
                            Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 :
                        Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;
                    break;

                default:
                    return Debug.fail("This is unknown kind for signature: " + node.kind);
            }

            return {
                diagnosticMessage,
                errorNode: (node as NamedDeclaration).name || node
            };
        }

        function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic | undefined {
            const diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult);
            return diagnosticMessage !== undefined ? {
                diagnosticMessage,
                errorNode: node,
                typeName: (node as NamedDeclaration).name
            } : undefined;
        }

        function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult): DiagnosticMessage {
            switch (node.parent.kind) {
                case SyntaxKind.Constructor:
                    return symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;

                case SyntaxKind.ConstructSignature:
                case SyntaxKind.ConstructorType:
                    // Interfaces cannot have parameter types that cannot be named
                    return symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;

                case SyntaxKind.CallSignature:
                    // Interfaces cannot have parameter types that cannot be named
                    return symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;

                case SyntaxKind.IndexSignature:
                    // Interfaces cannot have parameter types that cannot be named
                    return symbolAccessibilityResult.errorModuleName ?
                        Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;

                case SyntaxKind.MethodDeclaration:
                case SyntaxKind.MethodSignature:
                    if (hasSyntacticModifier(node.parent, ModifierFlags.Static)) {
                        return symbolAccessibilityResult.errorModuleName ?
                            symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                                Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                                Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                            Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
                    }
                    else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
                        return symbolAccessibilityResult.errorModuleName ?
                            symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                                Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                                Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
                            Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
                    }
                    else {
                        // Interfaces cannot have parameter types that cannot be named
                        return symbolAccessibilityResult.errorModuleName ?
                            Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
                            Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
                    }

                case SyntaxKind.FunctionDeclaration:
                case SyntaxKind.FunctionType:
                    return symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
                case SyntaxKind.SetAccessor:
                case SyntaxKind.GetAccessor:
                    return symbolAccessibilityResult.errorModuleName ?
                        symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
                            Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
                            Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
                        Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;

                default:
                    return Debug.fail(`Unknown parent for parameter: ${(ts as any).SyntaxKind[node.parent.kind]}`);
            }
        }

        function getTypeParameterConstraintVisibilityError(): SymbolAccessibilityDiagnostic {
            // Type parameter constraints are named by user so we should always be able to name it
            let diagnosticMessage: DiagnosticMessage;
            switch (node.parent.kind) {
                case SyntaxKind.ClassDeclaration:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
                    break;

                case SyntaxKind.InterfaceDeclaration:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
                    break;

                case SyntaxKind.MappedType:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
                    break;

                case SyntaxKind.ConstructorType:
                case SyntaxKind.ConstructSignature:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
                    break;

                case SyntaxKind.CallSignature:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
                    break;

                case SyntaxKind.MethodDeclaration:
                case SyntaxKind.MethodSignature:
                    if (hasSyntacticModifier(node.parent, ModifierFlags.Static)) {
                        diagnosticMessage = Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
                    }
                    else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
                        diagnosticMessage = Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
                    }
                    else {
                        diagnosticMessage = Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
                    }
                    break;

                case SyntaxKind.FunctionType:
                case SyntaxKind.FunctionDeclaration:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
                    break;

                case SyntaxKind.TypeAliasDeclaration:
                    diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
                    break;

                default:
                    return Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
            }

            return {
                diagnosticMessage,
                errorNode: node,
                typeName: (node as NamedDeclaration).name
            };
        }

        function getHeritageClauseVisibilityError(): SymbolAccessibilityDiagnostic {
            let diagnosticMessage: DiagnosticMessage;
            // Heritage clause is written by user so it can always be named
            if (isClassDeclaration(node.parent.parent)) {
                // Class or Interface implemented/extended is inaccessible
                diagnosticMessage = isHeritageClause(node.parent) && node.parent.token === SyntaxKind.ImplementsKeyword ?
                    Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
                        node.parent.parent.name ? Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 :
                            Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0;
            }
            else {
                // interface is inaccessible
                diagnosticMessage = Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1;
            }

            return {
                diagnosticMessage,
                errorNode: node,
                typeName: getNameOfDeclaration(node.parent.parent as Declaration)
            };
        }

        function getImportEntityNameVisibilityError(): SymbolAccessibilityDiagnostic {
            return {
                diagnosticMessage: Diagnostics.Import_declaration_0_is_using_private_name_1,
                errorNode: node,
                typeName: (node as NamedDeclaration).name
            };
        }

        function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic {
            return {
                diagnosticMessage: symbolAccessibilityResult.errorModuleName
                    ? Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1_from_module_2
                    : Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,
                errorNode: isJSDocTypeAlias(node) ? Debug.checkDefined(node.typeExpression) : (node as TypeAliasDeclaration).type,
                typeName: isJSDocTypeAlias(node) ? getNameOfDeclaration(node) : (node as TypeAliasDeclaration).name,
            };
        }
    }
}


text:
#import "FBLogCommands.h"

#import "FBLaunchedProcess.h"

@implementation FBProcessLogOperation

@synthesize consumer = _consumer;

- (instancetype)initWithProcess:(FBLaunchedProcess *)process consumer:(id<FBDataConsumer>)consumer
{
  self = [self init];
  if (!self) {
    return nil;
  }

  _process = process;
  _consumer = consumer;

  return self;
}

- (FBFuture<NSNull *> *)completed
{
  return [self.process.statLoc mapReplace:NSNull.null];
}

+ (NSArray<NSString *> *)osLogArgumentsInsertStreamIfNeeded:(NSArray<NSString *> *)arguments
{
  NSString *firstArgument = arguments.firstObject;
  if (!firstArgument) {
    return @[@"stream"];
  }
  if ([self.osLogSubcommands containsObject:firstArgument]) {
    return arguments;
  }
  return [@[@"stream"] arrayByAddingObjectsFromArray:arguments];
}

#pragma mark Private

+ (NSSet<NSString *> *)osLogSubcommands
{
  static dispatch_once_t onceToken;
  static NSSet<NSString *> *subcommands;
  dispatch_once(&onceToken, ^{
    subcommands = [NSSet setWithArray:@[
      @"collect",
      @"config",
      @"erase",
      @"show",
      @"stream",
      @"stats",
    ]];
  });
  return subcommands;
}

@end

redpajama_set_name: RedPajamaGithub


text:
var React = require('react/addons');
var Lab = require('lab');
var Code = require('code');
var Proxyquire = require('proxyquire');
var Moment = require('moment');

var lab = exports.lab = Lab.script();
var TestUtils = React.addons.TestUtils;
var stub = {
  Actions: {}
};
var Form = Proxyquire('../../../../../../client/pages/admin/components/accounts/NoteForm', {
  '../../actions/Account': stub.Actions
});
var mockProps;

lab.beforeEach(function (done) {

  mockProps = {
    details: {
      notes: []
    },
    data: {
      name: {},
      hasError: {},
      help: {}
    }
  };

  done();
});

lab.experiment('Admin Account Note Form', function () {

  lab.test('it renders normally', function (done) {

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);

    Code.expect(form).to.exist();
    done();
  });

  lab.test('it handles unmounting', function (done) {

    var container = global.document.createElement('div');
    var FormEl = React.createElement(Form, mockProps);

    React.render(FormEl, container);
    React.unmountComponentAtNode(container);

    done();
  });

  lab.test('it renders when notes is undefined', function (done) {

    mockProps.details.hydrated = true;
    delete mockProps.details.notes;

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);

    Code.expect(form).to.exist();
    done();
  });

  lab.test('it renders when notes has items', function (done) {

    mockProps.details.hydrated = true;
    mockProps.details.notes = [
      {
        userCreated: {},
        moment: Moment('2014-02-14 17:39:00'),
        timeCreated: '2014-02-14 17:39:00'
      }
    ];

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);

    Code.expect(form).to.exist();
    done();
  });

  lab.test('it updates state when receiving new props when hydrated is false', function (done) {

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);

    mockProps.details.hydrated = true;
    form.setProps(mockProps);

    mockProps.details.hydrated = true;
    form.setProps(mockProps);

    Code.expect(form).to.exist();
    done();
  });

  lab.test('it handles a submit event', function (done) {

    stub.Actions.newNote = function () {

      done();
    };

    mockProps.details.hydrated = true;

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);
    var formTag = TestUtils.findRenderedDOMComponentWithTag(form, 'form');

    TestUtils.Simulate.submit(formTag.getDOMNode());
  });

  lab.test('it renders with success state', function (done) {

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);

    mockProps.details.hydrated = true;
    mockProps.data.success = true;
    form.setProps(mockProps);

    var alerts = TestUtils.scryRenderedDOMComponentsWithClass(form, 'alert-success');

    Code.expect(alerts.length).to.equal(1);
    done();
  });

  lab.test('it renders with error state', function (done) {

    var FormEl = React.createElement(Form, mockProps);
    var form = TestUtils.renderIntoDocument(FormEl);

    mockProps.details.hydrated = true;
    mockProps.data.error = 'Whoops.';
    form.setProps(mockProps);

    var alerts = TestUtils.scryRenderedDOMComponentsWithClass(form, 'alert-danger');

    Code.expect(alerts.length).to.equal(1);
    done();
  });
});


text:
using System;
using System.Collections;
using System.ComponentModel;
using System.Reflection;
using ExpandableObjectManager.Internal;

namespace ExpandableObjectManager
{
    public static class TypeDescriptors
    {
        #region "Public methods"

        public static void Add(Type tItem)
        {
            Type tConverter = GetConverterForType(tItem);
            TypeDescriptor.AddAttributes(tItem, new TypeConverterAttribute(tConverter));
        }

        public static void Add()
        {
            var assembly = Assembly.GetExecutingAssembly();
            Add(assembly);
        }

        public static void Add(Assembly assembly)
        {
            Add(assembly, null);
        }

        public static void Add(Assembly assembly, string filter)
        {
            foreach (Type tpCurrent in assembly.GetTypes())
            {
                string sNamespace = tpCurrent.Namespace;

                if (IncludeType(sNamespace, filter))
                {
                    Add(tpCurrent);
                }
            }
        }

        #endregion

        #region "Private methods"

        private static bool IncludeType(string sNamespace, string filter)
        {
            if (sNamespace == null)
            {
                return false;
            }

            if (string.IsNullOrWhiteSpace(filter))
            {
                return true;
            }

            return sNamespace.StartsWith(filter);
        }

        private static Type GetConverterForType(Type tItem)
        {
            if (typeof(IList).IsAssignableFrom(tItem))
            {
                return typeof(ExpandableCollectionConverter);
            }
            else
            {
                return typeof(ExpandableObjectConverter);
            }
        }

        #endregion
    }
}


text:
// <copyright company="eXtensoft, LLC" file="eXtensibleStrategyElement.cs">
// Copyright © 2016 All Right Reserved
// </copyright>

namespace XF.Common
{
    using System.Configuration;

    public sealed class eXtensibleStrategyElement : ConfigurationElement
    {
        public eXtensibleStrategyElement()
        {
        }

        [ConfigurationProperty(ConfigConstants.StrategyNameAttributeName, IsRequired = true)]
        public string Name
        {
            get { return (string)this[ConfigConstants.StrategyNameAttributeName]; }
            set { this[ConfigConstants.StrategyNameAttributeName] = value; }
        }

        [ConfigurationProperty(ConfigConstants.StrategyTypeAttributeName, IsRequired = false, DefaultValue = StrategyTypeOption.KeyPair)]
        public StrategyTypeOption StrategyType
        {
            get { return (StrategyTypeOption)this[ConfigConstants.StrategyTypeAttributeName]; }
            set { this[ConfigConstants.StrategyTypeAttributeName] = value.ToString(); }
        }

        [ConfigurationProperty(ConfigConstants.StrategyValueAttributeName, IsRequired = false)]
        public string StrategyValue
        {
            get { return (string)this[ConfigConstants.StrategyValueAttributeName]; }
            set { this[ConfigConstants.StrategyValueAttributeName] = value; }
        }

        [ConfigurationProperty(ConfigConstants.StrategyResolutionAttributeName, IsRequired = true)]
        public string Resolution
        {
            get { return (string)this[ConfigConstants.StrategyResolutionAttributeName]; }
            set { this[ConfigConstants.StrategyResolutionAttributeName] = value; }
        }
    }
}


text:
@interface hotTableViewCell ()

@property (strong, nonatomic) IBOutlet UIImageView *MainImageView;

@property (strong, nonatomic) IBOutlet UILabel *FavoriteLable;

@end

@implementation hotTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
-(void)setModel:(hotActivityModel *)model{
    [self.MainImageView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil];
    self.FavoriteLable.text = model.acticityId;

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end


text:
import logging

from multiprocessing import get_context

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())

context = get_context()
# Useful for multiprocessing debugging:
# context.log_to_stderr(logging.DEBUG)

class StoppableProcess(context.Process):
    """ Base class for Processes which require the ability
    to be stopped by a process-safe method call
    """

    def __init__(self):
        super().__init__()
        self._should_stop = context.Event()
        self._should_stop.clear()

    def join(self, timeout=0):
        """ Joins the current process and forces it to stop after
        the timeout if necessary

        :param timeout: Timeout duration in seconds
        """
        self._should_stop.wait(timeout)
        if not self.should_stop():
            self.stop()
        return super().join(0)

    def stop(self):
        self._should_stop.set()

    def should_stop(self):
        return self._should_stop.is_set()

    def __repr__(self):
        return "<%s(should_stop=%s)>" % (
            self.__class__.__name__, self.should_stop())


text:
package com.sabre.oss.conf4j.converter;

import java.lang.reflect.Type;
import java.util.Map;

/**
 * Adapts string value to given type.
 *

 * Converter must be thread safe, symmetric and stateless.
 * It should provide immutable values, wherever possible, because values may be cached and reused.
 *

 *
 * @param <T> The type that this type converter handles.
 */
public interface TypeConverter<T> {

    /**
     * Check if the type converter is applicable for type {@code type}.
     *
     * @param type       actual type definition.
     * @param attributes additional meta-data attributes which may be used by converter. It can be {@code null}.
     * @return {@code true} when this type converter is applicable for a given type definition.
     * @throws NullPointerException when {@code type} is {@code null}.
     */
    boolean isApplicable(Type type, Map<String, String> attributes);

    /**
     * Converts String to the target type.
     *
     * @param type       actual type definition.
     * @param value      string representation of the value which is converted to {@code T}.
     *                   In case it is {@code null}, the converter should return either {@code null} or a value
     *                   that is equivalent (for example an empty list).
     * @param attributes additional meta-data attributes which may be used by converter. It can be {@code null}.
     * @return value converted to type {@code T}.
     * @throws IllegalArgumentException when {@code value} cannot be converted to {@code T}.
     * @throws NullPointerException     when {@code type} is {@code null}.
     */
    T fromString(Type type, String value, Map<String, String> attributes);

    /**
     * Converts value from target type to String.
     *
     * @param type       actual type definition.
     * @param value      value that needs to be converted to string.
     * @param attributes additional meta-data attributes which may be used by converter. It can be {@code null}.
     * @return string representation of the {@code value}.
     * @throws IllegalArgumentException {@code value} cannot be converted to string.
     * @throws NullPointerException     when {@code type} is {@code null}.
     */
    String toString(Type type, T value, Map<String, String> attributes);
}


text:
           <form class="search-form form-inline" role="form" action="/">

                   Search the knowledge base
                   <input type="search" class="form-control input-lg" name="search" id="home-search" size="50" placeholder="Search the knowledge base">
                   <button type="submit" class="btn btn-primary btn-lg">Search</button>

           </form>

            	{{#pages}}
            		{{#is_index}}
            			{{#files.length}}

Main Articles

            						{{#files}}

{{title}}
{{description}}

            						{{/files}}

            			{{/files.length}}
            		{{/is_index}}
            		{{^is_index}}

{{title}}

            					{{#files}}

{{title}}

            					{{/files}}

            		{{/is_index}}
            	{{/pages}}

                {{#config.support_email}}

                     Still need help? Get in touch!

                {{/config.support_email}}


text:
#include <kafkalite.h>
#include "kltopictests.h"
// DO NOT INCLUDE THIS OUTSIDE TESTS
#include "../src/klprivate.h"

static const long NUM_MESSAGES = 1000000;

typedef struct KLTopicTests {
	KLContext *context;
} KLTopicTests;

int kl_topic_tests_setup(void **state) {
	// remove the test dir
	kl_rmdirs(TEST_DIR);
	KLTopicTests *tc = calloc(1, sizeof(KLTopicTests));
	tc->context = kl_context_open(TEST_DIR, NULL);
	*state = tc;
	return 0;
}

int kl_topic_tests_teardown(void **state) {
	KLTopicTests *tc = *state;
	kl_context_close(tc->context);
	free(tc);
	*state = NULL;
	return 0;
}

/**
 * Publish a message to a topic and see its count go up.
 */
void test_kl_topic_publish(void **state)
{
	KLTopicTests *tc = *state;
    KLTopic *topic = kl_topic_open(tc->context, "topic2");

    kl_topic_publish(topic, "hello world", strlen("hello world"));
    assert_true(kl_topic_message_count(topic) == 1);
    kl_topic_publish(topic, "hello world2", strlen("hello world2"));
    assert_true(kl_topic_message_count(topic) == 2);
}

/**
 * Test publishing large number of messages with no locking.
 */
void test_kl_topic_publish_load(void **state)
{
	KLTopicTests *tc = *state;
    KLTopic *topic = kl_topic_open(tc->context, "topic");
    long long timeTaken = publishMessages(topic, NUM_MESSAGES, 0, false);
    kl_log("\nElapsed Time for %ld messages: %lld", NUM_MESSAGES, timeTaken);
}

/**
 * Test publishing large number of messages with pthread locking.
 */
void test_kl_topic_publish_load_with_locking(void **state)
{
	KLTopicTests *tc = *state;
    tc->context = kl_context_open(TEST_DIR, kl_pthread_lock_manager());
    KLTopic *topic = kl_topic_open(tc->context, "topic");
    long long timeTaken = publishMessages(topic, NUM_MESSAGES, 0, false);
    kl_log("\nElapsed Time for %ld messages: %lld", NUM_MESSAGES, timeTaken);
}

/**
 * Test that a publish persists data on a restart.
 */
void test_kl_topic_restart(void **state)
{
	KLTopicTests *tc = *state;
    KLTopic *topic = kl_topic_open(tc->context, "topic2");
    kl_topic_publish(topic, "hello world", strlen("hello world"));
    kl_topic_publish(topic, "hello world2", strlen("hello world2"));
    assert_true(kl_topic_message_count(topic) == 2);

    // now close the context and open it again
    kl_context_close(tc->context);

    tc->context = kl_context_open(TEST_DIR, NULL);
    topic = kl_topic_open(tc->context, "topic2");
    assert_true(kl_topic_message_count(topic) == 2);
}

/**
 * Test getting of message metadata.
 *
 * Test getting message metadata when they are split between disk and in memory
 * buffer.
 */
void test_kl_topic_get_message_metadata(void **state)
{
    // write enough messages that they are
    const int msgsize = 40;
    const char *message = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 - %03d";
    char msgbuff[50];

	KLTopicTests *tc = *state;
    KLTopic *topic = kl_topic_open(tc->context, "topic");
    topic->flushThreshold = 4 * (sizeof(KLMessageHeader) + msgsize);
    kl_buffer_destroy(topic->dataBuffer);
    kl_buffer_destroy(topic->indexBuffer);
    topic->dataBuffer = kl_buffer_new(4 * (sizeof(KLMessageHeader) + msgsize));
    topic->indexBuffer = kl_buffer_new(4 * (sizeof(KLMessageMetadata)));

    for (int i = 0;i < 7;i++)
    {
        sprintf(msgbuff, "%s%d", message, i);
        int len = strlen(msgbuff);
        assert_true(len == msgsize);
        kl_topic_publish(topic, msgbuff, len);
    }

    // now 4 messages should be on disk and 3 on the buffer
    assert_true(topic->flushedAtIndex == 4);
    assert_true(topic->flushedAtOffset == 4 * (sizeof(KLMessageHeader) + msgsize));
    assert_true(topic->currOffset == 7 * (sizeof(KLMessageHeader) + msgsize));
    assert_true(topic->currIndex == 7);
    assert_true(kl_buffer_size(topic->dataBuffer) == 3 * (sizeof(KLMessageHeader) + msgsize));

    // Now start reading
    // read 1 - everything is on disk
	KLMessageMetadata metadatas[16];
	size_t nRead = kl_topic_get_message_metadata(topic, 1, metadatas, 3);
	assert_true(nRead == 3);

	nRead = kl_topic_get_message_metadata(topic, 5, metadatas, 2);
	assert_true(nRead == 2);

	nRead = kl_topic_get_message_metadata(topic, 0, metadatas, 10);
	assert_true(nRead == 7);

    kl_topic_close(topic);
}

int run_topic_tests()
{
	const struct CMUnitTest tests[] = {
		cmocka_unit_test_setup_teardown(test_kl_topic_publish, kl_topic_tests_setup, kl_topic_tests_teardown),
		// cmocka_unit_test_setup_teardown(test_kl_topic_publish_load, kl_topic_tests_setup, kl_topic_tests_teardown),
		// cmocka_unit_test_setup_teardown(test_kl_topic_publish_load_with_locking, kl_topic_tests_setup, kl_topic_tests_teardown),
		cmocka_unit_test_setup_teardown(test_kl_topic_restart, kl_topic_tests_setup, kl_topic_tests_teardown),
		cmocka_unit_test_setup_teardown(test_kl_topic_get_message_metadata, kl_topic_tests_setup, kl_topic_tests_teardown),
	};
	return cmocka_run_group_tests(tests, NULL, NULL);
}


text:
<!DOCTYPE html>
<!--
Copyright (c) 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/core/trace_model/timed_event.html">

<script>
'use strict';

/**
 * @fileoverview Provides the Flow class.
 */
tv.exportTo('tv.c.trace_model', function() {
  /**
   * A Flow represents an interval of time plus parameters associated
   * with that interval.
   *
   * @constructor
   */
  function FlowEvent(category, id, title, colorId, start, args) {
    tv.c.trace_model.TimedEvent.call(this, start);

    this.category = category || '';
    this.title = title;
    this.colorId = colorId;
    this.start = start;
    this.args = args;

    this.id = id;

    this.nextFlowEvent_ = undefined;
    this.previousFlowEvent_ = undefined;
  }

  FlowEvent.prototype = {
    __proto__: tv.c.trace_model.TimedEvent.prototype,

    set nextFlowEvent(nextFlowEvent) {
      this.nextFlowEvent_ = nextFlowEvent;
    },

    set previousFlowEvent(prev) {
      this.previousFlowEvent_ = prev;
    },

    get nextFlowEvent() {
      return this.nextFlowEvent_;
    },

    get previousFlowEvent() {
      return this.previousFlowEvent_;
    }
  };

  tv.c.trace_model.EventRegistry.register(
      FlowEvent,
      {
        name: 'flowEvent',
        pluralName: 'flowEvents',
        singleViewElementName: 'tv-c-single-flow-event-sub-view',
        multiViewElementName: 'tv-c-multi-flow-event-sub-view'
      });

  return {
    FlowEvent: FlowEvent
  };
});
</script>


text:
> **Deprecated** — use [redux](https://www.npmjs.com/package/redux) instead; it works pretty much just like uflux and is better supported.

----

# μflux

**uflux** - Another implementation for the Flux architecture for React apps that pushes minimalism far.

* Store works with immutable objects
* Unidirectional flow

But also:

* Reduced verbosity. no action constants, no action methods. To fire a method, just emit a signal from the disptacher.

See [API.md](API.md) for full API documentation.

[![Status](https://travis-ci.org/rstacruz/uflux.svg?branch=master)](https://travis-ci.org/rstacruz/uflux "See test builds")

## Usage

When used via npm/bower/browserify/webpack/etc:

```js
import { Dispatcher, Store, connectToStores } from 'uflux'
```

### Composition

Your application will be composed of:

* One and only one Dispatcher singleton.
* Many stores (singletons), each listening to the one Dispatcher.
* Many React components, with some listening to changes to one or more stores.

### Dispatcher

A disptacher is simply an [EventEmitter].

```js
const App = new Dispatcher()

App.on('eventname', function () { ... })
App.emit('eventname')
App.emit('eventname', arg1, arg2)
```

[EventEmitter]: http://devdocs.io/iojs/events#events_class_events_eventemitter

### Store

A store is an object that keeps a state and listens to dispatcher events.
Create a new store using `new Store(dispatcher, initialState, handlers)`.

It listens to events from the dispatcher and responds by updating the store's state.

Each handler is a pure function that takes in the `state` and returns the new
state—no mutation should be done here.

```js
const ListStore = new Store(App, {
  items: []
}, {
  'list:add': function (state, item) {
    return {
      ...state,
      items: state.items.concat([ item ])
    }
  }
})

App.emit('list:add', '2')
ListStore.getState() /* { items: [2] } */
```

### Actions

To fire an action, just emit directly on your main dispatcher. No need for action methods.

```js
App.emit('list:add')
```

If you're firing within an event listener (such as in a store), you can use `emitAfter()` to make the event trigger after all other events have triggered.

```js
const DiceStore = new Store(App, { }, {
  'dice:roll': function (state) {
    App.emitAfter('dice:refresh')
    return { number: Math.floor(Math.random() * 6) + 1 }
  }
})
```

### React

You can connect a react Component to a store using `connectToStores()`. The
state of the store will be available as properties (`this.props`).

```js
const ListView = React.createClass({
  statics: {
    getStores () {
      return [ ListStore ]
    },

    getPropsFromStores() {
      return ListStore.getState()
    }
  },
  render () {
    return <div>hi, {this.props.name}</div>
  }

})

ListView = connectToStores(ListView)
```

### Chaining events

You can emit events inside handlers. They will be fired after committing the new state to the store.

```js
const ListStore = new Store(App, {
  items: []
}, {
  'list:add': function (state, item) {
    if (state.locked) {
      const err = new Error('List is locked')
      App.emit('list:error', err)
      return { ...state, error: err }
    }
  }
})

App.on('list:error', function (err) {
  console.log(err.message) //=> "List is locked"
  console.log(ListStore.getState().error.message) //=> "List is locked"
})
```

### Testing stores

Create unit tests for stores by duplicating it and assigning it to a new dispatcher via `.dup()`.

```js
const ListStore = new Store(...)

const App = new Dispatcher()
const TestListStore = ListStore.dup(App)

App.emit('list:clear')
// ...will only be received by TestListStore, not ListStore.
```

## API

See [API.md](API.md) for full API documentation.

Unresolved API questions:

 * should we allow naming stores? this'd be a great way to make a global "save state" for your entire app
 * atomicity - is it possible?
 * can/should components listen to dispatch events?
 * is there a better function signature for new Store()?
 * what about stores that need to interact with each other (say AuthenticationStore)?
 * it should be possible to debounce store change events (eg, a chain of dispatch events that modify stores). but how?
 * ...post yours in [issues/](issues/)

## Extra notes

### Regular usage

> [](#version) `<script src="https://cdn.rawgit.com/rstacruz/uflux/v0.8.0/dist/index.js"></script>`

```js
var Store = window.uflux.Store
var Dispatcher = window.uflux.Dispatcher
var connectToStores = window.uflux.connectToStores
```

### Babel

Using [Babel] is recommended for JSX parsing and enabling ES2015 features.
`--stage 0` is recommended, too, for rest spreading support (`{ ...state, active:
  true }`)—a feature very useful for Stores.

[Babel]: https://babeljs.io

## Disclaimer

This is built as a proof-of-concept and has not been battle-tested in a production setup.

## Thanks

**uflux** © 2015+, Rico Sta. Cruz. Released under the [MIT] License.

Authored and maintained by Rico Sta. Cruz with help from contributors ([list][contributors]).

> [ricostacruz.com](http://ricostacruz.com)  ·
> GitHub [@rstacruz](https://github.com/rstacruz)  ·
> Twitter [@rstacruz](https://twitter.com/rstacruz)

[MIT]: http://mit-license.org/
[contributors]: http://github.com/rstacruz/uflux/contributors


text:
package router

import (
	"fmt"

	pb "github.com/TheThingsNetwork/ttn/api/router"
	"github.com/TheThingsNetwork/ttn/utils/errors"
	"golang.org/x/net/context" // See https://github.com/grpc/grpc-go/issues/711"
	"google.golang.org/grpc"
)

type routerManager struct {
	router *router
}

func (r *routerManager) GatewayStatus(ctx context.Context, in *pb.GatewayStatusRequest) (*pb.GatewayStatusResponse, error) {
	if in.GatewayId == "" {
		return nil, errors.NewErrInvalidArgument("Gateway Status Request", "ID is required")
	}
	_, err := r.router.ValidateTTNAuthContext(ctx)
	if err != nil {
		return nil, errors.NewErrPermissionDenied("No access")
	}
	r.router.gatewaysLock.RLock()
	gtw, ok := r.router.gateways[in.GatewayId]
	r.router.gatewaysLock.RUnlock()
	if !ok {
		return nil, errors.NewErrNotFound(fmt.Sprintf("Gateway %s", in.GatewayId))
	}
	status, err := gtw.Status.Get()
	if err != nil {
		return nil, err
	}
	return &pb.GatewayStatusResponse{
		LastSeen: gtw.LastSeen.UnixNano(),
		Status:   status,
	}, nil
}

func (r *routerManager) GetStatus(ctx context.Context, in *pb.StatusRequest) (*pb.Status, error) {
	if r.router.Identity.Id != "dev" {
		claims, err := r.router.ValidateTTNAuthContext(ctx)
		if err != nil {
			return nil, errors.Wrap(err, "No access")
		}
		if !claims.ComponentAccess(r.router.Identity.Id) {
			return nil, errors.NewErrPermissionDenied(fmt.Sprintf("Claims do not grant access to %s", r.router.Identity.Id))
		}
	}
	status := r.router.GetStatus()
	if status == nil {
		return new(pb.Status), nil
	}
	return status, nil
}

// RegisterManager registers this router as a RouterManagerServer (github.com/TheThingsNetwork/ttn/api/router)
func (r *router) RegisterManager(s *grpc.Server) {
	server := &routerManager{r}
	pb.RegisterRouterManagerServer(s, server)
}


text:
namespace nwc_toolkit {

template <typename T, typename LessThan = std::less<T> >
class HeapQueue {
 public:
  HeapQueue() : buf_() {}
  ~HeapQueue() {}

  const T &top() const {
    return buf_[root_index()];
  }

  bool is_empty() const {
    return buf_.empty();
  }
  std::size_t num_objs() const {
    return buf_.size();
  }

  void Clear() {
    buf_.clear();
  }

  void Enqueue(const T &value);
  void Dequeue();

  // Equivalent to Dequeue() + Enqueue().
  void Replace(const T &value);

 private:
  std::vector<T> buf_;

  static std::size_t root_index() {
    return 0;
  }
  static std::size_t GetParentIndex(std::size_t index) {
    return (index - 1) / 2;
  }
  static std::size_t GetLeftChildIndex(std::size_t index) {
    return (index * 2) + 1;
  }

  // Disallows copy and assignment.
  HeapQueue(const HeapQueue &);
  HeapQueue &operator=(const HeapQueue &);
};

template <typename T, typename LessThan>
void HeapQueue<T, LessThan>::Enqueue(const T &value) {
  std::size_t index = buf_.size();
  buf_.resize(buf_.size() + 1);
  while (index > root_index()) {
    std::size_t parent_index = GetParentIndex(index);
    if (!LessThan()(value, buf_[parent_index])) {
      break;
    }
    buf_[index] = buf_[parent_index];
    index = parent_index;
  }
  buf_[index] = value;
}

template <typename T, typename LessThan>
void HeapQueue<T, LessThan>::Dequeue() {
  const T &value = buf_.back();
  Replace(value);
  buf_.pop_back();
}

template <typename T, typename LessThan>
void HeapQueue<T, LessThan>::Replace(const T &value) {
  std::size_t index = root_index();
  for ( ; ; ) {
    std::size_t child_index = GetLeftChildIndex(index);
    if (child_index >= buf_.size()) {
      break;
    }
    if ((child_index + 1 < buf_.size()) &&
      LessThan()(buf_[child_index + 1], buf_[child_index])) {
      ++child_index;
    }
    if (!LessThan()(buf_[child_index], value)) {
      break;
    }
    buf_[index] = buf_[child_index];
    index = child_index;
  }
  buf_[index] = value;
}

}  // namespace nwc_toolkit

#endif  // NWC_TOOLKIT_HEAP_QUEUE_H_


text:
<?php namespace Altenia\Ecofy\Dao\Schema;

/**
 * Generic Data Type.
 */
class DataType {

	const TYPE_DATETIME = 'DateTime';
	const TYPE_STRING = 'String';
	const TYPE_NUMERIC = 'Numeric';

	public $name;
	public $isNullable = false;
	public $size;
	public $attribs;

	public function __construct($name, $attribs)
    {
    	$this->name = $name;
    	$this->attribs = $attribs;
    	if (!empty($attribs) && array_key_exists('is_nullable', $attribs)) {
    		$this->isNullable = $attribs['is_nullable'];
    	}
    }

    public function getName()
    {
    	return $this->name;
    }

}


text:
package envstr

import (
	"sort"
	"strings"
)

var replacer = strings.NewReplacer(`\`, `\\`, `=`, `\=`, `;`, `\;`)

// Encode an environment map in a way that is safe to compare,
// to know if the environemnt is the same or not
func Encode(env map[string]string) string {
	list := make([]string, len(env))
	i := 0
	for k, v := range env {
		list[i] = replacer.Replace(k) + "=" + replacer.Replace(v)
		i++
	}
	sort.Strings(list)
	return strings.Join(list, ";")
}


text:
module Jdbc
  module MySQL
    DRIVER_VERSION = '8.0.17'
    VERSION = DRIVER_VERSION
  end
end


text:
<!DOCTYPE html>

    <title>Long, Broad, and Quickeye | The Grey Fairy Book | Andrew Lang | Lit2Go ETC</title>
    <link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/screenless.css" type="text/css" media="screen" title="no title" charset="utf-8">
    <link rel="stylesheet" href="http://etc.usf.edu/lit2go/css/printless.css" type="text/css" media="print" title="no title" charset="utf-8">

          Lit2Go

<form action="http://etc.usf.edu/lit2go/search/"><input type="text" name="q" placeholder="Search" value=""></form>

Authors

Books

Genres

Collections

Readability

      The Grey Fairy Book

      by Andrew Lang

    Long, Broad, and Quickeye

    by Andrew Lang

        Additional Information

            Year Published:
            1906

            Language:
            English

            Country of Origin:
            England

            Source:
            Lang, A. (Ed.). (1906). The Brown Fairy Book. London: Longmans, Green & Co.

            Readability:

                Flesch–Kincaid Level:
                4.0

            Word Count:
            3,663

            Genre:
            Fairy Tale/Folk Tale

            Keywords:
            love, magic

            ✎ Cite This

  Share
  |

Downloads

          Audio

Student Activity

            APA

            MLA

            Chicago

            Lang, A. (1906). Long, Broad, and Quickeye. The Grey Fairy Book (Lit2Go Edition). Retrieved February 15, 2016, from http://etc.usf.edu/lit2go/143/the-grey-fairy-book/5045/long-broad-and-quickeye/

            Lang, Andrew. "Long, Broad, and Quickeye." The Grey Fairy Book. Lit2Go Edition. 1906. Web. <http://etc.usf.edu/lit2go/143/the-grey-fairy-book/5045/long-broad-and-quickeye/>. February 15, 2016.

            Andrew Lang, "Long, Broad, and Quickeye," The Grey Fairy Book, Lit2Go Edition, (1906), accessed February 15, 2016, http://etc.usf.edu/lit2go/143/the-grey-fairy-book/5045/long-broad-and-quickeye/.

Back

Next

                  <audio controls style="width:99%;">
            <source src="http://etc.usf.edu/lit2go/audio/mp3/the-grey-fairy-book-004-long-broad-and-quickeye.5045.mp3" type="audio/mpeg" />
                          <source src="http://etc.usf.edu/lit2go/audio/ogg/the-grey-fairy-book-004-long-broad-and-quickeye.5045.ogg" type="audio/ogg" />
                        The embedded audio player requires a modern internet browser. You should visit Browse Happy and update your internet browser today!
          </audio>

	Once upon a time there lived a king who had an only son whom he loved dearly. Now one day the king sent for his son and said to him:

	‘My dearest child, my hair is grey and I am old, and soon I shall feel no more the warmth of the sun, or look upon the trees and flowers. But before I die I should like to see you with a good wife; therefore marry, my son, as speedily as possible.'

	‘My father,' replied the prince, ‘now and always, I ask nothing better than to do your bidding, but I know of no daughter-in-law that I could give you.'

	On hearing these words the old king drew from his pocket a key of gold, and gave it to his son, saying:

	‘Go up the staircase, right up to the top of the tower. Look carefully round you, and then come and tell me which you like best of all that you see.'

	So the young man went up. He had never before been in the tower, and had no idea what it might contain.

	The staircase wound round and round and round, till the prince was almost giddy, and every now and then he caught sight of a large room that opened out from the side. But he had been told to go to the top, and to the top he went. Then he found himself in a hall, which had an iron door at one end. This door he unlocked with his golden key, and he passed through into a vast chamber which had a roof of blue sprinkled with golden stars, and a carpet of green silk soft as turf. Twelve windows framed in gold let in the light of the sun, and on every window was painted the figure of a young girl, each more beautiful than the last. While the prince gazed at them in surprise, not knowing which he liked best, the girls began to lift their eyes and smile at him. He waited, expecting them to speak, but no sound came.

	Suddenly he noticed that one of the windows was covered by a curtain of white silk.

	He lifted it, and saw before him the image of a maiden beautiful as the day and sad as the tomb, clothed in a white robe, having a girdle of silver and a crown of pearls. The prince stood and gazed at her, as if he had been turned into stone, but as he looked the sadness which, was on her face seemed to pass into his heart, and he cried out:

	‘This one shall be my wife. This one and no other.'

	As he said the words the young girl blushed and hung her head, and all the other figures vanished.

	The young prince went quickly back to his father, and told him all he had seen and which wife he had chosen. The old man listened to him full of sorrow, and then he spoke:

	‘You have done ill, my son, to search out that which was hidden, and you are running to meet a great danger. This young girl has fallen into the power of a wicked sorcerer, who lives in an iron castle. Many young men have tried to deliver her, and none have ever come back. But what is done is done! You have given your word, and it cannot be broken. Go, dare your fate, and return to me safe and sound.'

	So the prince embraced his father, mounted his horse, and set forth to seek his bride. He rode on gaily for several hours, till he found himself in a wood where he had never been before, and soon lost his way among its winding paths and deep valleys. He tried in vain to see where he was: the thick trees shut out the sun, and he could not tell which was north and which was south, so that he might know what direction to make for. He felt in despair, and had quite given up all hope of getting out of this horrible place, when he heard a voice calling to him.

	‘Hey! hey! stop a minute!'

	The prince turned round and saw behind him a very tall man, running as fast as his legs would carry him.

	‘Wait for me,' he panted, ‘and take me into your service. If you do, you will never be sorry.'

	‘Who are you?' asked the prince, ‘and what can you do?'

	‘Long is my name, and I can lengthen my body at will. Do you see that nest up there on the top of that pine-tree? Well, I can get it for you without taking the trouble of climbing the tree,' and Long stretched himself up and up and up, till he was very soon as tall as the pine itself. He put the nest in his pocket, and before you could wink your eyelid he had made himself small again, and stood before the prince.

	‘Yes; you know your business,' said he, ‘but birds' nests are no use to me. I am too old for them. Now if you were only able to get me out of this wood, you would indeed be good for something.'

	‘Oh, there's no difficulty about that,' replied Long, and he stretched himself up and up and up till he was three times as tall as the tallest tree in the forest. Then he looked all round and said, ‘We must go in this direction in order to get out of the wood,' and shortening himself again, he took the prince's horse by the bridle, and led him along. Very soon they got clear of the forest, and saw before them a wide plain ending in a pile of high rocks, covered here and there with trees, and very much like the fortifications of a town.

	As they left the wood behind, Long turned to the prince and said, ‘My lord, here comes my comrade. You should take him into your service too, as you will find him a great help.'

	‘Well, call him then, so that I can see what sort of a man he is.'

	‘He is a little too far off for that,' replied Long. ‘He would hardly hear my voice, and he couldn't be here for some time yet, as he has so much to carry. I think I had better go and bring him myself,' and this time he stretched himself to such a height that his head was lost in the clouds. He made two or three strides, took his friend on his back, and set him down before the prince. The new-comer was a very fat man, and as round as a barrel.

	‘Who are you?' asked the prince, ‘and what can you do?'

	‘Your worship, Broad is my name, and I can make myself as wide as I please.'

	‘Let me see how you manage it.'

	‘Run, my lord, as fast as you can, and hide yourself in the wood,' cried Broad, and he began to swell himself out.

	The prince did not understand why he should run to the wood, but when he saw Long flying towards it, he thought he had better follow his example. He was only just in time, for Broad had so suddenly inflated himself that he very nearly knocked over the prince and his horse too. He covered all the space for acres round. You would have thought he was a mountain!

	At length Broad ceased to expand, drew a deep breath that made the whole forest tremble, and shrank into his usual size.

	‘You have made me run away,' said the prince. ‘But it is not every day one meets with a man of your sort. I will take you into my service.'

	So the three companions continued their journey, and when they were drawing near the rocks they met a man whose eyes were covered by a bandage.

	‘Your excellency,' said Long, ‘this is our third comrade. You will do well to take him into your service, and, I assure you, you will find him worth his salt.'

	‘Who are you?' asked the prince. ‘And why are your eyes bandaged? You can never see your way!'

	‘It is just the contrary, my lord! It is because I see only too well that I am forced to bandage my eyes. Even so I see as well as people who have no bandage. When I take it off my eyes pierce through everything. Everything I look at catches fire, or, if it cannot catch fire, it falls into a thousand pieces. They call me Quickeye.'

	And so saying he took off his bandage and turned towards the rock. As he fixed his eyes upon it a crack was heard, and in a few moments it was nothing but a heap of sand. In the sand something might be detected glittering brightly. Quickeye picked it up and brought it to the prince. It turned out to be a lump of pure gold.

	‘You are a wonderful creature,' said the prince, ‘and I should be a fool not to take you into my service. But since your eyes are so good, tell me if I am very far from the Iron Castle, and what is happening there just now.'

	‘If you were travelling alone,' replied Quickeye, ‘it would take you at least a year to get to it; but as we are with you, we shall arrive there to-night. Just now they are preparing supper.'

	‘There is a princess in the castle. Do you see her?'

	‘A wizard keeps her in a high tower, guarded by iron bars.'

	‘Ah, help me to deliver her!' cried the prince.

	And they promised they would.

	Then they all set out through the grey rocks, by the breach made by the eyes of Quickeye, and passed over great mountains and through deep woods. And every time they met with any obstacle the three friends contrived somehow to put it aside. As the sun was setting, the prince beheld the towers of the Iron Castle, and before it sank beneath the horizon he was crossing the iron bridge which led to the gates. He was only just in time, for no sooner had the sun disappeared altogether, than the bridge drew itself up and the gates shut themselves.

	There was no turning back now!

	The prince put up his horse in the stable, where everything looked as if a guest was expected, and then the whole party marched straight up to the castle. In the court, in the stables, and all over the great halls, they saw a number of men richly dressed, but every one turned into stone. They crossed an endless set of rooms, all opening into each other, till they reached the dining-hall. It was brilliantly lighted; the table was covered with wine and fruit, and was laid for four. They waited a few minutes expecting someone to come, but as nobody did, they sat down and began to eat and drink, for they were very hungry.

	When they had done their supper they looked about for some place to sleep. But suddenly the door burst open, and the wizard entered the hall. He was old and hump-backed, with a bald head and a grey beard that fell to his knees. He wore a black robe, and instead of a belt three iron circlets clasped his waist. He led by the hand a lady of wonderful beauty, dressed in white, with a girdle of silver and a crown of pearls, but her face was pale and sad as death itself.

	The prince knew her in an instant, and moved eagerly forward; but the wizard gave him no time to speak, and said:

	‘I know why you are here. Very good; you may have her if for three nights following you can prevent her making her escape. If you fail in this, you and your servants will all be turned into stone, like those who have come before you.' And offering the princess a chair, he left the hall.

	The prince could not take his eyes from the princess, she was so lovely! He began to talk to her, but she neither answered nor smiled, and sat as if she were made of marble. He seated himself by her, and determined not to close his eyes that night, for fear she should escape him. And in order that she should be doubly guarded, Long stretched himself like a strap all round the room, Broad took his stand by the door and puffed himself out, so that not even a mouse could slip by, and Quickeye leant against a pillar which stood in the middle of the floor and supported the roof. But in half a second they were all sound asleep, and they slept sound the whole night long.

	In the morning, at the first peep of dawn, the prince awoke with a start. But the princess was gone. He aroused his servants and implored them to tell him what he must do.

	‘Calm yourself, my lord,' said Quickeye. ‘I have found her already. A hundred miles from here there is a forest. In the middle of the forest, an old oak, and on the top of the oak, an acorn. This acorn is the princess. If Long will take me on his shoulders, we shall soon bring her back.' And sure enough, in less time than it takes to walk round a cottage, they had returned from the forest, and Long presented the acorn to the prince.

	‘Now, your excellency, throw it on the ground.'

	The prince obeyed, and was enchanted to see the princess appear at his side. But when the sun peeped for the first time over the mountains, the door burst open as before, and the wizard entered with a loud laugh. Suddenly he caught sight of the princess; his face darkened, he uttered a low growl, and one of the iron circlets gave way with a crash. He seized the young girl by the hand and bore her away with him.

	All that day the prince wandered about the castle, studying the curious treasures it contained, but everything looked as if life had suddenly come to a standstill. In one place he saw a prince who had been turned into stone in the act of brandishing a sword round which his two hands were clasped. In another, the same doom had fallen upon a knight in the act of running away. In a third, a serving man was standing eternally trying to convey a piece of beef to his mouth, and all around them were others, still preserving for evermore the attitudes they were in when the wizard had commanded ‘From henceforth be turned into marble.' In the castle, and round the castle all was dismal and desolate. Trees there were, but without leaves; fields there were, but no grass grew on them. There was one river, but it never flowed and no fish lived in it. No flowers blossomed, and no birds sang.

	Three times during the day food appeared, as if by magic, for the prince and his servants. And it was not until supper was ended that the wizard appeared, as on the previous evening, and delivered the princess into the care of the prince.

	All four determined that this time they would keep awake at any cost. But it was no use. Off they went as they had done before, and when the prince awoke the next morning the room was again empty.

	With a pang of shame, he rushed to find Quickeye. ‘Awake! Awake! Quickeye! Do you know what has become of the princess?'

	Quickeye rubbed his eyes and answered: ‘Yes, I see her. Two hundred miles from here there is a mountain. In this mountain is a rock. In the rock, a precious stone. This stone is the princess. Long shall take me there, and we will be back before you can turn round.'

	So Long took him on his shoulders and they set out. At every stride they covered twenty miles, and as they drew near Quickeye fixed his burning eyes on the mountain; in an instant it split into a thousand pieces, and in one of these sparkled the precious stone. They picked it up and brought it to the prince, who flung it hastily down, and as the stone touched the floor the princess stood before him. When the wizard came, his eyes shot forth flames of fury. Cric-crac was heard, and another of his iron bands broke and fell. He seized the princess by the hand and led her off, growling louder than ever.

	All that day things went on exactly as they had done the day before. After supper the wizard brought back the princess, and looking him straight in the eyes he said, ‘We shall see which of us two will gain the prize after all!'

	That night they struggled their very hardest to keep awake, and even walked about instead of sitting down. But it was quite useless. One after another they had to give in, and for the third time the princess slipped through their fingers.

	When morning came, it was as usual the prince who awoke the first, and as usual, the princess being gone, he rushed to Quickeye.

	‘Get up, get up, Quickeye, and tell me where is the princess?'

	Quickeye looked about for some time without answering. ‘Oh, my lord, she is far, very far. Three hundred miles away there lies a black sea. In the middle of this sea there is a little shell, and in the middle of the shell is fixed a gold ring. That gold ring is the princess. But do not vex your soul; we will get her. Only to-day, Long must take Broad with him. He will be wanted badly.'

	So Long took Quickeye on one shoulder, and Broad on the other, and they set out. At each stride they left thirty miles behind them. When they reached the black sea, Quickeye showed them the spot where they must seek the shell. But though Long stretched down his hand as far as it would go, he could not find the shell, for it lay at the bottom of the sea.

	‘Wait a moment, comrades, it will be all right. I will help you,' said Broad.

	Then he swelled himself out so that you would have thought the world could hardly have held him, and stooping down he drank. He drank so much at every mouthful, that only a minute or so passed before the water had sunk enough for Long to put his hand to the bottom. He soon found the shell, and pulled the ring out. But time had been lost, and Long had a double burden to carry. The dawn was breaking fast before they got back to the castle, where the prince was waiting for them in an agony of fear.

	Soon the first rays of the sun were seen peeping over the tops of the mountains. The door burst open, and finding the prince standing alone the wizard broke into peals of wicked laughter. But as he laughed a loud crash was heard, the window fell into a thousand pieces, a gold ring glittered in the air, and the princess stood before the enchanter. For Quickeye, who was watching from afar, had told Long of the terrible danger now threatening the prince, and Long, summoning all his strength for one gigantic effort, had thrown the ring right through the window.

	The wizard shrieked and howled with rage, till the whole castle trembled to its foundations. Then a crash was heard, the third band split in two, and a crow flew out of the window.

	Then the princess at length broke the enchanted silence, and blushing like a rose, gave the prince her thanks for her unlooked-for deliverance.

	But it was not only the princess who was restored to life by the flight of the wicked black crow. The marble figures became men once more, and took up their occupations just as they had left them off. The horses neighed in the stables, the flowers blossomed in the garden, the birds flew in the air, the fish darted in the water. Everywhere you looked, all was life, all was joy!

	And the knights who had been turned into stone came in a body to offer their homage to the prince who had set them free.

	‘Do not thank me,' he said, ‘for I have done nothing. Without my faithful servants, Long, Broad, and Quickeye, I should even have been as one of you.'

	With these words he bade them farewell, and departed with the princess and his faithful companions for the kingdom of his father.

	The old king, who had long since given up all hope, wept for joy at the sight of his son, and insisted that the wedding should take place as soon as possible.

	All the knights who had been enchanted in the Iron Castle were invited to the ceremony, and after it had taken place, Long, Broad, and Quickeye took leave of the young couple, saying that they were going to look for more work.

	The prince offered them all their hearts could desire if they would only remain with him, but they replied that an idle life would not please them, and that they could never be happy unless they were busy, so they went away to seek their fortunes, and for all I know are seeking still.

Back

Next

            This collection of children's literature is a part of the Educational Technology Clearinghouse and is funded by various grants.

            Copyright © 2006—2016 by the Florida Center for Instructional Technology, College of Education, University of South Florida.

License

Credits

FAQ

Giving

This document was downloaded from Lit2Go, a free online collection of stories and poems in Mp3 (audiobook) format published by the Florida Center for Instructional Technology. For more information, including classroom activities, readability data, and original sources, please visit http://etc.usf.edu/lit2go/143/the-grey-fairy-book/5045/long-broad-and-quickeye/.

Lit2Go: The Grey Fairy Book

Long, Broad, and Quickeye


text:
package com.greengrowapps.ggarest.tools;

public interface AsyncBlockRunner {

    void run( AsyncTimeoutHelper asyncTimeoutHelper ) throws Exception;

    void onEndCalled( );

    void onTimeout( );

}


text:
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.Collections.Generic;
using TimeTracker.Hotkeys;
using System.Linq;

namespace TimeTracker
{
    public partial class frmMain : Form
    {
        internal void SetupLogEvents()
        {
            GlobalData.Issues.ItemAdded += EventLog.NewIssueAdded;
            GlobalData.Issues.ItemRemoved += EventLog.IssueRemoved;
            GlobalData.Categories.ItemAdded += EventLog.NewCategoryAdded;
            GlobalData.Categories.ItemRemoved += EventLog.CategoryRemoved;
            GlobalData.Categories.ItemMerged += EventLog.CategoryMerged;
            GlobalData.mainForm.activeTimer.TimerStarted += EventLog.TimerStarted;
            GlobalData.mainForm.activeTimer.TimerStopped += EventLog.TimerStopped;
        }
    }
}


text:
module HQMF1
  class Comparison

    include HQMF1::Utilities

    attr_reader :restrictions, :data_criteria_id, :title, :subset

    def initialize(data_criteria_id, entry, parent, doc)
      @doc = doc
      @data_criteria_id = data_criteria_id
      @entry = entry
      title_def = @entry.at_xpath('./*/cda:title')
      if title_def
        @title = title_def.inner_text
      end
      @restrictions = []
      restriction_def = @entry.at_xpath('./*/cda:sourceOf')
      if restriction_def
        @entry.xpath('./*/cda:sourceOf').each do |restriction|
          @restrictions << Restriction.new(restriction, self, @doc)
        end
      end
    end

    def to_json

      json = build_hash(self, [:data_criteria_id,:title,:subset])
      json[:restrictions] = json_array(@restrictions)
      json

    end

  end
end


text:
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.navigationToolbar;

import com.intellij.ide.actions.OpenInRightSplitAction;
import com.intellij.ide.navigationToolbar.ui.NavBarUIManager;
import com.intellij.ide.ui.UISettings;
import com.intellij.internal.statistic.service.fus.collectors.UIEventLogger;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DependentTransientComponent;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.*;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.components.JBList;
import com.intellij.ui.popup.HintUpdateSupply;
import com.intellij.ui.popup.list.SelectablePanel;
import com.intellij.ui.speedSearch.ListWithFilter;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.accessibility.AccessibleContextUtil;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author Konstantin Bulenkov
 * @deprecated unused in ide.navBar.v2. If you do a change here, please also update v2 implementation
 */
@Deprecated
public class NavBarPopup extends LightweightHint implements Disposable{
  private static final String JBLIST_KEY = "OriginalList";
  private static final String DISPOSED_OBJECTS = "DISPOSED_OBJECTS";

  private final NavBarPanel myPanel;
  private final int myIndex;
  private final int myItemIndex;

  public NavBarPopup(final NavBarPanel panel, int sourceItemIndex, Object[] siblings, int itemIndex, final int selectedIndex) {
    super(createPopupContent(panel, siblings));
    myPanel = panel;
    myIndex = selectedIndex;
    myItemIndex = itemIndex;
    setFocusRequestor(getComponent());
    setForceShowAsPopup(true);
    setCancelOnOtherWindowOpen(false);
    panel.installPopupHandler(getList(), selectedIndex);

    getList().addMouseListener(new MouseAdapter() {
      @Override
      public void mouseReleased(final MouseEvent e) {
        if (SystemInfo.isWindows) {
          click(e);
        }
      }

      @Override
      public void mousePressed(final MouseEvent e) {
        if (!SystemInfo.isWindows) {
          click(e);
        }
      }

      private void click(final MouseEvent e) {
        if (e.isConsumed()) return;
        myPanel.getModel().setSelectedIndex(selectedIndex);
        if (e.isPopupTrigger()) return;
        int idx = getList().locationToIndex(e.getPoint());
        if (idx != -1) {
          Object value = getList().getModel().getElementAt(idx);
          myPanel.navigateInsideBar(sourceItemIndex, value, SystemInfo.isMac ? e.isMetaDown() : e.isControlDown());
        }
      }
    });
  }

  @Override
  protected void onPopupCancel() {
    final JComponent component = getComponent();
    if (component != null) {
      Object o = component.getClientProperty(JBLIST_KEY);
      if (o instanceof JComponent) HintUpdateSupply.hideHint((JComponent)o);
    }
    //noinspection unchecked
    for (SelectablePanel selectablePanel : (List<SelectablePanel>)getList().getClientProperty(DISPOSED_OBJECTS)) {
      Disposer.dispose(unwrapItem(selectablePanel));
    }
    Disposer.dispose(this);
  }

  public void show(final NavBarItem item) {
    show(item, true);
  }

  private void show(final NavBarItem item, boolean checkRepaint) {
    UIEventLogger.NavBarShowPopup.log(myPanel.getProject());

    UISettings settings = UISettings.getInstance();
    int relativeY = ExperimentalUI.isNewUI()
                    && settings.getShowNavigationBarInBottom()
                    && settings.getShowStatusBar()
                    ? -getComponent().getPreferredSize().height
                    : item.getHeight();

    final RelativePoint point = new RelativePoint(item, new Point(0, relativeY));
    final Point p = point.getPoint(myPanel);
    if ((p.x == 0 || p.y == 0) && checkRepaint) { // need repaint of nav bar panel
      //noinspection SSBasedInspection
      SwingUtilities.invokeLater(() -> {
        myPanel.getUpdateQueue().rebuildUi();
        //noinspection SSBasedInspection
        SwingUtilities.invokeLater(() -> {
          NavBarItem updatedItem = myPanel.getItemWithObject(item.getObject());
          if (updatedItem == null) updatedItem = item;
          show(updatedItem, false); // end-less loop protection
        });
      });
    } else {
      int offset = NavBarUIManager.getUI().getPopupOffset(item);
      show(myPanel, p.x - offset, p.y, myPanel, new HintHint(myPanel, p));
      final JBList list = getList();
      //noinspection HardCodedStringLiteral
      AccessibleContextUtil.setName(list, item.getText());
      if (0 <= myIndex && myIndex < list.getItemsCount()) {
        ScrollingUtil.selectItem(list, myIndex);
      }
    }
    if (myPanel.isInFloatingMode()) {
      final Window window = SwingUtilities.windowForComponent(getList());
      if (window != null) {
        // add listener only if hint is not hidden yet
        window.addWindowFocusListener(new WindowFocusListener() {
          @Override
          public void windowGainedFocus(WindowEvent e) {
          }

          @Override
          public void windowLostFocus(WindowEvent e) {
            final Window w = e.getOppositeWindow();
            if (w != null && DialogWrapper.findInstance(w.getComponent(0)) != null) {
              myPanel.hideHint();
            }
          }
        });
      }
    }
  }

  public int getItemIndex() {
    return myItemIndex;
  }

  @Override
  public void dispose() {
  }

  private static JComponent createPopupContent(@NotNull NavBarPanel panel, Object @NotNull [] siblings) {
    class MyListRenderer implements ListCellRenderer<Object> {
      final List<SelectablePanel> selectables = new ArrayList<>();

      @Override
      public Component getListCellRendererComponent(JList<?> list, Object obj, int index, boolean isSelected, boolean cellHasFocus) {
        SelectablePanel selectable = null;

        for (SelectablePanel cachedSelectable : selectables) {
          NavBarItem item = unwrapItem(cachedSelectable);
          if (obj == item.getObject()) {
            item.update();
            selectable = cachedSelectable;
          }
        }

        if (selectable == null) {
          selectable = SelectablePanel.wrap(new NavBarItem(panel, obj, null, true));
          if (ExperimentalUI.isNewUI()) {
            selectable.setSelectionArc(JBUI.CurrentTheme.Popup.Selection.ARC.get());
          }
          selectables.add(selectable);
        }

        selectable.setBackground(null);
        selectable.setSelectionColor(isSelected ? UIUtil.getListSelectionBackground(cellHasFocus) : null);
        return selectable;
      }
    }

    class MyList<E> extends JBList<E> implements DependentTransientComponent, Queryable {
      @Override
      public void putInfo(@NotNull Map<? super String, ? super String> info) {
        panel.putInfo(info);
      }

      @Override
      public @NotNull Component getPermanentComponent() {
        return panel;
      }
    }

    JBList<Object> list = new MyList<>();
    list.setModel(new CollectionListModel<>(siblings));
    HintUpdateSupply.installSimpleHintUpdateSupply(list);
    MyListRenderer renderer = new MyListRenderer();
    list.putClientProperty(DISPOSED_OBJECTS, renderer.selectables);
    list.setCellRenderer(renderer);
    list.setBorder(JBUI.Borders.empty(5));
    list.setBackground(JBUI.CurrentTheme.Popup.BACKGROUND);
    list.addListSelectionListener(new ListSelectionListener() {
      @Override
      public void valueChanged(ListSelectionEvent e) {
        panel.updatePopupSelection(list.getSelectedValuesList());
      }
    });

    NavBarListWrapper navBarListWrapper = new NavBarListWrapper(list);
    ListWithFilter<?> component = (ListWithFilter<?>)ListWithFilter.wrap(list, navBarListWrapper, o -> panel.getPresentation().getPresentableText(o, false));
    navBarListWrapper.updateViewportPreferredSizeIfNeeded();
    component.setAutoPackHeight(!UISettings.getInstance().getShowNavigationBarInBottom());
    component.putClientProperty(JBLIST_KEY, list);
    OpenInRightSplitAction.Companion.overrideDoubleClickWithOneClick(component);
    return component;
  }

  private static NavBarItem unwrapItem(SelectablePanel panel) {
    return (NavBarItem)panel.getComponent(0);
  }

  @NotNull
  public JBList<?> getList() {
    return ((JBList)getComponent().getClientProperty(JBLIST_KEY));
  }
}