text:
package me.yluo.ruisiapp.widget.htmlview;

import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.AlignmentSpan;
import android.util.Log;

import java.io.IOException;
import java.util.Stack;

import me.yluo.ruisiapp.widget.htmlview.callback.ImageGetter;
import me.yluo.ruisiapp.widget.htmlview.callback.ImageGetterCallBack;
import me.yluo.ruisiapp.widget.htmlview.callback.SpanClickListener;
import me.yluo.ruisiapp.widget.htmlview.callback.ViewChangeNotify;
import me.yluo.ruisiapp.widget.htmlview.spann.Bold;
import me.yluo.ruisiapp.widget.htmlview.spann.Code;
import me.yluo.ruisiapp.widget.htmlview.spann.Heading;
import me.yluo.ruisiapp.widget.htmlview.spann.Hr;
import me.yluo.ruisiapp.widget.htmlview.spann.Image;
import me.yluo.ruisiapp.widget.htmlview.spann.Italic;
import me.yluo.ruisiapp.widget.htmlview.spann.Li;
import me.yluo.ruisiapp.widget.htmlview.spann.Link;
import me.yluo.ruisiapp.widget.htmlview.spann.Pre;
import me.yluo.ruisiapp.widget.htmlview.spann.Quote;
import me.yluo.ruisiapp.widget.htmlview.spann.Strike;
import me.yluo.ruisiapp.widget.htmlview.spann.StyleSpan;
import me.yluo.ruisiapp.widget.htmlview.spann.Sub;
import me.yluo.ruisiapp.widget.htmlview.spann.Super;
import me.yluo.ruisiapp.widget.htmlview.spann.UnderLine;

public class SpanConverter implements ParserCallback, ImageGetterCallBack {
    private static final String TAG = SpanConverter.class.getSimpleName();
    private final String mSource;
    private SpannableStringBuilder spannedBuilder;
    private final ImageGetter imageGetter;
    private final SpanClickListener clickListener;
    private final HtmlParser parser;
    private final Stack<HtmlNode> nodes;
    private final ViewChangeNotify notify;
    private int position;

    private SpanConverter(String source, ImageGetter imageGetter,
                          SpanClickListener listener, ViewChangeNotify notify) {
        mSource = source;
        this.imageGetter = imageGetter;
        this.clickListener = listener;
        parser = new HtmlParser();
        nodes = new Stack<>();
        parser.setHandler(this);
        position = 0;
        this.notify = notify;
    }

    public static Spanned convert(String source, ImageGetter imageGetter,
                                  SpanClickListener listener, ViewChangeNotify notify) {

        SpanConverter converter = new SpanConverter(source, imageGetter, listener, notify);
        return converter.startConvert();
    }

    private Spanned startConvert() {
        try {
            parser.parse(mSource);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return spannedBuilder;
    }

    @Override
    public void startDocument(int len) {
        spannedBuilder = new SpannableStringBuilder();
    }

    @Override
    public void startElement(HtmlNode node) {
        if (HtmlTag.isBolckTag(node.type)) {
            handleBlockTag(true, node.type, position, null);
        }
        switch (node.type) {
            case HtmlTag.UNKNOWN:
                break;
            case HtmlTag.BR:
                handleBlockTag(false, node.type, position, node.attr);
                break;
            case HtmlTag.IMG:
                handleImage(position, node.attr.src);
                break;
            case HtmlTag.HR:
                handleHr(position);
                break;
            default:
                node.start = position;
                nodes.push(node);
                break;
        }
    }

    @Override
    public void characters(char[] ch, int start, int length) {
        spannedBuilder.append(new String(ch, start, length));
        position += length;
        //还要根据栈顶的元素类型添加适当的\n
    }

    @Override
    public void endElement(int type, String name) {
        if (type == HtmlTag.UNKNOWN
                || type == HtmlTag.BR
                || type == HtmlTag.IMG
                || type == HtmlTag.HR
                || nodes.isEmpty()) {
            return;
        }

        if (nodes.peek().type != type) {
            return;
        }

        HtmlNode node = nodes.pop();
        int start = node.start;

        switch (type) {
            case HtmlTag.H1:
            case HtmlTag.H2:
            case HtmlTag.H3:
            case HtmlTag.H4:
            case HtmlTag.H5:
            case HtmlTag.H6:
                handleHeading(start, type - HtmlTag.H1 + 1);
                break;
            case HtmlTag.P:
                handleParagraph(start, node.attr);
                break;
            case HtmlTag.B:
            case HtmlTag.STRONG:
                setSpan(start, new Bold());
                break;
            case HtmlTag.A:
                handleUrl(start, node.attr.href);
                break;
            case HtmlTag.I:
            case HtmlTag.EM:
            case HtmlTag.CITE:
            case HtmlTag.DFN:
                setSpan(start, new Italic());
                break;
            case HtmlTag.DEL:
            case HtmlTag.S:
            case HtmlTag.STRIKE:
                setSpan(start, new Strike());
                break;
            case HtmlTag.U:
            case HtmlTag.INS:
                setSpan(start, new UnderLine());
                break;
            case HtmlTag.UL:
            case HtmlTag.OL:
            case HtmlTag.DIV:
            case HtmlTag.HEADER:
            case HtmlTag.FOOTER:
                break;
            case HtmlTag.LI:
                setSpan(start, new Li());
                break;
            case HtmlTag.PRE:
                setSpan(start, new Pre());
                break;
            case HtmlTag.BLOCKQUOTE:
                handleBlockquote(start);
                break;
            case HtmlTag.Q:
            case HtmlTag.CODE:
            case HtmlTag.KBD:
                setSpan(start, new Code());
                break;
            case HtmlTag.MARK:
                break;
            case HtmlTag.SPAN:
                break;
            case HtmlTag.FONT:
                handleFont(start, node.attr);
                break;
            case HtmlTag.BIG:
                break;
            case HtmlTag.SMALL:
                break;
            case HtmlTag.SUB:
                setSpan(start, new Sub());
                break;
            case HtmlTag.SUP:
                setSpan(start, new Super());
                break;
            case HtmlTag.TT:
                //Monospace
                break;
            case HtmlTag.TABLE:
            case HtmlTag.CAPTION:
            case HtmlTag.THEAD:
            case HtmlTag.TFOOT:
            case HtmlTag.TBODY:
            case HtmlTag.TH:
            case HtmlTag.TD:
                break;
            default:
                Log.w(getClass().getName(), "unknown tag type: " + type);
                break;
        }

        if (HtmlTag.isBolckTag(type)) {
            handleBlockTag(false, type, start, node.attr);
        }
    }

    @Override
    public void endDocument() {
    }

    //div ul 等块状标签
    private void handleBlockTag(boolean isStart, int type, int start, HtmlNode.HtmlAttr attr) {
        if (position <= 0) {
            return;
        }
        if (spannedBuilder.charAt(position - 1) != '\n') {
            spannedBuilder.append('\n');
            position++;
        }

        //结束block 标签
        if (!isStart && attr != null) {
            Layout.Alignment align;
            if (attr.align == HtmlNode.ALIGN_LEFT) {
                align = Layout.Alignment.ALIGN_NORMAL;
            } else if (attr.align == HtmlNode.ALIGN_RIGHT) {
                align = Layout.Alignment.ALIGN_OPPOSITE;
            } else if (attr.align == HtmlNode.ALIGN_CENTER) {
                align = Layout.Alignment.ALIGN_CENTER;
            } else {
                align = null;
            }

            if (align != null) {
                setSpan(start, position, new AlignmentSpan.Standard(align));
            }
        }
    }

    //level h1-h6
    private void handleHeading(int start, int level) {
        setSpan(start, new Heading(level));
        //spannedBuilder.setSpan(new StyleSpan(Typeface.BOLD), start, position, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

    //font 标签
    private void handleFont(int start, HtmlNode.HtmlAttr attr) {
        if (attr == null) {
            return;
        }

        StyleSpan span;
        Object[] spans = spannedBuilder.getSpans(start, position, StyleSpan.class);
        if (spans != null && spans.length > 0) {
            int pos1 = spannedBuilder.getSpanStart(spans[0]);
            int pos2 = spannedBuilder.getSpanEnd(spans[0]);
            if (pos1 == start && pos2 == position) {//一摸一样位置的同样font
                span = (StyleSpan) spans[0];
                span.updateStyle(attr);
                return;
            }
        }

        setSpan(start, new StyleSpan(attr));
    }

    //p 标签 text-align属性
    private void handleParagraph(int start, HtmlNode.HtmlAttr attr) {
        if (attr == null) {
            return;
        }
        setSpan(start, new StyleSpan(attr));

        Layout.Alignment align;
        if (attr.textAlign == HtmlNode.ALIGN_LEFT) {
            align = Layout.Alignment.ALIGN_NORMAL;
        } else if (attr.textAlign == HtmlNode.ALIGN_RIGHT) {
            align = Layout.Alignment.ALIGN_OPPOSITE;
        } else if (attr.textAlign == HtmlNode.ALIGN_CENTER) {
            align = Layout.Alignment.ALIGN_CENTER;
        } else {
            align = null;
        }

        if (align != null) {
            setSpan(start, position, new AlignmentSpan.Standard(align));
        }
    }

    private void handleBlockquote(int start) {
        spannedBuilder.insert(start, "" ");
        spannedBuilder.append(""");
        position += 3;
        setSpan(start, new Quote());
    }

    private void handleUrl(int start, String url) {
        setSpan(start, new Link(url, clickListener));
    }

    private void handleImage(int start, String url) {
        spannedBuilder.append("\uFFFC");
        position++;
        if (imageGetter != null) {
            imageGetter.getDrawable(url, start, position, this);
        }
    }

    private void handleHr(int start) {
        spannedBuilder.append(' ');
        position++;
        setSpan(start, new Hr());
    }

    private void setSpan(int start, Object span) {
        setSpan(start, position, span);
    }

    private void setSpan(int start, int end, Object span) {
        if (end <= start || end > spannedBuilder.length()) {
            return;
        }
        spannedBuilder.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }

    @Override
    public void onImageReady(String source, int start, int end, Drawable d) {
        Image[] is = spannedBuilder.getSpans(start, end, Image.class);
        for (Image i : is) {
            spannedBuilder.removeSpan(i);
        }
        setSpan(start, end, new Image(source, d));
        notify.notifyViewChange();
    }
}


text:
require 'refinery/searchable_record'

begin
  Refinery::Resource.class_eval do
    extend Refinery::SearchableRecord
    acts_like_searchable :file_name
  end
rescue NameError
end

redpajama_set_name: RedPajamaGithub


text:
package org.sakaiproject.email.impl.test;

import org.sakaiproject.email.impl.BaseDigestService;

/** Just checks we don't need any missing methods as the main implementation is abstract.*/
public class ConcreteDigestService extends BaseDigestService {

	@Override
	protected Storage newStorage() {
		// TODO Auto-generated method stub
		return null;
	}

}


text:
import React, { Component, PropTypes } from 'react'
import {Grid, Row, Col, Column, Table} from 'react-bootstrap'
import Input from 'react-validated-input'

export default class SqlCopy extends Component {

  constructor(props){
    super(props)
    this.state={inputData: '', outputData: '', lines : [], rows : 0, columns: 0};
  }

  onInputChange(e){
    let lines = e.target.value.split('\n');
    let outputData = 'INSERT INTO [TABLE] ([' + lines[0].replace(/\t/g, '], [') + '])\n'
    for (var i = 1; i < lines.length; i++) {
      outputData += ((i == 1 ? 'SELECT ' : 'UNION ALL SELECT ') + lines[i].split('\t').map(a => a.toUpperCase() != 'NULL' ? `'${a.replace(new RegExp("'", 'g'), "''")}'` : 'NULL').join(', ') + '\n')
    }
    this.setState({lines, outputData })
  }

  render () {
    let inputHolder = 'To use it, execute a SELECT statement in SQLServer management studio, right click on the result window, select "Copy with Headers", then paste it here'
    let outputHolder = 'If you paste a standard output WITH headers from the SQLServer management studio result, you will get an INSERT statement here'
    return (
      <Grid>

This little tool takes a string copied from the SELECT output window of SQLServer management studio, and converts it into an SQL INSERT statement

        <Row>
          <Col md={6}>
            <Input type="textarea" placeholder={inputHolder} style={{height: 300}} instance={this.state} propertyKey="inputData" onChange={this.onInputChange.bind(this)}></Input>
          </Col>
          <Col md={6}>
            <Input type="textarea" placeholder={outputHolder} style={{height: 300}} instance={this.state} propertyKey="outputData"></Input>
          </Col>
        </Row>

              {this.state.lines.length > 0 ? this.state.lines[0].split('\t').map((a, i)=> {a}	) : null}

            {this.state.lines.map((a, i)=> i == 0 ? null :

              {a.split('\t').map((aa, ii)=> {aa}	)}

)}

      </Grid>
    );
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#eeeeee"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="44dp"
        android:background="@drawable/management_activity_title_bg" >

        <ImageButton
            android:id="@+id/management_activity_back_ib"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="16dp"
            android:background="@drawable/location_back" />

        <TextView
            android:id="@+id/management_activity_topbar_title_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="户外活动"
            android:textColor="#666666"
            android:textSize="20sp" />
    </RelativeLayout>

    <include
        android:layout_width="match_parent"
        android:layout_height="23dp"
        layout="@layout/management_activity_navigationbar" />

    <LinearLayout
        android:id="@+id/management_activity_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="16dp"
        android:orientation="vertical" >
    </LinearLayout>

</LinearLayout>


text:
namespace llvm {
class SystemZTargetMachine;
class FunctionPass;

namespace SystemZ {
// Condition-code mask values.
const unsigned CCMASK_0 = 1 << 3;
const unsigned CCMASK_1 = 1 << 2;
const unsigned CCMASK_2 = 1 << 1;
const unsigned CCMASK_3 = 1 << 0;
const unsigned CCMASK_ANY = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;

// Condition-code mask assignments for integer and floating-point
// comparisons.
const unsigned CCMASK_CMP_EQ = CCMASK_0;
const unsigned CCMASK_CMP_LT = CCMASK_1;
const unsigned CCMASK_CMP_GT = CCMASK_2;
const unsigned CCMASK_CMP_NE = CCMASK_CMP_LT | CCMASK_CMP_GT;
const unsigned CCMASK_CMP_LE = CCMASK_CMP_EQ | CCMASK_CMP_LT;
const unsigned CCMASK_CMP_GE = CCMASK_CMP_EQ | CCMASK_CMP_GT;

// Condition-code mask assignments for floating-point comparisons only.
const unsigned CCMASK_CMP_UO = CCMASK_3;
const unsigned CCMASK_CMP_O  = CCMASK_ANY ^ CCMASK_CMP_UO;

// All condition-code values produced by comparisons.
const unsigned CCMASK_ICMP = CCMASK_0 | CCMASK_1 | CCMASK_2;
const unsigned CCMASK_FCMP = CCMASK_0 | CCMASK_1 | CCMASK_2 | CCMASK_3;

// Condition-code mask assignments for CS.
const unsigned CCMASK_CS_EQ = CCMASK_0;
const unsigned CCMASK_CS_NE = CCMASK_1;
const unsigned CCMASK_CS    = CCMASK_0 | CCMASK_1;

// Condition-code mask assignments for a completed SRST loop.
const unsigned CCMASK_SRST_FOUND    = CCMASK_1;
const unsigned CCMASK_SRST_NOTFOUND = CCMASK_2;
const unsigned CCMASK_SRST          = CCMASK_1 | CCMASK_2;

// Condition-code mask assignments for TEST UNDER MASK.
const unsigned CCMASK_TM_ALL_0       = CCMASK_0;
const unsigned CCMASK_TM_MIXED_MSB_0 = CCMASK_1;
const unsigned CCMASK_TM_MIXED_MSB_1 = CCMASK_2;
const unsigned CCMASK_TM_ALL_1       = CCMASK_3;
const unsigned CCMASK_TM_SOME_0      = CCMASK_TM_ALL_1 ^ CCMASK_ANY;
const unsigned CCMASK_TM_SOME_1      = CCMASK_TM_ALL_0 ^ CCMASK_ANY;
const unsigned CCMASK_TM_MSB_0       = CCMASK_0 | CCMASK_1;
const unsigned CCMASK_TM_MSB_1       = CCMASK_2 | CCMASK_3;
const unsigned CCMASK_TM             = CCMASK_ANY;

// Condition-code mask assignments for TRANSACTION_BEGIN.
const unsigned CCMASK_TBEGIN_STARTED       = CCMASK_0;
const unsigned CCMASK_TBEGIN_INDETERMINATE = CCMASK_1;
const unsigned CCMASK_TBEGIN_TRANSIENT     = CCMASK_2;
const unsigned CCMASK_TBEGIN_PERSISTENT    = CCMASK_3;
const unsigned CCMASK_TBEGIN               = CCMASK_ANY;

// Condition-code mask assignments for TRANSACTION_END.
const unsigned CCMASK_TEND_TX   = CCMASK_0;
const unsigned CCMASK_TEND_NOTX = CCMASK_2;
const unsigned CCMASK_TEND      = CCMASK_TEND_TX | CCMASK_TEND_NOTX;

// Condition-code mask assignments for vector comparisons (and similar
// operations).
const unsigned CCMASK_VCMP_ALL       = CCMASK_0;
const unsigned CCMASK_VCMP_MIXED     = CCMASK_1;
const unsigned CCMASK_VCMP_NONE      = CCMASK_3;
const unsigned CCMASK_VCMP           = CCMASK_0 | CCMASK_1 | CCMASK_3;

// The position of the low CC bit in an IPM result.
const unsigned IPM_CC = 28;

// Mask assignments for PFD.
const unsigned PFD_READ  = 1;
const unsigned PFD_WRITE = 2;

// Number of bits in a vector register.
const unsigned VectorBits = 128;

// Number of bytes in a vector register (and consequently the number of
// bytes in a general permute vector).
const unsigned VectorBytes = VectorBits / 8;

// Return true if Val fits an LLILL operand.
static inline bool isImmLL(uint64_t Val) {
  return (Val & ~0x000000000000ffffULL) == 0;
}

// Return true if Val fits an LLILH operand.
static inline bool isImmLH(uint64_t Val) {
  return (Val & ~0x00000000ffff0000ULL) == 0;
}

// Return true if Val fits an LLIHL operand.
static inline bool isImmHL(uint64_t Val) {
  return (Val & ~0x00000ffff00000000ULL) == 0;
}

// Return true if Val fits an LLIHH operand.
static inline bool isImmHH(uint64_t Val) {
  return (Val & ~0xffff000000000000ULL) == 0;
}

// Return true if Val fits an LLILF operand.
static inline bool isImmLF(uint64_t Val) {
  return (Val & ~0x00000000ffffffffULL) == 0;
}

// Return true if Val fits an LLIHF operand.
static inline bool isImmHF(uint64_t Val) {
  return (Val & ~0xffffffff00000000ULL) == 0;
}
} // end namespace SystemZ

FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM,
                                   CodeGenOpt::Level OptLevel);
FunctionPass *createSystemZElimComparePass(SystemZTargetMachine &TM);
FunctionPass *createSystemZShortenInstPass(SystemZTargetMachine &TM);
FunctionPass *createSystemZLongBranchPass(SystemZTargetMachine &TM);
FunctionPass *createSystemZLDCleanupPass(SystemZTargetMachine &TM);
} // end namespace llvm

#endif


text:
/** @stable */
export declare class AbstractProviderError extends BaseException {
    context: any;
    constructor(injector: ReflectiveInjector, key: ReflectiveKey, constructResolvingMessage: Function);
    addKey(injector: ReflectiveInjector, key: ReflectiveKey): void;
}

/** @stable */
export declare abstract class AfterContentChecked {
    abstract ngAfterContentChecked(): void;
}

/** @stable */
export declare abstract class AfterContentInit {
    abstract ngAfterContentInit(): void;
}

/** @stable */
export declare abstract class AfterViewChecked {
    abstract ngAfterViewChecked(): void;
}

/** @stable */
export declare abstract class AfterViewInit {
    abstract ngAfterViewInit(): void;
}

/** @experimental */
export declare const ANALYZE_FOR_ENTRY_COMPONENTS: OpaqueToken;

/** @experimental */
export declare function animate(timing: string | number, styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata): AnimationAnimateMetadata;

/** @experimental */
export declare class AnimationAnimateMetadata extends AnimationMetadata {
    styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata;
    timings: string | number;
    constructor(timings: string | number, styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata);
}

/** @experimental */
export declare class AnimationEntryMetadata {
    definitions: AnimationStateMetadata[];
    name: string;
    constructor(name: string, definitions: AnimationStateMetadata[]);
}

/** @experimental */
export declare class AnimationGroupMetadata extends AnimationWithStepsMetadata {
    steps: AnimationMetadata[];
    constructor(_steps: AnimationMetadata[]);
}

/** @experimental */
export declare class AnimationKeyframesSequenceMetadata extends AnimationMetadata {
    steps: AnimationStyleMetadata[];
    constructor(steps: AnimationStyleMetadata[]);
}

/** @experimental */
export declare abstract class AnimationMetadata {
}

/** @experimental */
export declare abstract class AnimationPlayer {
    parentPlayer: AnimationPlayer;
    abstract destroy(): void;
    abstract finish(): void;
    abstract getPosition(): number;
    abstract hasStarted(): boolean;
    abstract init(): void;
    abstract onDone(fn: Function): void;
    abstract pause(): void;
    abstract play(): void;
    abstract reset(): void;
    abstract restart(): void;
    abstract setPosition(p: any): void;
}

/** @experimental */
export declare class AnimationSequenceMetadata extends AnimationWithStepsMetadata {
    steps: AnimationMetadata[];
    constructor(_steps: AnimationMetadata[]);
}

/** @experimental */
export declare class AnimationStateDeclarationMetadata extends AnimationStateMetadata {
    stateNameExpr: string;
    styles: AnimationStyleMetadata;
    constructor(stateNameExpr: string, styles: AnimationStyleMetadata);
}

/** @experimental */
export declare abstract class AnimationStateMetadata {
}

/** @experimental */
export declare class AnimationStateTransitionMetadata extends AnimationStateMetadata {
    stateChangeExpr: string;
    steps: AnimationMetadata;
    constructor(stateChangeExpr: string, steps: AnimationMetadata);
}

/** @experimental */
export declare class AnimationStyleMetadata extends AnimationMetadata {
    offset: number;
    styles: Array<string | {
        [key: string]: string | number;
    }>;
    constructor(styles: Array<string | {
        [key: string]: string | number;
    }>, offset?: number);
}

/** @experimental */
export declare abstract class AnimationWithStepsMetadata extends AnimationMetadata {
    steps: AnimationMetadata[];
    constructor();
}

/** @experimental */
export declare const APP_BOOTSTRAP_LISTENER: OpaqueToken;

/** @experimental */
export declare const APP_ID: any;

/** @experimental */
export declare const APP_INITIALIZER: any;

/** @deprecated */
export declare const APPLICATION_COMMON_PROVIDERS: Array<Type<any> | {
    [k: string]: any;
} | any[]>;

/** @experimental */
export declare class ApplicationInitStatus {
    done: boolean;
    donePromise: Promise<any>;
    constructor(appInits: (() => any)[]);
}

/** @experimental */
export declare class ApplicationModule {
}

/** @experimental */
export declare abstract class ApplicationRef {
    componentTypes: Type<any>[];
    components: ComponentRef<any>[];
    /** @deprecated */ injector: Injector;
    /** @deprecated */ zone: NgZone;
    abstract bootstrap<C>(componentFactory: ComponentFactory<C> | Type<C>): ComponentRef<C>;
    /** @deprecated */ abstract dispose(): void;
    /** @deprecated */ abstract registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
    /** @deprecated */ abstract registerDisposeListener(dispose: () => void): void;
    /** @deprecated */ abstract run(callback: Function): any;
    abstract tick(): void;
    /** @deprecated */ abstract waitForAsyncInitializers(): Promise<any>;
}

/** @experimental */
export declare function asNativeElements(debugEls: DebugElement[]): any;

/** @experimental */
export declare function assertPlatform(requiredToken: any): PlatformRef;

/** @stable */
export declare var Attribute: AttributeMetadataFactory;

/** @stable */
export declare class AttributeMetadata extends DependencyMetadata {
    attributeName: string;
    token: AttributeMetadata;
    constructor(attributeName: string);
    toString(): string;
}

/** @stable */
export interface AttributeMetadataFactory {
    (name: string): TypeDecorator;
    new (name: string): AttributeMetadata;
}

/** @experimental */
export declare const AUTO_STYLE: string;

/** @stable */
export declare class BaseException extends Error {
    message: string;
    stack: any;
    constructor(message?: string);
    toString(): string;
}

/** @deprecated */
export declare function bind(token: any): ProviderBuilder;

/** @deprecated */
export declare class Binding extends Provider {
    /** @deprecated */ toAlias: any;
    /** @deprecated */ toClass: Type<any>;
    /** @deprecated */ toFactory: Function;
    /** @deprecated */ toValue: any;
    constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
        toClass?: Type<any>;
        toValue?: any;
        toAlias?: any;
        toFactory: Function;
        deps?: Object[];
        multi?: boolean;
    });
}

/** @stable */
export declare enum ChangeDetectionStrategy {
    OnPush = 0,
    Default = 1,
}

/** @stable */
export declare abstract class ChangeDetectorRef {
    abstract checkNoChanges(): void;
    abstract detach(): void;
    abstract detectChanges(): void;
    abstract markForCheck(): void;
    abstract reattach(): void;
}

/** @stable */
export declare function Class(clsDef: ClassDefinition): Type<any>;

/** @stable */
export interface ClassDefinition {
    constructor: Function | any[];
    extends?: Type<any>;
    [x: string]: Type<any> | Function | any[];
}

/** @stable */
export declare class CollectionChangeRecord {
    currentIndex: number;
    item: any;
    previousIndex: number;
    trackById: any;
    constructor(item: any, trackById: any);
    toString(): string;
}

/** @stable */
export declare class Compiler {
    clearCache(): void;
    clearCacheFor(type: Type<any>): void;
    compileComponentAsync<T>(component: Type<T>, ngModule?: Type<any>): Promise<ComponentFactory<T>>;
    compileComponentSync<T>(component: Type<T>, ngModule?: Type<any>): ComponentFactory<T>;
    compileModuleAndAllComponentsAsync<T>(moduleType: Type<T>): Promise<ModuleWithComponentFactories<T>>;
    compileModuleAndAllComponentsSync<T>(moduleType: Type<T>): ModuleWithComponentFactories<T>;
    compileModuleAsync<T>(moduleType: Type<T>): Promise<NgModuleFactory<T>>;
    compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T>;
}

/** @experimental */
export declare const COMPILER_OPTIONS: OpaqueToken;

/** @experimental */
export declare abstract class CompilerFactory {
    abstract createCompiler(options?: CompilerOptions[]): Compiler;
}

/** @experimental */
export declare type CompilerOptions = {
    useDebug?: boolean;
    useJit?: boolean;
    defaultEncapsulation?: ViewEncapsulation;
    providers?: any[];
};

/** @stable */
export declare var Component: ComponentMetadataFactory;

/** @stable */
export interface ComponentDecorator extends TypeDecorator {
}

/** @stable */
export declare class ComponentFactory<C> {
    componentType: Type<any>;
    selector: string;
    constructor(selector: string, _viewFactory: Function, _componentType: Type<any>);
    create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any): ComponentRef<C>;
}

/** @stable */
export declare abstract class ComponentFactoryResolver {
    abstract resolveComponentFactory<T>(component: Type<T>): ComponentFactory<T>;
    static NULL: ComponentFactoryResolver;
}

/** @stable */
export declare class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
    animations: AnimationEntryMetadata[];
    changeDetection: ChangeDetectionStrategy;
    directives: Array<Type<any> | any[]>;
    encapsulation: ViewEncapsulation;
    entryComponents: Array<Type<any> | any[]>;
    interpolation: [string, string];
    moduleId: string;
    pipes: Array<Type<any> | any[]>;
    styleUrls: string[];
    styles: string[];
    template: string;
    templateUrl: string;
    viewProviders: any[];
    constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, providers, viewProviders, changeDetection, queries, templateUrl, template, styleUrls, styles, animations, directives, pipes, encapsulation, interpolation, entryComponents}?: ComponentMetadataType);
}

/** @stable */
export interface ComponentMetadataFactory {
    (obj: ComponentMetadataType): ComponentDecorator;
    new (obj: ComponentMetadataType): ComponentMetadata;
}

/** @experimental */
export interface ComponentMetadataType extends DirectiveMetadataType {
    animations?: AnimationEntryMetadata[];
    changeDetection?: ChangeDetectionStrategy;
    directives?: Array<Type<any> | any[]>;
    encapsulation?: ViewEncapsulation;
    entryComponents?: Array<Type<any> | any[]>;
    interpolation?: [string, string];
    moduleId?: string;
    pipes?: Array<Type<any> | any[]>;
    styleUrls?: string[];
    styles?: string[];
    template?: string;
    templateUrl?: string;
    viewProviders?: any[];
}

/** @stable */
export declare abstract class ComponentRef<C> {
    changeDetectorRef: ChangeDetectorRef;
    componentType: Type<any>;
    hostView: ViewRef;
    injector: Injector;
    instance: C;
    location: ElementRef;
    abstract destroy(): void;
    abstract onDestroy(callback: Function): void;
}

/** @deprecated */
export declare abstract class ComponentResolver {
    abstract clearCache(): void;
    abstract resolveComponent(component: Type<any> | string): Promise<ComponentFactory<any>>;
    static DynamicCompilationDeprecationMsg: string;
    static LazyLoadingDeprecationMsg: string;
}

/** @stable */
export declare class ComponentStillLoadingError extends BaseException {
    compType: Type<any>;
    constructor(compType: Type<any>);
}

/** @stable */
export declare var ContentChild: ContentChildMetadataFactory;

/** @stable */
export declare class ContentChildMetadata extends QueryMetadata {
    constructor(_selector: Type<any> | string, {read}?: {
        read?: any;
    });
}

/** @stable */
export interface ContentChildMetadataFactory {
    (selector: Type<any> | Function | string, {read}?: {
        read?: any;
    }): any;
    new (selector: Type<any> | Function | string, {read}?: {
        read?: any;
    }): ContentChildMetadataFactory;
}

/** @stable */
export declare var ContentChildren: ContentChildrenMetadataFactory;

/** @stable */
export declare class ContentChildrenMetadata extends QueryMetadata {
    constructor(_selector: Type<any> | string, {descendants, read}?: {
        descendants?: boolean;
        read?: any;
    });
}

/** @stable */
export interface ContentChildrenMetadataFactory {
    (selector: Type<any> | Function | string, {descendants, read}?: {
        descendants?: boolean;
        read?: any;
    }): any;
    new (selector: Type<any> | Function | string, {descendants, read}?: {
        descendants?: boolean;
        read?: any;
    }): ContentChildrenMetadata;
}

/** @deprecated */
export declare function coreBootstrap<C>(componentFactory: ComponentFactory<C>, injector: Injector): ComponentRef<C>;

/** @deprecated */
export declare function coreLoadAndBootstrap(componentType: Type<any>, injector: Injector): Promise<ComponentRef<any>>;

/** @experimental */
export declare function createPlatform(injector: Injector): PlatformRef;

/** @experimental */
export declare function createPlatformFactory(parentPlaformFactory: PlatformFactory, name: string, providers?: any[]): PlatformFactory;

/** @experimental */
export declare const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata;

/** @stable */
export declare class CyclicDependencyError extends AbstractProviderError {
    constructor(injector: ReflectiveInjector, key: ReflectiveKey);
}

/** @experimental */
export declare class DebugElement extends DebugNode {
    attributes: {
        [key: string]: string;
    };
    childNodes: DebugNode[];
    children: DebugElement[];
    classes: {
        [key: string]: boolean;
    };
    name: string;
    nativeElement: any;
    properties: {
        [key: string]: any;
    };
    styles: {
        [key: string]: string;
    };
    constructor(nativeNode: any, parent: any, _debugInfo: RenderDebugInfo);
    addChild(child: DebugNode): void;
    insertChildrenAfter(child: DebugNode, newChildren: DebugNode[]): void;
    query(predicate: Predicate<DebugElement>): DebugElement;
    queryAll(predicate: Predicate<DebugElement>): DebugElement[];
    queryAllNodes(predicate: Predicate<DebugNode>): DebugNode[];
    removeChild(child: DebugNode): void;
    triggerEventHandler(eventName: string, eventObj: any): void;
}

/** @experimental */
export declare class DebugNode {
    componentInstance: any;
    context: any;
    injector: Injector;
    listeners: EventListener[];
    nativeNode: any;
    parent: DebugElement;
    providerTokens: any[];
    references: {
        [key: string]: any;
    };
    source: string;
    constructor(nativeNode: any, parent: DebugNode, _debugInfo: RenderDebugInfo);
    /** @deprecated */ inject(token: any): any;
}

/** @stable */
export declare class DefaultIterableDiffer implements IterableDiffer {
    collection: any;
    isDirty: boolean;
    length: number;
    constructor(_trackByFn?: TrackByFn);
    check(collection: any): boolean;
    diff(collection: any): DefaultIterableDiffer;
    forEachAddedItem(fn: Function): void;
    forEachIdentityChange(fn: Function): void;
    forEachItem(fn: Function): void;
    forEachMovedItem(fn: Function): void;
    forEachOperation(fn: (item: CollectionChangeRecord, previousIndex: number, currentIndex: number) => void): void;
    forEachPreviousItem(fn: Function): void;
    forEachRemovedItem(fn: Function): void;
    onDestroy(): void;
    toString(): string;
}

/** @stable */
export declare var Directive: DirectiveMetadataFactory;

/** @stable */
export interface DirectiveDecorator extends TypeDecorator {
}

/** @stable */
export declare class DirectiveMetadata extends InjectableMetadata implements DirectiveMetadataType {
    /** @deprecated */ events: string[];
    exportAs: string;
    host: {
        [key: string]: string;
    };
    inputs: string[];
    outputs: string[];
    /** @deprecated */ properties: string[];
    providers: any[];
    queries: {
        [key: string]: any;
    };
    selector: string;
    constructor({selector, inputs, outputs, properties, events, host, providers, exportAs, queries}?: DirectiveMetadataType);
}

/** @stable */
export interface DirectiveMetadataFactory {
    (obj: DirectiveMetadataType): DirectiveDecorator;
    new (obj: DirectiveMetadataType): DirectiveMetadata;
}

/** @experimental */
export interface DirectiveMetadataType {
    events?: string[];
    exportAs?: string;
    host?: {
        [key: string]: string;
    };
    inputs?: string[];
    outputs?: string[];
    properties?: string[];
    providers?: any[];
    queries?: {
        [key: string]: any;
    };
    selector?: string;
}

/** @deprecated */
export declare function disposePlatform(): void;

/** @stable */
export declare abstract class DoCheck {
    abstract ngDoCheck(): void;
}

/** @deprecated */
export declare abstract class DynamicComponentLoader {
    abstract loadAsRoot(type: Type<any>, overrideSelectorOrNode: string | any, injector: Injector, onDispose?: () => void, projectableNodes?: any[][]): Promise<ComponentRef<any>>;
    abstract loadNextToLocation(type: Type<any>, location: ViewContainerRef, providers?: ResolvedReflectiveProvider[], projectableNodes?: any[][]): Promise<ComponentRef<any>>;
}

/** @stable */
export declare class ElementRef {
    /** @stable */ nativeElement: any;
    constructor(nativeElement: any);
}

/** @experimental */
export declare abstract class EmbeddedViewRef<C> extends ViewRef {
    context: C;
    rootNodes: any[];
    abstract destroy(): void;
}

/** @experimental */
export declare function enableProdMode(): void;

/** @stable */
export declare class EventEmitter<T> extends Subject<T> {
    __isAsync: boolean;
    constructor(isAsync?: boolean);
    emit(value?: T): void;
    /** @deprecated */ next(value: any): void;
    subscribe(generatorOrNext?: any, error?: any, complete?: any): any;
}

/** @stable */
export declare class ExceptionHandler {
    constructor(_logger: any, _rethrowException?: boolean);
    call(exception: any, stackTrace?: any, reason?: string): void;
    static exceptionToString(exception: any, stackTrace?: any, reason?: string): string;
}

/** @stable */
export declare class ExpressionChangedAfterItHasBeenCheckedException extends BaseException {
    constructor(oldValue: any, currValue: any, context: any);
}

/** @experimental */
export declare function forwardRef(forwardRefFn: ForwardRefFn): Type<any>;

/** @experimental */
export interface ForwardRefFn {
    (): any;
}

/** @experimental */
export declare function getDebugNode(nativeNode: any): DebugNode;

/** @experimental */
export declare function getPlatform(): PlatformRef;

/** @experimental */
export interface GetTestability {
    addToWindow(registry: TestabilityRegistry): void;
    findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean): Testability;
}

/** @experimental */
export declare function group(steps: AnimationMetadata[]): AnimationGroupMetadata;

/** @stable */
export declare var Host: HostMetadataFactory;

/** @stable */
export declare var HostBinding: HostBindingMetadataFactory;

/** @stable */
export declare class HostBindingMetadata {
    hostPropertyName: string;
    constructor(hostPropertyName?: string);
}

/** @stable */
export interface HostBindingMetadataFactory {
    (hostPropertyName?: string): any;
    new (hostPropertyName?: string): any;
}

/** @stable */
export declare var HostListener: HostListenerMetadataFactory;

/** @stable */
export declare class HostListenerMetadata {
    args: string[];
    eventName: string;
    constructor(eventName: string, args?: string[]);
}

/** @stable */
export interface HostListenerMetadataFactory {
    (eventName: string, args?: string[]): any;
    new (eventName: string, args?: string[]): any;
}

/** @stable */
export declare class HostMetadata {
    toString(): string;
}

/** @stable */
export interface HostMetadataFactory {
    (): any;
    new (): HostMetadata;
}

/** @stable */
export declare var Inject: InjectMetadataFactory;

/** @stable */
export declare var Injectable: InjectableMetadataFactory;

/** @stable */
export declare class InjectableMetadata {
    constructor();
}

/** @stable */
export interface InjectableMetadataFactory {
    (): any;
    new (): InjectableMetadata;
}

/** @stable */
export declare class InjectMetadata {
    token: any;
    constructor(token: any);
    toString(): string;
}

/** @stable */
export interface InjectMetadataFactory {
    (token: any): any;
    new (token: any): InjectMetadata;
}

/** @stable */
export declare abstract class Injector {
    get(token: any, notFoundValue?: any): any;
    static NULL: Injector;
    static THROW_IF_NOT_FOUND: Object;
}

/** @stable */
export declare var Input: InputMetadataFactory;

/** @stable */
export declare class InputMetadata {
    bindingPropertyName: string;
    constructor(
        bindingPropertyName?: string);
}

/** @stable */
export interface InputMetadataFactory {
    (bindingPropertyName?: string): any;
    new (bindingPropertyName?: string): any;
}

/** @stable */
export declare class InstantiationError extends WrappedException {
    causeKey: ReflectiveKey;
    context: any;
    wrapperMessage: string;
    constructor(injector: ReflectiveInjector, originalException: any, originalStack: any, key: ReflectiveKey);
    addKey(injector: ReflectiveInjector, key: ReflectiveKey): void;
}

/** @stable */
export declare class InvalidProviderError extends BaseException {
    constructor(provider: any);
}

/** @experimental */
export declare function isDevMode(): boolean;

/** @stable */
export interface IterableDiffer {
    diff(object: any): any;
    onDestroy(): any;
}

/** @stable */
export interface IterableDifferFactory {
    create(cdRef: ChangeDetectorRef, trackByFn?: TrackByFn): IterableDiffer;
    supports(objects: any): boolean;
}

/** @stable */
export declare class IterableDiffers {
    factories: IterableDifferFactory[];
    constructor(factories: IterableDifferFactory[]);
    find(iterable: any): IterableDifferFactory;
    static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers;
    static extend(factories: IterableDifferFactory[]): Provider;
}

/** @experimental */
export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata;

/** @stable */
export declare class KeyValueChangeRecord {
    currentValue: any;
    key: any;
    previousValue: any;
    constructor(key: any);
    toString(): string;
}

/** @stable */
export interface KeyValueDiffer {
    diff(object: any): any;
    onDestroy(): any;
}

/** @stable */
export interface KeyValueDifferFactory {
    create(cdRef: ChangeDetectorRef): KeyValueDiffer;
    supports(objects: any): boolean;
}

/** @stable */
export declare class KeyValueDiffers {
    factories: KeyValueDifferFactory[];
    constructor(factories: KeyValueDifferFactory[]);
    find(kv: Object): KeyValueDifferFactory;
    static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers;
    static extend(factories: KeyValueDifferFactory[]): Provider;
}

/** @deprecated */
export declare function lockRunMode(): void;

/** @experimental */
export declare class ModuleWithComponentFactories<T> {
    componentFactories: ComponentFactory<any>[];
    ngModuleFactory: NgModuleFactory<T>;
    constructor(ngModuleFactory: NgModuleFactory<T>, componentFactories: ComponentFactory<any>[]);
}

/** @experimental */
export interface ModuleWithProviders {
    ngModule: Type<any>;
    providers?: any[];
}

/** @experimental */
export declare var NgModule: NgModuleMetadataFactory;

/** @stable */
export interface NgModuleDecorator extends TypeDecorator {
}

/** @experimental */
export declare class NgModuleFactory<T> {
    moduleType: Type<T>;
    constructor(_injectorClass: {
        new (parentInjector: Injector): NgModuleInjector<T>;
    }, _moduleype: Type<T>);
    create(parentInjector: Injector): NgModuleRef<T>;
}

/** @experimental */
export declare abstract class NgModuleFactoryLoader {
    abstract load(path: string): Promise<NgModuleFactory<any>>;
}

/** @experimental */
export declare class NgModuleMetadata extends InjectableMetadata implements NgModuleMetadataType {
    bootstrap: Array<Type<any> | any[]>;
    declarations: Array<Type<any> | any[]>;
    entryComponents: Array<Type<any> | any[]>;
    exports: Array<Type<any> | any[]>;
    imports: Array<Type<any> | ModuleWithProviders | any[]>;
    providers: any[];
    schemas: Array<SchemaMetadata | any[]>;
    constructor(options?: NgModuleMetadataType);
}

/** @experimental */
export interface NgModuleMetadataFactory {
    (obj?: NgModuleMetadataType): NgModuleDecorator;
    new (obj?: NgModuleMetadataType): NgModuleMetadata;
}

/** @experimental */
export interface NgModuleMetadataType {
    bootstrap?: Array<Type<any> | any[]>;
    declarations?: Array<Type<any> | any[]>;
    entryComponents?: Array<Type<any> | any[]>;
    exports?: Array<Type<any> | any[]>;
    imports?: Array<Type<any> | ModuleWithProviders | any[]>;
    providers?: any[];
    schemas?: Array<SchemaMetadata | any[]>;
}

/** @experimental */
export declare abstract class NgModuleRef<T> {
    componentFactoryResolver: ComponentFactoryResolver;
    injector: Injector;
    instance: T;
    abstract destroy(): void;
    abstract onDestroy(callback: () => void): void;
}

/** @experimental */
export declare class NgZone {
    hasPendingMacrotasks: boolean;
    hasPendingMicrotasks: boolean;
    isStable: boolean;
    onError: EventEmitter<any>;
    onMicrotaskEmpty: EventEmitter<any>;
    onStable: EventEmitter<any>;
    onUnstable: EventEmitter<any>;
    constructor({enableLongStackTrace}: {
        enableLongStackTrace?: boolean;
    });
    run(fn: () => any): any;
    runGuarded(fn: () => any): any;
    runOutsideAngular(fn: () => any): any;
    static assertInAngularZone(): void;
    static assertNotInAngularZone(): void;
    static isInAngularZone(): boolean;
}

/** @deprecated */
export declare class NgZoneError {
    error: any;
    stackTrace: any;
    constructor(error: any, stackTrace: any);
}

/** @stable */
export declare class NoAnnotationError extends BaseException {
    constructor(typeOrFunc: Type<any> | Function, params: any[][]);
}

/** @stable */
export declare class NoComponentFactoryError extends BaseException {
    component: Function;
    constructor(component: Function);
}

/** @stable */
export declare class NoProviderError extends AbstractProviderError {
    constructor(injector: ReflectiveInjector, key: ReflectiveKey);
}

/** @stable */
export declare abstract class OnChanges {
    abstract ngOnChanges(changes: SimpleChanges): void;
}

/** @stable */
export declare abstract class OnDestroy {
    abstract ngOnDestroy(): void;
}

/** @stable */
export declare abstract class OnInit {
    abstract ngOnInit(): void;
}

/** @stable */
export declare class OpaqueToken {
    constructor(_desc: string);
    toString(): string;
}

/** @stable */
export declare var Optional: OptionalMetadataFactory;

/** @stable */
export declare class OptionalMetadata {
    toString(): string;
}

/** @stable */
export interface OptionalMetadataFactory {
    (): any;
    new (): OptionalMetadata;
}

/** @stable */
export declare class OutOfBoundsError extends BaseException {
    constructor(index: number);
}

/** @stable */
export declare var Output: OutputMetadataFactory;

/** @stable */
export declare class OutputMetadata {
    bindingPropertyName: string;
    constructor(bindingPropertyName?: string);
}

/** @stable */
export interface OutputMetadataFactory {
    (bindingPropertyName?: string): any;
    new (bindingPropertyName?: string): any;
}

/** @experimental */
export declare const PACKAGE_ROOT_URL: any;

/** @stable */
export declare var Pipe: PipeMetadataFactory;

/** @stable */
export declare class PipeMetadata extends InjectableMetadata implements PipeMetadataType {
    name: string;
    pure: boolean;
    constructor({name, pure}: PipeMetadataType);
}

/** @stable */
export interface PipeMetadataFactory {
    (obj: PipeMetadataType): any;
    new (obj: PipeMetadataType): any;
}

/** @experimental */
export interface PipeMetadataType {
    name: string;
    pure?: boolean;
}

/** @stable */
export interface PipeTransform {
    transform(value: any, ...args: any[]): any;
}

/** @deprecated */
export declare const PLATFORM_COMMON_PROVIDERS: any[];

/** @deprecated */
export declare const PLATFORM_DIRECTIVES: OpaqueToken;

/** @experimental */
export declare const PLATFORM_INITIALIZER: any;

/** @deprecated */
export declare const PLATFORM_PIPES: OpaqueToken;

/** @experimental */
export declare const platformCore: (extraProviders?: any[]) => PlatformRef;

/** @experimental */
export declare abstract class PlatformRef {
    destroyed: boolean;
    /** @deprecated */ disposed: boolean;
    injector: Injector;
    /** @stable */ bootstrapModule<M>(moduleType: Type<M>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<M>>;
    /** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): Promise<NgModuleRef<M>>;
    abstract destroy(): void;
    /** @deprecated */ abstract dispose(): void;
    abstract onDestroy(callback: () => void): void;
    /** @deprecated */ abstract registerDisposeListener(dispose: () => void): void;
}

/** @deprecated */
export declare function provide(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
    useClass?: Type<any>;
    useValue?: any;
    useExisting?: any;
    useFactory?: Function;
    deps?: Object[];
    multi?: boolean;
}): Provider;

/** @deprecated */
export declare class Provider {
    dependencies: Object[];
    multi: boolean;
    token: any;
    useClass: Type<any>;
    useExisting: any;
    useFactory: Function;
    useValue: any;
    constructor(token: any, {useClass, useValue, useExisting, useFactory, deps, multi}: {
        useClass?: Type<any>;
        useValue?: any;
        useExisting?: any;
        useFactory?: Function;
        deps?: Object[];
        multi?: boolean;
    });
}

/** @deprecated */
export declare class ProviderBuilder {
    token: any;
    constructor(token: any);
    toAlias(aliasToken: any): Provider;
    toClass(type: Type<any>): Provider;
    toFactory(factory: Function, dependencies?: any[]): Provider;
    toValue(value: any): Provider;
}

/** @deprecated */
export declare var Query: QueryMetadataFactory;

/** @stable */
export declare class QueryList<T> {
    changes: Observable<any>;
    dirty: boolean;
    first: T;
    last: T;
    length: number;
    filter(fn: (item: T, index: number, array: T[]) => boolean): T[];
    forEach(fn: (item: T, index: number, array: T[]) => void): void;
    map<U>(fn: (item: T, index: number, array: T[]) => U): U[];
    notifyOnChanges(): void;
    reduce<U>(fn: (prevValue: U, curValue: T, curIndex: number, array: T[]) => U, init: U): U;
    reset(res: Array<T | any[]>): void;
    setDirty(): void;
    some(fn: (value: T, index: number, array: T[]) => boolean): boolean;
    toArray(): T[];
    toString(): string;
}

/** @deprecated */
export declare class QueryMetadata extends DependencyMetadata {
    descendants: boolean;
    first: boolean;
    isVarBindingQuery: boolean;
    isViewQuery: boolean;
    read: any;
    selector: any;
    varBindings: string[];
    constructor(_selector: Type<any> | string, {descendants, first, read}?: {
        descendants?: boolean;
        first?: boolean;
        read?: any;
    });
    toString(): string;
}

/** @deprecated */
export interface QueryMetadataFactory {
    (selector: Type<any> | Function | string, {descendants, read}?: {
        descendants?: boolean;
        read?: any;
    }): ParameterDecorator;
    new (selector: Type<any> | Function | string, {descendants, read}?: {
        descendants?: boolean;
        read?: any;
    }): QueryMetadata;
}

/** @stable */
export declare abstract class ReflectiveInjector implements Injector {
    parent: Injector;
    createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
    abstract get(token: any, notFoundValue?: any): any;
    instantiateResolved(provider: ResolvedReflectiveProvider): any;
    resolveAndCreateChild(providers: Array<Type<any> | Provider | {
        [k: string]: any;
    } | any[]>): ReflectiveInjector;
    resolveAndInstantiate(provider: Type<any> | Provider): any;
    /** @deprecated */ static fromResolvedBindings(providers: ResolvedReflectiveProvider[]): ReflectiveInjector;
    /** @experimental */ static fromResolvedProviders(providers: ResolvedReflectiveProvider[], parent?: Injector): ReflectiveInjector;
    static resolve(providers: Array<Type<any> | Provider | {
        [k: string]: any;
    } | any[]>): ResolvedReflectiveProvider[];
    static resolveAndCreate(providers: Array<Type<any> | Provider | {
        [k: string]: any;
    } | any[]>, parent?: Injector): ReflectiveInjector;
}

/** @experimental */
export declare class ReflectiveKey {
    displayName: string;
    id: number;
    token: Object;
    constructor(token: Object, id: number);
    static numberOfKeys: number;
    static get(token: Object): ReflectiveKey;
}

/** @experimental */
export declare class RenderComponentType {
    animations: {
        [key: string]: Function;
    };
    encapsulation: ViewEncapsulation;
    id: string;
    slotCount: number;
    styles: Array<string | any[]>;
    templateUrl: string;
    constructor(id: string, templateUrl: string, slotCount: number, encapsulation: ViewEncapsulation, styles: Array<string | any[]>, animations: {
        [key: string]: Function;
    });
}

/** @experimental */
export declare abstract class Renderer {
    abstract animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string): AnimationPlayer;
    abstract attachViewAfter(node: any, viewRootNodes: any[]): void;
    abstract createElement(parentElement: any, name: string, debugInfo?: RenderDebugInfo): any;
    abstract createTemplateAnchor(parentElement: any, debugInfo?: RenderDebugInfo): any;
    abstract createText(parentElement: any, value: string, debugInfo?: RenderDebugInfo): any;
    abstract createViewRoot(hostElement: any): any;
    abstract destroyView(hostElement: any, viewAllNodes: any[]): void;
    abstract detachView(viewRootNodes: any[]): void;
    abstract invokeElementMethod(renderElement: any, methodName: string, args?: any[]): void;
    abstract listen(renderElement: any, name: string, callback: Function): Function;
    abstract listenGlobal(target: string, name: string, callback: Function): Function;
    abstract projectNodes(parentElement: any, nodes: any[]): void;
    abstract selectRootElement(selectorOrNode: string | any, debugInfo?: RenderDebugInfo): any;
    abstract setBindingDebugInfo(renderElement: any, propertyName: string, propertyValue: string): void;
    abstract setElementAttribute(renderElement: any, attributeName: string, attributeValue: string): void;
    abstract setElementClass(renderElement: any, className: string, isAdd: boolean): void;
    abstract setElementProperty(renderElement: any, propertyName: string, propertyValue: any): void;
    abstract setElementStyle(renderElement: any, styleName: string, styleValue: string): void;
    abstract setText(renderNode: any, text: string): void;
}

/** @deprecated */
export interface ResolvedReflectiveBinding extends ResolvedReflectiveProvider {
}

/** @experimental */
export declare class ResolvedReflectiveFactory {
    dependencies: ReflectiveDependency[];
    factory: Function;
    constructor(
        factory: Function,
        dependencies: ReflectiveDependency[]);
}

/** @experimental */
export interface ResolvedReflectiveProvider {
    key: ReflectiveKey;
    multiProvider: boolean;
    resolvedFactories: ResolvedReflectiveFactory[];
}

/** @experimental */
export declare function resolveForwardRef(type: any): any;

/** @experimental */
export declare abstract class RootRenderer {
    abstract renderComponent(componentType: RenderComponentType): Renderer;
}

/** @stable */
export declare abstract class SanitizationService {
    abstract sanitize(context: SecurityContext, value: string): string;
}

/** @experimental */
export interface SchemaMetadata {
    name: string;
}

/** @stable */
export declare enum SecurityContext {
    NONE = 0,
    HTML = 1,
    STYLE = 2,
    SCRIPT = 3,
    URL = 4,
    RESOURCE_URL = 5,
}

/** @stable */
export declare var Self: SelfMetadataFactory;

/** @stable */
export declare class SelfMetadata {
    toString(): string;
}

/** @stable */
export interface SelfMetadataFactory {
    (): any;
    new (): SelfMetadata;
}

/** @experimental */
export declare function sequence(steps: AnimationMetadata[]): AnimationSequenceMetadata;

/** @experimental */
export declare function setTestabilityGetter(getter: GetTestability): void;

/** @stable */
export declare class SimpleChange {
    currentValue: any;
    previousValue: any;
    constructor(previousValue: any, currentValue: any);
    isFirstChange(): boolean;
}

/** @stable */
export interface SimpleChanges {
    [propName: string]: SimpleChange;
}

/** @stable */
export declare var SkipSelf: SkipSelfMetadataFactory;

/** @stable */
export declare class SkipSelfMetadata {
    toString(): string;
}

/** @stable */
export interface SkipSelfMetadataFactory {
    (): any;
    new (): SkipSelfMetadata;
}

/** @experimental */
export declare function state(stateNameExpr: string, styles: AnimationStyleMetadata): AnimationStateDeclarationMetadata;

/** @experimental */
export declare function style(tokens: string | {
    [key: string]: string | number;
} | Array<string | {
    [key: string]: string | number;
}>): AnimationStyleMetadata;

/** @deprecated */
export declare class SystemJsCmpFactoryResolver implements ComponentResolver {
    constructor(_console: Console);
    clearCache(): void;
    resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
}

/** @deprecated */
export declare class SystemJsComponentResolver implements ComponentResolver {
    constructor(_resolver: ComponentResolver, _console: Console);
    clearCache(): void;
    resolveComponent(componentType: string | Type<any>): Promise<ComponentFactory<any>>;
}

/** @experimental */
export declare class SystemJsNgModuleLoader implements NgModuleFactoryLoader {
    constructor(_compiler: Compiler);
    load(path: string): Promise<NgModuleFactory<any>>;
}

/** @stable */
export declare abstract class TemplateRef<C> {
    elementRef: ElementRef;
    abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
}

/** @experimental */
export declare class Testability {
    constructor(_ngZone: NgZone);
    decreasePendingRequestCount(): number;
    findBindings(using: any, provider: string, exactMatch: boolean): any[];
    findProviders(using: any, provider: string, exactMatch: boolean): any[];
    getPendingRequestCount(): number;
    increasePendingRequestCount(): number;
    isStable(): boolean;
    whenStable(callback: Function): void;
}

/** @experimental */
export declare class TestabilityRegistry {
    constructor();
    findTestabilityInTree(elem: Node, findInAncestors?: boolean): Testability;
    getAllRootElements(): any[];
    getAllTestabilities(): Testability[];
    getTestability(elem: any): Testability;
    registerApplication(token: any, testability: Testability): void;
}

/** @stable */
export interface TrackByFn {
    (index: number, item: any): any;
}

/** @experimental */
export declare function transition(stateChangeExpr: string, steps: AnimationMetadata | AnimationMetadata[]): AnimationStateTransitionMetadata;

/** @experimental */
export declare function trigger(name: string, animation: AnimationMetadata[]): AnimationEntryMetadata;

/** @stable */
export declare var Type: FunctionConstructor;

/** @stable */
export interface TypeDecorator {
    annotations: any[];
    (target: Object, propertyKey?: string | symbol, parameterIndex?: number): void;
    <T extends Type<any>>(type: T): T;
    Class(obj: ClassDefinition): Type<any>;
}

/** @stable */
export declare var ViewChild: ViewChildMetadataFactory;

/** @stable */
export declare class ViewChildMetadata extends ViewQueryMetadata {
    constructor(_selector: Type<any> | string, {read}?: {
        read?: any;
    });
}

/** @stable */
export interface ViewChildMetadataFactory {
    (selector: Type<any> | Function | string, {read}?: {
        read?: any;
    }): any;
    new (selector: Type<any> | Function | string, {read}?: {
        read?: any;
    }): ViewChildMetadataFactory;
}

/** @stable */
export declare var ViewChildren: ViewChildrenMetadataFactory;

/** @stable */
export declare class ViewChildrenMetadata extends ViewQueryMetadata {
    constructor(_selector: Type<any> | string, {read}?: {
        read?: any;
    });
}

/** @stable */
export interface ViewChildrenMetadataFactory {
    (selector: Type<any> | Function | string, {read}?: {
        read?: any;
    }): any;
    new (selector: Type<any> | Function | string, {read}?: {
        read?: any;
    }): ViewChildrenMetadata;
}

/** @stable */
export declare abstract class ViewContainerRef {
    element: ElementRef;
    injector: Injector;
    length: number;
    parentInjector: Injector;
    abstract clear(): void;
    abstract createComponent<C>(componentFactory: ComponentFactory<C>, index?: number, injector?: Injector, projectableNodes?: any[][]): ComponentRef<C>;
    abstract createEmbeddedView<C>(templateRef: TemplateRef<C>, context?: C, index?: number): EmbeddedViewRef<C>;
    abstract detach(index?: number): ViewRef;
    abstract get(index: number): ViewRef;
    abstract indexOf(viewRef: ViewRef): number;
    abstract insert(viewRef: ViewRef, index?: number): ViewRef;
    abstract move(viewRef: ViewRef, currentIndex: number): ViewRef;
    abstract remove(index?: number): void;
}

/** @stable */
export declare enum ViewEncapsulation {
    Emulated = 0,
    Native = 1,
    None = 2,
}

/** @deprecated */
export declare class ViewMetadata {
    animations: AnimationEntryMetadata[];
    directives: Array<Type<any> | any[]>;
    encapsulation: ViewEncapsulation;
    interpolation: [string, string];
    pipes: Array<Type<any> | any[]>;
    styleUrls: string[];
    styles: string[];
    template: string;
    templateUrl: string;
    constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls, animations, interpolation}?: {
        templateUrl?: string;
        template?: string;
        directives?: Array<Type<any> | any[]>;
        pipes?: Array<Type<any> | any[]>;
        encapsulation?: ViewEncapsulation;
        styles?: string[];
        styleUrls?: string[];
        animations?: AnimationEntryMetadata[];
        interpolation?: [string, string];
    });
}

/** @deprecated */
export declare var ViewQuery: QueryMetadataFactory;

/** @deprecated */
export declare class ViewQueryMetadata extends QueryMetadata {
    isViewQuery: boolean;
    constructor(_selector: Type<any> | string, {descendants, first, read}?: {
        descendants?: boolean;
        first?: boolean;
        read?: any;
    });
    toString(): string;
}

/** @stable */
export declare abstract class ViewRef {
    destroyed: boolean;
    abstract onDestroy(callback: Function): any;
}

/** @stable */
export declare class WrappedException extends BaseWrappedException {
    context: any;
    message: string;
    originalException: any;
    originalStack: any;
    wrapperMessage: string;
    wrapperStack: any;
    constructor(_wrapperMessage: string, _originalException: any, _originalStack?: any, _context?: any);
    toString(): string;
}

/** @stable */
export declare class WrappedValue {
    wrapped: any;
    constructor(wrapped: any);
    static wrap(value: any): WrappedValue;
}

/** @experimental */
export declare var wtfCreateScope: (signature: string, flags?: any) => WtfScopeFn;

/** @experimental */
export declare var wtfEndTimeRange: (range: any) => void;

/** @experimental */
export declare var wtfLeave: <T>(scope: any, returnValue?: T) => T;

/** @experimental */
export interface WtfScopeFn {
    (arg0?: any, arg1?: any): any;
}

/** @experimental */
export declare var wtfStartTimeRange: (rangeType: string, action: string) => any;


text:
require 'spec_helper_system'

describe 'ceph::repo' do

  release2version = {
    'dumpling' => '0.67',
    'firefly' => '0.80',
    'giant' => '0.87',
    'hammer' => '0.94',
    '(default)' => '0.94',
  }

  releases = ENV['RELEASES'] ? ENV['RELEASES'].split : release2version.keys

  # on RedHat family we need to remove with the correct release,
  # and at this point we do not know what is currently installed
  it 'should remove repo independent of release' do
    releases.each do |release|

      release_arg = release == '(default)' ? '' : "release => '#{release}',"
      pp = <<-EOS
        class { 'ceph::repo':
          #{release_arg}
          ensure  => absent,
          extras  => true,
          fastcgi => true,
        }
      EOS

      puppet_apply(pp) do |r|
        expect(r.exit_code).not_to eq(1)
      end
    end

    osfamily = facter.facts['osfamily']

    if osfamily == 'Debian'
      shell 'apt-cache policy ceph' do |r|
        expect(r.stdout).not_to match(/ceph.com/)
        expect(r.stderr).to be_empty
        expect(r.exit_code).to be_zero
      end
      shell 'apt-cache policy curl' do |r|
        expect(r.stdout).not_to match(/ceph.com/)
        expect(r.exit_code).to be_zero
      end
      shell 'apt-cache policy libapache2-mod-fastcgi' do |r|
        expect(r.stdout).not_to match(/ceph.com/)
        expect(r.exit_code).to be_zero
      end
    end
    if osfamily == 'RedHat'
      shell 'yum info ceph' do |r|
        expect(r.stdout).not_to match(/ceph.com/)
        expect(r.stderr).to match(/Error: No matching Packages to list/)
        expect(r.exit_code).not_to be_zero
      end
      shell 'yum info qemu-kvm' do |r|
        expect(r.stdout).not_to match(/Repo.*ext-ceph-extras/)
        expect(r.exit_code).to be_zero
      end
      shell 'yum info mod_fastcgi' do |r|
        expect(r.stdout).not_to match(/Repo.*ext-ceph-fastcgi/)
        expect(r.stderr).to match(/Error: No matching Packages to list/)
        expect(r.exit_code).not_to be_zero
      end
    end
  end

  releases.each do |release|

    release_arg = release == '(default)' ? '' : "release => '#{release}',"

    describe release do

      version = release2version[release]

      it "should find #{version}" do
        osfamily = facter.facts['osfamily']

        osfamily2querycommand = {
          'Debian' => 'apt-cache policy ceph',
          'RedHat' => 'yum info ceph',
        }
        osfamily2queryresult = {
          'Debian' => "Candidate: #{version}" ,
          'RedHat' => "Version     : #{version}",
        }

        querycommand = osfamily2querycommand[osfamily]
        queryresult = osfamily2queryresult[osfamily]

        pp = <<-EOS
          class { 'ceph::repo':
            #{release_arg}
          }
        EOS

        # Run it twice and test for idempotency
        puppet_apply(pp) do |r|
          expect(r.exit_code).not_to eq(1)
          r.refresh
          expect(r.exit_code).not_to eq(1)
        end

        shell querycommand do |r|
          expect(r.stdout).to match(/#{queryresult}/)
          expect(r.stderr).to be_empty
          expect(r.exit_code).to be_zero
        end

        # Test extras is not enabled
        if osfamily == 'Debian'
          shell 'apt-cache policy curl' do |r|
            expect(r.stdout).not_to match(/ceph\.com.*ceph-extras/)
            expect(r.exit_code).to be_zero
          end
        end
        if osfamily == 'RedHat'
          shell 'yum info qemu-kvm' do |r|
            expect(r.stdout).not_to match(/Repo.*ext-ceph-extras/)
            expect(r.exit_code).to be_zero
          end
        end

        # On RedHat family we need to use the version when removing
        pp = <<-EOS
          class { 'ceph::repo':
            ensure  => absent,
            #{release_arg}
          }
        EOS

        # Run it twice and test for idempotency
        puppet_apply(pp) do |r|
          expect(r.exit_code).not_to eq(1)
          r.refresh
          expect(r.exit_code).not_to eq(1)
        end

        if osfamily == 'Debian'
          shell querycommand do |r|
            expect(r.stdout).not_to match(/ceph.com/)
            expect(r.stderr).to be_empty
            expect(r.exit_code).to be_zero
          end
        end
        if osfamily == 'RedHat'
          shell querycommand do |r|
            expect(r.stdout).not_to match(/ceph.com/)
            expect(r.stderr).to match(/Error: No matching Packages to list/)
            expect(r.exit_code).not_to be_zero
          end
        end
      end

      it "should find curl/qemu-kvm in ceph-extras" do
        osfamily = facter.facts['osfamily']

        pp = <<-EOS
          class { 'ceph::repo':
            #{release_arg}
            extras => true,
          }
        EOS

        # Run it twice and test for idempotency
        puppet_apply(pp) do |r|
          expect(r.exit_code).not_to eq(1)
          r.refresh
          expect(r.exit_code).not_to eq(1)
        end

        # Test for a package in ceph-extras (curl/qemu-kvm)
        if osfamily == 'Debian'
          shell 'apt-cache policy curl' do |r|
            expect(r.stdout).to match(/ceph\.com.*ceph-extras/)
            expect(r.stderr).to be_empty
            expect(r.exit_code).to be_zero
          end
        end
        if osfamily == 'RedHat'
          shell 'yum info qemu-kvm' do |r|
            expect(r.stdout).to match(/Repo.*ext-ceph-extras/)
            expect(r.stderr).to be_empty
            expect(r.exit_code).to be_zero
          end
        end

        # On RedHat family we need to use the version when removing
        pp = <<-EOS
          class { 'ceph::repo':
            ensure => absent,
            extras => true,
            #{release_arg}
          }
        EOS

        # Run it twice and test for idempotency
        puppet_apply(pp) do |r|
          expect(r.exit_code).not_to eq(1)
          r.refresh
          expect(r.exit_code).not_to eq(1)
        end

        if osfamily == 'Debian'
          shell 'apt-cache policy curl' do |r|
            expect(r.stdout).not_to match(/ceph.com/)
            expect(r.exit_code).to be_zero
          end
        end
        if osfamily == 'RedHat'
          shell 'yum info qemu-kvm' do |r|
            expect(r.stdout).not_to match(/Repo.*ext-ceph-extras/)
            expect(r.exit_code).to be_zero
          end
        end
      end

      it "should find fastcgi in ceph-fastcgi" do
        osfamily = facter.facts['osfamily']

        pp = <<-EOS
          class { 'ceph::repo':
            #{release_arg}
            fastcgi => true,
          }
        EOS

        # Run it twice and test for idempotency
        puppet_apply(pp) do |r|
          expect(r.exit_code).not_to eq(1)
          r.refresh
          expect(r.exit_code).not_to eq(1)
        end

        # Test fastcgi in ceph-fastcgi
        if osfamily == 'Debian'
          shell 'apt-cache policy libapache2-mod-fastcgi' do |r|
            expect(r.stdout).to match(/ceph.com/)
            expect(r.stderr).to be_empty
            expect(r.exit_code).to be_zero
          end
        end
        if osfamily == 'RedHat'
          shell 'yum info mod_fastcgi' do |r|
            expect(r.stdout).to match(/Repo.*ext-ceph-fastcgi/)
            expect(r.stderr).to be_empty
            expect(r.exit_code).to be_zero
          end
        end

        # On RedHat family we need to use the version when removing
        pp = <<-EOS
          class { 'ceph::repo':
            ensure  => absent,
            fastcgi => true,
            #{release_arg}
          }
        EOS

        # Run it twice and test for idempotency
        puppet_apply(pp) do |r|
          expect(r.exit_code).not_to eq(1)
          r.refresh
          expect(r.exit_code).not_to eq(1)
        end

        if osfamily == 'Debian'
          shell 'apt-cache policy libapache2-mod-fastcgi' do |r|
            expect(r.stdout).not_to match(/ceph.com/)
            expect(r.exit_code).to be_zero
          end
        end
        if osfamily == 'RedHat'
          shell 'yum info mod_fastcgi' do |r|
            expect(r.stdout).not_to match(/Repo.*ext-ceph-fastcgi/)
            expect(r.stderr).to match(/Error: No matching Packages to list/)
            expect(r.exit_code).not_to be_zero
          end
        end
      end
    end
  end
end
# Local Variables:
# compile-command: "cd ../..
#   (
#     cd .rspec_system/vagrant_projects/ubuntu-server-1204-x64
#     vagrant destroy --force
#   )
#   cp -a Gemfile-rspec-system Gemfile
#   BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
#   MACHINES=first \
#   RELEASES=dumpling \
#   RS_DESTROY=no \
#   RS_SET=ubuntu-server-1204-x64 \
#   BUNDLE_PATH=/tmp/vendor \
#   bundle exec rake spec:system SPEC=spec/system/ceph_repo_spec.rb &&
#   git checkout Gemfile
# "
# End:


text:
// <copyright file="SnapshottingDictionary.cs" company="Microsoft">
// Copyright © Microsoft. All Rights Reserved.
// </copyright>

namespace Microsoft.HockeyApp.Extensibility.Implementation
{
    using System.Collections.Generic;

    internal class SnapshottingDictionary<TKey, TValue> : SnapshottingCollection<KeyValuePair<TKey, TValue>, IDictionary<TKey, TValue>>, IDictionary<TKey, TValue>
    {
        public SnapshottingDictionary()
            : base(new Dictionary<TKey, TValue>())
        {
        }

        public ICollection<TKey> Keys
        {
            get { return this.GetSnapshot().Keys; }
        }

        public ICollection<TValue> Values
        {
            get { return this.GetSnapshot().Values; }
        }

        public TValue this[TKey key]
        {
            get
            {
                return this.GetSnapshot()[key];
            }

            set
            {
                lock (this.Collection)
                {
                    this.Collection[key] = value;
                    this.snapshot = null;
                }
            }
        }

        public void Add(TKey key, TValue value)
        {
            lock (this.Collection)
            {
                this.Collection.Add(key, value);
                this.snapshot = null;
            }
        }

        public bool ContainsKey(TKey key)
        {
            return this.GetSnapshot().ContainsKey(key);
        }

        public bool Remove(TKey key)
        {
            lock (this.Collection)
            {
                bool removed = this.Collection.Remove(key);
                if (removed)
                {
                    this.snapshot = null;
                }

                return removed;
            }
        }

        public bool TryGetValue(TKey key, out TValue value)
        {
            return this.GetSnapshot().TryGetValue(key, out value);
        }

        protected sealed override IDictionary<TKey, TValue> CreateSnapshot(IDictionary<TKey, TValue> collection)
        {
            return new Dictionary<TKey, TValue>(collection);
        }
    }
}


text:
package com.jsunsoft.http;

import org.apache.hc.client5.http.ClientProtocolException;
import org.apache.hc.client5.http.ConnectTimeoutException;
import org.apache.hc.client5.http.HttpHostConnectException;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.core5.http.*;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.message.HeaderGroup;
import org.apache.hc.core5.net.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.Collection;

import static com.jsunsoft.http.BasicConnectionFailureType.*;
import static org.apache.hc.core5.http.HttpStatus.*;

class BasicWebTarget implements WebTarget {
    private static final Logger LOGGER = LoggerFactory.getLogger(BasicWebTarget.class);

    private final CloseableHttpClient closeableHttpClient;
    private final URIBuilder uriBuilder;
    private final HttpUriRequestBuilder httpUriRequestBuilder;
    private final ResponseBodyReaderConfig responseBodyReaderConfig;

    BasicWebTarget(CloseableHttpClient closeableHttpClient, URI uri, Collection<Header> defaultHeaders, Collection<NameValuePair> defaultRequestParameters, ResponseBodyReaderConfig responseBodyReaderConfig) {
        this(closeableHttpClient, new URIBuilder(uri), defaultHeaders, defaultRequestParameters, responseBodyReaderConfig);
    }

    BasicWebTarget(CloseableHttpClient closeableHttpClient, String uri, Collection<Header> defaultHeaders, Collection<NameValuePair> defaultRequestParameters, ResponseBodyReaderConfig responseBodyReaderConfig) throws URISyntaxException {
        this(closeableHttpClient, new URIBuilder(uri), defaultHeaders, defaultRequestParameters, responseBodyReaderConfig);
    }

    private BasicWebTarget(CloseableHttpClient closeableHttpClient, URIBuilder uriBuilder, Collection<Header> defaultHeaders, Collection<NameValuePair> defaultRequestParameters, ResponseBodyReaderConfig responseBodyReaderConfig) {
        this.closeableHttpClient = closeableHttpClient;
        this.uriBuilder = uriBuilder;
        this.responseBodyReaderConfig = responseBodyReaderConfig;
        this.httpUriRequestBuilder = new HttpUriRequestBuilder();

        defaultHeaders.forEach(httpUriRequestBuilder::addHeader);
        defaultRequestParameters.forEach(httpUriRequestBuilder::addParameter);
    }

    BasicWebTarget(CloseableHttpClient closeableHttpClient, URIBuilder uriBuilder, HttpUriRequestBuilder httpUriRequestBuilder, ResponseBodyReaderConfig responseBodyReaderConfig) {
        this.closeableHttpClient = closeableHttpClient;
        this.uriBuilder = uriBuilder;
        this.httpUriRequestBuilder = httpUriRequestBuilder;
        this.responseBodyReaderConfig = responseBodyReaderConfig;
    }

    /**
     * Copy constructor
     *
     * @param source source WebTarget instance from which new WebTarget must be initialized
     */
    BasicWebTarget(BasicWebTarget source) {
        this.closeableHttpClient = source.getCloseableHttpClient();
        this.uriBuilder = source.getUriBuilder();
        this.responseBodyReaderConfig = source.getResponseBodyReaderConfig();
        this.httpUriRequestBuilder = source.getHttpUriRequestBuilder();
    }

    @Override
    public WebTarget path(String path) {
        ArgsCheck.notNull(path, "path");

        HttpRequestUtils.appendPath(uriBuilder, path);
        return this;
    }

    @Override
    public WebTarget setPath(String path) {
        ArgsCheck.notNull(path, "path");

        uriBuilder.setPath(path);

        return this;
    }

    @Override
    public Response request(HttpMethod method, HttpEntity httpEntity) {
        ArgsCheck.notNull(method, "method");

        httpUriRequestBuilder.setEntity(httpEntity);
        return request(method);
    }

    @Override
    public <T> ResponseHandler<T> request(HttpMethod method, HttpEntity httpEntity, Class<T> responseType) {
        httpUriRequestBuilder.setEntity(httpEntity);
        return request(method, responseType);
    }

    @Override
    public <T> ResponseHandler<T> request(HttpMethod method, HttpEntity httpEntity, TypeReference<T> responseType) {
        ArgsCheck.notNull(method, "method");
        ArgsCheck.notNull(responseType, "responseType");

        httpUriRequestBuilder.setEntity(httpEntity);
        return request(method, responseType);
    }

    @Override
    public <T> ResponseHandler<T> request(HttpMethod method, Class<T> responseType) {
        ArgsCheck.notNull(method, "method");
        ArgsCheck.notNull(responseType, "responseType");

        return request(method, new TypeReference<>(responseType));
    }

    @Override
    public Response request(HttpMethod method) {
        ArgsCheck.notNull(method, "method");

        ClassicHttpRequest request = resolveRequest(method);

        URI uri = resolveRequestURI(request);

        try {
            return new BasicResponse(closeableHttpClient.execute(request), responseBodyReaderConfig, uri);
        } catch (ConnectionRequestTimeoutException e) {
            throw new ResponseException(SC_SERVICE_UNAVAILABLE, "Connection pool is empty for request on uri: [" + request.getRequestUri() + "]. Status code: " + SC_SERVICE_UNAVAILABLE, uri, CONNECTION_POOL_IS_EMPTY, e);
        } catch (ConnectTimeoutException e) {
            throw new ResponseException(SC_SERVICE_UNAVAILABLE, "HttpRequest is unable to establish a connection with the: [" + request.getRequestUri() + "] within the given period of time or Connection pool is empty. Status code: " + SC_SERVICE_UNAVAILABLE, uri, CONNECTION_POOL_IS_EMPTY, e);
        } catch (SocketTimeoutException | NoHttpResponseException e) {
            //todo support retry when NoHttpResponseException
            throw new ResponseException(SC_SERVICE_UNAVAILABLE, "Server on uri: [" + request.getRequestUri() + "] is high loaded. Status code: " + SC_SERVICE_UNAVAILABLE, uri, REMOTE_SERVER_HIGH_LOADED, e);
        } catch (HttpHostConnectException e) {
            throw new ResponseException(SC_SERVICE_UNAVAILABLE, "Server on uri: [" + uri + "] is down. Status code: " + SC_SERVICE_UNAVAILABLE, uri, REMOTE_SERVER_IS_DOWN, e);
        } catch (ClientProtocolException e) {
            throw new RequestException("Error in the HTTP protocol. URI: [" + uri + "]", e);
        } catch (IOException e) {
            throw new ResponseException(SC_SERVICE_UNAVAILABLE, "Connection was aborted for request on uri: [" + uri + "]. Status code: " + SC_SERVICE_UNAVAILABLE, uri, IO, e);
        }
    }

    private ClassicHttpRequest resolveRequest(HttpMethod method) {

        return httpUriRequestBuilder.setMethod(method.name()).setUri(getURI()).build();
    }

    private URI resolveRequestURI(ClassicHttpRequest request) {
        try {
            return request.getUri();
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("URI syntax is incorrect. URI: [" + getURIString() + "].", e);
        }
    }

    @Override
    public <T> ResponseHandler<T> request(HttpMethod method, TypeReference<T> typeReference) {
        CustomArgsCheck.checkIsCorrectTypeForDeserialization(typeReference.getRawType());

        long startTime = System.currentTimeMillis();

        ResponseHandler<T> result;

        try (Response response = request(method)) {

            int statusCode = response.getCode();
            HttpEntity httpEntity = response.getEntity();
            LOGGER.info("Response code from uri: [{}] is {}", response.getURI(), statusCode);

            boolean hasBody = HttpRequestUtils.hasBody(statusCode);

            T content = null;
            String failedMessage = null;
            if (hasBody && httpEntity == null) {
                failedMessage = "Response entity is null";
                LOGGER.debug("{} .Uri: [{}]. Status code: {}", failedMessage, response.getURI(), statusCode);
                statusCode = SC_BAD_GATEWAY;
            } else {
                try {
                    if (!HttpRequestUtils.isVoidType(typeReference.getRawType()) && hasBody && HttpRequestUtils.isSuccess(statusCode)) {

                        content = response.readEntityChecked(typeReference);

                        LOGGER.trace("Result of Uri: [{}] is {}", response.getURI(), content);
                    } else if (HttpRequestUtils.isNonSuccess(statusCode)) {

                        failedMessage = response.readEntityChecked(String.class);
                        String logMsg = "Unexpected Response. Url: [" + response.getURI() + "] Status code: " + statusCode + ", Error message: " + failedMessage;
                        if (statusCode == SC_BAD_REQUEST) {
                            LOGGER.warn(logMsg);
                        } else {
                            LOGGER.debug(logMsg);
                        }
                    }
                } catch (ResponseBodyReaderException e) {
                    failedMessage = "Response deserialization failed. Cannot deserialize response to: [" + typeReference + "]." + e;
                    LOGGER.debug(failedMessage + ". Uri: [" + response.getURI() + "]. Status code: " + statusCode, e);
                    statusCode = SC_BAD_GATEWAY;
                } catch (IOException e) {
                    failedMessage = "Get content from response failed: " + e;
                    LOGGER.debug("Stream could not be created. Uri: [" + response.getURI() + "]. Status code: " + statusCode, e);
                    statusCode = SC_SERVICE_UNAVAILABLE;
                }
            }

            HeaderGroup headerGroup = new HeaderGroup();
            headerGroup.setHeaders(response.getHeaders());

            ContentType responseContentType = HttpRequestUtils.getContentTypeFromHttpEntity(httpEntity);
            EntityUtils.consumeQuietly(httpEntity);
            result = new BasicResponseHandler<>(content, statusCode, headerGroup, failedMessage, typeReference.getType(), responseContentType, response.getURI());

        } catch (ResponseException e) {
            result = new BasicResponseHandler<>(null, e.getStatusCode(), e.getMessage(), typeReference.getType(), null, e.getURI(), e.getConnectionFailureType());
            LOGGER.debug("Request failed.", e);
        } catch (IOException e) {
            LOGGER.warn("Resources close failed.", e);
            result = new BasicResponseHandler<>(null, SC_INTERNAL_SERVER_ERROR, "Resources close failed. " + e, typeReference.getType(), null, getURI(), IO);
        }
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Executing of uri: [{}] completed. Time: {}", result.getURI(), HttpRequestUtils.humanTime(startTime));
        }
        LOGGER.trace("Executed result: {}", result);
        return result;
    }

    @Override
    public URI getURI() {
        URI uri;
        try {
            uri = uriBuilder.build().normalize();
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("URI syntax is incorrect. URI: [" + getURIString() + "].", e);
        }
        return uri;
    }

    @Override
    public String getURIString() {
        return uriBuilder.toString();
    }

    @Override
    public WebTarget removeHeader(Header header) {
        ArgsCheck.notNull(header, "method");

        httpUriRequestBuilder.removeHeader(header);
        return this;
    }

    @Override
    public WebTarget removeHeaders(String name) {
        ArgsCheck.notNull(name, "name");

        httpUriRequestBuilder.removeHeaders(name);

        return this;
    }

    @Override
    public WebTarget updateHeader(Header header) {
        ArgsCheck.notNull(header, "header");

        httpUriRequestBuilder.setHeader(header);
        return this;
    }

    @Override
    public WebTarget addHeader(Header header) {
        ArgsCheck.notNull(header, "header");

        httpUriRequestBuilder.addHeader(header);
        return this;
    }

    @Override
    public WebTarget setCharset(Charset charset) {
        httpUriRequestBuilder.setCharset(charset);

        return this;
    }

    @Override
    public WebTarget setRequestConfig(RequestConfig requestConfig) {
        httpUriRequestBuilder.setConfig(requestConfig);
        return this;
    }

    @Override
    public WebTarget addParameter(NameValuePair nameValuePair) {
        ArgsCheck.notNull(nameValuePair, "nameValuePair");

        httpUriRequestBuilder.addParameter(nameValuePair);
        return this;
    }

    CloseableHttpClient getCloseableHttpClient() {
        return closeableHttpClient;
    }

    URIBuilder getUriBuilder() {
        return new URIBuilder(getURI());
    }

    HttpUriRequestBuilder getHttpUriRequestBuilder() {
        return httpUriRequestBuilder.copyBuilder();
    }

    ResponseBodyReaderConfig getResponseBodyReaderConfig() {
        return responseBodyReaderConfig;
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Elench. fung. (Greifswald) 2: 90 (1828)

#### Original name
Sphaeria fulva Fr., 1828

### Remarks
null


text:
package descriptor

import (
	"testing"

	"google.golang.org/protobuf/encoding/prototext"
	"google.golang.org/protobuf/types/descriptorpb"
)

func TestGoPackageStandard(t *testing.T) {
	for _, spec := range []struct {
		pkg  GoPackage
		want bool
	}{
		{
			pkg:  GoPackage{Path: "fmt", Name: "fmt"},
			want: true,
		},
		{
			pkg:  GoPackage{Path: "encoding/json", Name: "json"},
			want: true,
		},
		{
			pkg:  GoPackage{Path: "google.golang.org/protobuf/encoding/protojson", Name: "jsonpb"},
			want: false,
		},
		{
			pkg:  GoPackage{Path: "golang.org/x/net/context", Name: "context"},
			want: false,
		},
		{
			pkg:  GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"},
			want: false,
		},
		{
			pkg:  GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"},
			want: false,
		},
	} {
		if got, want := spec.pkg.Standard(), spec.want; got != want {
			t.Errorf("%#v.Standard() = %v; want %v", spec.pkg, got, want)
		}
	}
}

func TestGoPackageString(t *testing.T) {
	for _, spec := range []struct {
		pkg  GoPackage
		want string
	}{
		{
			pkg:  GoPackage{Path: "fmt", Name: "fmt"},
			want: `"fmt"`,
		},
		{
			pkg:  GoPackage{Path: "encoding/json", Name: "json"},
			want: `"encoding/json"`,
		},
		{
			pkg:  GoPackage{Path: "google.golang.org/protobuf/encoding/protojson", Name: "jsonpb"},
			want: `"google.golang.org/protobuf/encoding/protojson"`,
		},
		{
			pkg:  GoPackage{Path: "golang.org/x/net/context", Name: "context"},
			want: `"golang.org/x/net/context"`,
		},
		{
			pkg:  GoPackage{Path: "github.com/grpc-ecosystem/grpc-gateway", Name: "main"},
			want: `"github.com/grpc-ecosystem/grpc-gateway"`,
		},
		{
			pkg:  GoPackage{Path: "github.com/google/googleapis/google/api/http.pb", Name: "http_pb", Alias: "htpb"},
			want: `htpb "github.com/google/googleapis/google/api/http.pb"`,
		},
	} {
		if got, want := spec.pkg.String(), spec.want; got != want {
			t.Errorf("%#v.String() = %q; want %q", spec.pkg, got, want)
		}
	}
}

func TestFieldPath(t *testing.T) {
	var fds []*descriptorpb.FileDescriptorProto
	for _, src := range []string{
		`
		name: 'example.proto'
		package: 'example'
		message_type <
			name: 'Nest'
			field <
				name: 'nest2_field'
				label: LABEL_OPTIONAL
				type: TYPE_MESSAGE
				type_name: 'Nest2'
				number: 1
			>
			field <
				name: 'terminal_field'
				label: LABEL_OPTIONAL
				type: TYPE_STRING
				number: 2
			>
		>
		syntax: "proto3"
		`, `
		name: 'another.proto'
		package: 'example'
		message_type <
			name: 'Nest2'
			field <
				name: 'nest_field'
				label: LABEL_OPTIONAL
				type: TYPE_MESSAGE
				type_name: 'Nest'
				number: 1
			>
			field <
				name: 'terminal_field'
				label: LABEL_OPTIONAL
				type: TYPE_STRING
				number: 2
			>
		>
		syntax: "proto2"
		`,
	} {
		var fd descriptorpb.FileDescriptorProto
		if err := prototext.Unmarshal([]byte(src), &fd); err != nil {
			t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err)
		}
		fds = append(fds, &fd)
	}
	nest1 := &Message{
		DescriptorProto: fds[0].MessageType[0],
		Fields: []*Field{
			{FieldDescriptorProto: fds[0].MessageType[0].Field[0]},
			{FieldDescriptorProto: fds[0].MessageType[0].Field[1]},
		},
	}
	nest2 := &Message{
		DescriptorProto: fds[1].MessageType[0],
		Fields: []*Field{
			{FieldDescriptorProto: fds[1].MessageType[0].Field[0]},
			{FieldDescriptorProto: fds[1].MessageType[0].Field[1]},
		},
	}
	file1 := &File{
		FileDescriptorProto: fds[0],
		GoPkg:               GoPackage{Path: "example", Name: "example"},
		Messages:            []*Message{nest1},
	}
	file2 := &File{
		FileDescriptorProto: fds[1],
		GoPkg:               GoPackage{Path: "example", Name: "example"},
		Messages:            []*Message{nest2},
	}
	crossLinkFixture(file1)
	crossLinkFixture(file2)

	c1 := FieldPathComponent{
		Name:   "nest_field",
		Target: nest2.Fields[0],
	}
	if got, want := c1.ValueExpr(), "GetNestField()"; got != want {
		t.Errorf("c1.ValueExpr() = %q; want %q", got, want)
	}
	if got, want := c1.AssignableExpr(), "NestField"; got != want {
		t.Errorf("c1.AssignableExpr() = %q; want %q", got, want)
	}

	c2 := FieldPathComponent{
		Name:   "nest2_field",
		Target: nest1.Fields[0],
	}
	if got, want := c2.ValueExpr(), "Nest2Field"; got != want {
		t.Errorf("c2.ValueExpr() = %q; want %q", got, want)
	}
	if got, want := c2.ValueExpr(), "Nest2Field"; got != want {
		t.Errorf("c2.ValueExpr() = %q; want %q", got, want)
	}

	fp := FieldPath{
		c1, c2, c1, FieldPathComponent{
			Name:   "terminal_field",
			Target: nest1.Fields[1],
		},
	}
	if got, want := fp.AssignableExpr("resp", "example"), "resp.GetNestField().Nest2Field.GetNestField().TerminalField"; got != want {
		t.Errorf("fp.AssignableExpr(%q) = %q; want %q", "resp", got, want)
	}

	fp2 := FieldPath{
		c2, c1, c2, FieldPathComponent{
			Name:   "terminal_field",
			Target: nest2.Fields[1],
		},
	}
	if got, want := fp2.AssignableExpr("resp", "example"), "resp.Nest2Field.GetNestField().Nest2Field.TerminalField"; got != want {
		t.Errorf("fp2.AssignableExpr(%q) = %q; want %q", "resp", got, want)
	}

	var fpEmpty FieldPath
	if got, want := fpEmpty.AssignableExpr("resp", "example"), "resp"; got != want {
		t.Errorf("fpEmpty.AssignableExpr(%q) = %q; want %q", "resp", got, want)
	}
}

func TestGoType(t *testing.T) {
	src := `
		name: 'example.proto'
		package: 'example'
		message_type <
			name: 'Message'
			field <
				name: 'field'
				type: TYPE_STRING
				number: 1
			>
		>,
		enum_type <
			name: 'EnumName'
		>,
	`

	var fd descriptorpb.FileDescriptorProto
	if err := prototext.Unmarshal([]byte(src), &fd); err != nil {
		t.Fatalf("proto.UnmarshalText(%s, &fd) failed with %v; want success", src, err)
	}

	msg := &Message{
		DescriptorProto: fd.MessageType[0],
		Fields: []*Field{
			{FieldDescriptorProto: fd.MessageType[0].Field[0]},
		},
	}
	enum := &Enum{
		EnumDescriptorProto: fd.EnumType[0],
	}
	file := &File{
		FileDescriptorProto: &fd,
		GoPkg:               GoPackage{Path: "example", Name: "example"},
		Messages:            []*Message{msg},
		Enums:               []*Enum{enum},
	}
	crossLinkFixture(file)

	if got, want := msg.GoType("example"), "Message"; got != want {
		t.Errorf("msg.GoType() = %q; want %q", got, want)
	}
	if got, want := msg.GoType("extPackage"), "example.Message"; got != want {
		t.Errorf("msg.GoType() = %q; want %q", got, want)
	}
	msg.ForcePrefixedName = true
	if got, want := msg.GoType("example"), "example.Message"; got != want {
		t.Errorf("msg.GoType() = %q; want %q", got, want)
	}

	if got, want := enum.GoType("example"), "EnumName"; got != want {
		t.Errorf("enum.GoType() = %q; want %q", got, want)
	}
	if got, want := enum.GoType("extPackage"), "example.EnumName"; got != want {
		t.Errorf("enum.GoType() = %q; want %q", got, want)
	}
	enum.ForcePrefixedName = true
	if got, want := enum.GoType("example"), "example.EnumName"; got != want {
		t.Errorf("enum.GoType() = %q; want %q", got, want)
	}

}


text:
<?php

namespace CmsDoctrine\Mapping\Annotation;

use Doctrine\Common\Annotations\Annotation;

/**
 * This annotation is used to override the mapping of an embedded object property.
 *
 * @author Dmitry Popov <d.popov@altgraphic.com>
 *
 * @Annotation
 * @Target("ANNOTATION")
 */
class EmbeddedOverride extends Annotation
{
    /**
     * The name of the property whose mapping is being overridden.
     *
     * @var string
     */
    public $name;

    /**
     * The column definition.
     *
     * @var \Doctrine\ORM\Mapping\Column
     */
    public $column;
}