text:
/**
 * @constructor
 * @extends {WebInspector.Object}
 */
WebInspector.CSSStyleModel = function()
{
    this._pendingCommandsMajorState = [];
    /** @type {Array.<WebInspector.CSSStyleModel.LiveLocation>} */
    this._locations = [];
    this._sourceMappings = {};
    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoRequested, this._undoRedoRequested, this);
    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.UndoRedoCompleted, this._undoRedoCompleted, this);
    this._resourceBinding = new WebInspector.CSSStyleModelResourceBinding();
    this._namedFlowCollections = {};
    WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._resetNamedFlowCollections, this);
    InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));
    CSSAgent.enable();
}

/**
 * @param {Array.<CSSAgent.CSSRule>} ruleArray
 */
WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
{
    var result = [];
    for (var i = 0; i < ruleArray.length; ++i)
        result.push(WebInspector.CSSRule.parsePayload(ruleArray[i]));
    return result;
}

/**
 * @param {Array.<CSSAgent.RuleMatch>} matchArray
 */
WebInspector.CSSStyleModel.parseRuleMatchArrayPayload = function(matchArray)
{
    var result = [];
    for (var i = 0; i < matchArray.length; ++i)
        result.push(WebInspector.CSSRule.parsePayload(matchArray[i].rule, matchArray[i].matchingSelectors));
    return result;
}

WebInspector.CSSStyleModel.Events = {
    StyleSheetChanged: "StyleSheetChanged",
    MediaQueryResultChanged: "MediaQueryResultChanged",
    NamedFlowCreated: "NamedFlowCreated",
    NamedFlowRemoved: "NamedFlowRemoved",
    RegionLayoutUpdated: "RegionLayoutUpdated"
}

WebInspector.CSSStyleModel.prototype = {
    /**
     * @param {DOMAgent.NodeId} nodeId
     * @param {boolean} needPseudo
     * @param {boolean} needInherited
     * @param {function(?*)} userCallback
     */
    getMatchedStylesAsync: function(nodeId, needPseudo, needInherited, userCallback)
    {
        /**
         * @param {function(?*)} userCallback
         * @param {?Protocol.Error} error
         * @param {Array.<CSSAgent.RuleMatch>=} matchedPayload
         * @param {Array.<CSSAgent.PseudoIdMatches>=} pseudoPayload
         * @param {Array.<CSSAgent.InheritedStyleEntry>=} inheritedPayload
         */
        function callback(userCallback, error, matchedPayload, pseudoPayload, inheritedPayload)
        {
            if (error) {
                if (userCallback)
                    userCallback(null);
                return;
            }

            var result = {};
            if (matchedPayload)
                result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(matchedPayload);

            if (pseudoPayload) {
                result.pseudoElements = [];
                for (var i = 0; i < pseudoPayload.length; ++i) {
                    var entryPayload = pseudoPayload[i];
                    result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matches) });
                }
            }

            if (inheritedPayload) {
                result.inherited = [];
                for (var i = 0; i < inheritedPayload.length; ++i) {
                    var entryPayload = inheritedPayload[i];
                    var entry = {};
                    if (entryPayload.inlineStyle)
                        entry.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);
                    if (entryPayload.matchedCSSRules)
                        entry.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matchedCSSRules);
                    result.inherited.push(entry);
                }
            }

            if (userCallback)
                userCallback(result);
        }

        CSSAgent.getMatchedStylesForNode(nodeId, needPseudo, needInherited, callback.bind(null, userCallback));
    },

    /**
     * @param {DOMAgent.NodeId} nodeId
     * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
     */
    getComputedStyleAsync: function(nodeId, userCallback)
    {
        /**
         * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
         */
        function callback(userCallback, error, computedPayload)
        {
            if (error || !computedPayload)
                userCallback(null);
            else
                userCallback(WebInspector.CSSStyleDeclaration.parseComputedStylePayload(computedPayload));
        }

        CSSAgent.getComputedStyleForNode(nodeId, callback.bind(null, userCallback));
    },

    /**
     * @param {DOMAgent.NodeId} nodeId
     * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
     */
    getInlineStylesAsync: function(nodeId, userCallback)
    {
        /**
         * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback
         * @param {?Protocol.Error} error
         * @param {?CSSAgent.CSSStyle=} inlinePayload
         * @param {?CSSAgent.CSSStyle=} attributesStylePayload
         */
        function callback(userCallback, error, inlinePayload, attributesStylePayload)
        {
            if (error || !inlinePayload)
                userCallback(null, null);
            else
                userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), attributesStylePayload ? WebInspector.CSSStyleDeclaration.parsePayload(attributesStylePayload) : null);
        }

        CSSAgent.getInlineStylesForNode(nodeId, callback.bind(null, userCallback));
    },

    /**
     * @param {DOMAgent.NodeId} nodeId
     * @param {?Array.<string>|undefined} forcedPseudoClasses
     * @param {function()=} userCallback
     */
    forcePseudoState: function(nodeId, forcedPseudoClasses, userCallback)
    {
        CSSAgent.forcePseudoState(nodeId, forcedPseudoClasses || [], userCallback);
    },

    /**
     * @param {DOMAgent.NodeId} documentNodeId
     * @param {function(?WebInspector.NamedFlowCollection)} userCallback
     */
    getNamedFlowCollectionAsync: function(documentNodeId, userCallback)
    {
        var namedFlowCollection = this._namedFlowCollections[documentNodeId];
        if (namedFlowCollection) {
            userCallback(namedFlowCollection);
            return;
        }

        /**
         * @param {function(?WebInspector.NamedFlowCollection)} userCallback
         * @param {?Protocol.Error} error
         * @param {?Array.<CSSAgent.NamedFlow>} namedFlowPayload
         */
        function callback(userCallback, error, namedFlowPayload)
        {
            if (error || !namedFlowPayload)
                userCallback(null);
            else {
                var namedFlowCollection = new WebInspector.NamedFlowCollection(namedFlowPayload);
                this._namedFlowCollections[documentNodeId] = namedFlowCollection;
                userCallback(namedFlowCollection);
            }
        }

        CSSAgent.getNamedFlowCollection(documentNodeId, callback.bind(this, userCallback));
    },

    /**
     * @param {DOMAgent.NodeId} documentNodeId
     * @param {string} flowName
     * @param {function(?WebInspector.NamedFlow)} userCallback
     */
    getFlowByNameAsync: function(documentNodeId, flowName, userCallback)
    {
        var namedFlowCollection = this._namedFlowCollections[documentNodeId];
        if (namedFlowCollection) {
            userCallback(namedFlowCollection.flowByName(flowName));
            return;
        }

        /**
         * @param {function(?WebInspector.NamedFlow)} userCallback
         * @param {?WebInspector.NamedFlowCollection} namedFlowCollection
         */
        function callback(userCallback, namedFlowCollection)
        {
            if (!namedFlowCollection)
                userCallback(null);
            else
                userCallback(namedFlowCollection.flowByName(flowName));
        }

        this.getNamedFlowCollectionAsync(documentNodeId, callback.bind(this, userCallback));
    },

    /**
     * @param {CSSAgent.CSSRuleId} ruleId
     * @param {DOMAgent.NodeId} nodeId
     * @param {string} newSelector
     * @param {function(WebInspector.CSSRule, boolean)} successCallback
     * @param {function()} failureCallback
     */
    setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, failureCallback)
    {
        /**
         * @param {DOMAgent.NodeId} nodeId
         * @param {function(WebInspector.CSSRule, boolean)} successCallback
         * @param {CSSAgent.CSSRule} rulePayload
         * @param {?Array.<DOMAgent.NodeId>} selectedNodeIds
         */
        function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
        {
            if (!selectedNodeIds)
                return;
            var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
            var rule = WebInspector.CSSRule.parsePayload(rulePayload);
            successCallback(rule, doesAffectSelectedNode);
        }

        /**
         * @param {DOMAgent.NodeId} nodeId
         * @param {function(WebInspector.CSSRule, boolean)} successCallback
         * @param {function()} failureCallback
         * @param {?Protocol.Error} error
         * @param {string} newSelector
         * @param {?CSSAgent.CSSRule} rulePayload
         */
        function callback(nodeId, successCallback, failureCallback, newSelector, error, rulePayload)
        {
            this._pendingCommandsMajorState.pop();
            if (error)
                failureCallback();
            else {
                WebInspector.domAgent.markUndoableState();
                var ownerDocumentId = this._ownerDocumentId(nodeId);
                if (ownerDocumentId)
                    WebInspector.domAgent.querySelectorAll(ownerDocumentId, newSelector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
                else
                    failureCallback();
            }
        }

        this._pendingCommandsMajorState.push(true);
        CSSAgent.setRuleSelector(ruleId, newSelector, callback.bind(this, nodeId, successCallback, failureCallback, newSelector));
    },

    /**
     * @param {DOMAgent.NodeId} nodeId
     * @param {string} selector
     * @param {function(WebInspector.CSSRule, boolean)} successCallback
     * @param {function()} failureCallback
     */
    addRule: function(nodeId, selector, successCallback, failureCallback)
    {
        /**
         * @param {DOMAgent.NodeId} nodeId
         * @param {function(WebInspector.CSSRule, boolean)} successCallback
         * @param {CSSAgent.CSSRule} rulePayload
         * @param {?Array.<DOMAgent.NodeId>} selectedNodeIds
         */
        function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
        {
            if (!selectedNodeIds)
                return;

            var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
            var rule = WebInspector.CSSRule.parsePayload(rulePayload);
            successCallback(rule, doesAffectSelectedNode);
        }

        /**
         * @param {function(WebInspector.CSSRule, boolean)} successCallback
         * @param {function()} failureCallback
         * @param {string} selector
         * @param {?Protocol.Error} error
         * @param {?CSSAgent.CSSRule} rulePayload
         */
        function callback(successCallback, failureCallback, selector, error, rulePayload)
        {
            this._pendingCommandsMajorState.pop();
            if (error) {
                // Invalid syntax for a selector
                failureCallback();
            } else {
                WebInspector.domAgent.markUndoableState();
                var ownerDocumentId = this._ownerDocumentId(nodeId);
                if (ownerDocumentId)
                    WebInspector.domAgent.querySelectorAll(ownerDocumentId, selector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
                else
                    failureCallback();
            }
        }

        this._pendingCommandsMajorState.push(true);
        CSSAgent.addRule(nodeId, selector, callback.bind(this, successCallback, failureCallback, selector));
    },

    mediaQueryResultChanged: function()
    {
        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged);
    },

    /**
     * @param {DOMAgent.NodeId} nodeId
     */
    _ownerDocumentId: function(nodeId)
    {
        var node = WebInspector.domAgent.nodeForId(nodeId);
        if (!node)
            return null;
        return node.ownerDocument ? node.ownerDocument.id : null;
    },

    /**
     * @param {CSSAgent.StyleSheetId} styleSheetId
     */
    _fireStyleSheetChanged: function(styleSheetId)
    {
        if (!this._pendingCommandsMajorState.length)
            return;

        var majorChange = this._pendingCommandsMajorState[this._pendingCommandsMajorState.length - 1];

        if (!majorChange || !styleSheetId || !this.hasEventListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged))
            return;

        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged, { styleSheetId: styleSheetId, majorChange: majorChange });
    },

    /**
     * @param {CSSAgent.NamedFlow} namedFlowPayload
     */
    _namedFlowCreated: function(namedFlowPayload)
    {
        var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
        var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId];

        if (!namedFlowCollection)
            return;

        namedFlowCollection._appendNamedFlow(namedFlow);
        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowCreated, namedFlow);
    },

    /**
     * @param {DOMAgent.NodeId} documentNodeId
     * @param {string} flowName
     */
    _namedFlowRemoved: function(documentNodeId, flowName)
    {
        var namedFlowCollection = this._namedFlowCollections[documentNodeId];

        if (!namedFlowCollection)
            return;

        namedFlowCollection._removeNamedFlow(flowName);
        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, { documentNodeId: documentNodeId, flowName: flowName });
    },

    /**
     * @param {CSSAgent.NamedFlow} namedFlowPayload
     */
    _regionLayoutUpdated: function(namedFlowPayload)
    {
        var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload);
        var namedFlowCollection = this._namedFlowCollections[namedFlow.documentNodeId];

        if (!namedFlowCollection)
            return;

        namedFlowCollection._appendNamedFlow(namedFlow);
        this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, namedFlow);
    },

    /**
     * @param {CSSAgent.StyleSheetId} styleSheetId
     * @param {string} newText
     * @param {boolean} majorChange
     * @param {function(?string)} userCallback
     */
    setStyleSheetText: function(styleSheetId, newText, majorChange, userCallback)
    {
        function callback(error)
        {
            this._pendingCommandsMajorState.pop();
            if (!error && majorChange)
                WebInspector.domAgent.markUndoableState();

            if (!error && userCallback)
                userCallback(error);
        }
        this._pendingCommandsMajorState.push(majorChange);
        CSSAgent.setStyleSheetText(styleSheetId, newText, callback.bind(this));
    },

    _undoRedoRequested: function()
    {
        this._pendingCommandsMajorState.push(true);
    },

    _undoRedoCompleted: function()
    {
        this._pendingCommandsMajorState.pop();
    },

    /**
     * @param {WebInspector.CSSRule} rule
     * @param {function(?WebInspector.Resource)} callback
     */
    getViaInspectorResourceForRule: function(rule, callback)
    {
        if (!rule.id) {
            callback(null);
            return;
        }
        this._resourceBinding._requestViaInspectorResource(rule.id.styleSheetId, callback);
    },

    /**
     * @return {WebInspector.CSSStyleModelResourceBinding}
     */
    resourceBinding: function()
    {
        return this._resourceBinding;
    },

    /**
     * @param {string} url
     * @param {WebInspector.SourceMapping} sourceMapping
     */
    setSourceMapping: function(url, sourceMapping)
    {
        this._sourceMappings[url] = sourceMapping;
        this._updateLocations();
    },

    resetSourceMappings: function()
    {
        this._sourceMappings = {};
    },

    _resetNamedFlowCollections: function()
    {
        this._namedFlowCollections = {};
    },

    _updateLocations: function()
    {
        for (var i = 0; i < this._locations.length; ++i)
            this._locations[i].update();
    },

    /**
     * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
     * @return {?WebInspector.LiveLocation}
     */
    createLiveLocation: function(cssRule, updateDelegate)
    {
        if (!cssRule._rawLocation)
            return null;
        var location = new WebInspector.CSSStyleModel.LiveLocation(cssRule._rawLocation, updateDelegate);
        if (!location.uiLocation())
            return null;
        this._locations.push(location);
        location.update();
        return location;
    },

    /**
     * @param {WebInspector.CSSLocation} rawLocation
     * @return {?WebInspector.UILocation}
     */
    _rawLocationToUILocation: function(rawLocation)
    {
        var sourceMapping = this._sourceMappings[rawLocation.url];
        return sourceMapping ? sourceMapping.rawLocationToUILocation(rawLocation) : null;
    },

    __proto__: WebInspector.Object.prototype
}

/**
 * @constructor
 * @extends {WebInspector.LiveLocation}
 * @param {WebInspector.CSSLocation} rawLocation
 * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate
 */
WebInspector.CSSStyleModel.LiveLocation = function(rawLocation, updateDelegate)
{
    WebInspector.LiveLocation.call(this, rawLocation, updateDelegate);
}

WebInspector.CSSStyleModel.LiveLocation.prototype = {
    /**
     * @return {WebInspector.UILocation}
     */
    uiLocation: function()
    {
        var cssLocation = /** @type WebInspector.CSSLocation */ (this.rawLocation());
        return WebInspector.cssModel._rawLocationToUILocation(cssLocation);
    },

    dispose: function()
    {
        WebInspector.LiveLocation.prototype.dispose.call(this);
        var locations = WebInspector.cssModel._locations;
        if (locations)
            locations.remove(this);
    },

    __proto__: WebInspector.LiveLocation.prototype
}

/**
 * @constructor
 * @implements {WebInspector.RawLocation}
 * @param {string} url
 * @param {number} lineNumber
 */
WebInspector.CSSLocation = function(url, lineNumber)
{
    this.url = url;
    this.lineNumber = lineNumber;
}

/**
 * @constructor
 * @param {CSSAgent.CSSStyle} payload
 */
WebInspector.CSSStyleDeclaration = function(payload)
{
    this.id = payload.styleId;
    this.width = payload.width;
    this.height = payload.height;
    this.range = payload.range;
    this._shorthandValues = WebInspector.CSSStyleDeclaration.buildShorthandValueMap(payload.shorthandEntries);
    this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty }
    this._allProperties = []; // ALL properties: [ CSSProperty ]
    this.__disabledProperties = {}; // DISABLED properties: { index -> CSSProperty }
    var payloadPropertyCount = payload.cssProperties.length;

    var propertyIndex = 0;
    for (var i = 0; i < payloadPropertyCount; ++i) {
        var property = WebInspector.CSSProperty.parsePayload(this, i, payload.cssProperties[i]);
        this._allProperties.push(property);
        if (property.disabled)
            this.__disabledProperties[i] = property;
        if (!property.active && !property.styleBased)
            continue;
        var name = property.name;
        this[propertyIndex] = name;
        this._livePropertyMap[name] = property;
        ++propertyIndex;
    }
    this.length = propertyIndex;
    if ("cssText" in payload)
        this.cssText = payload.cssText;
}

/**
 * @param {Array.<CSSAgent.ShorthandEntry>} shorthandEntries
 * @return {Object}
 */
WebInspector.CSSStyleDeclaration.buildShorthandValueMap = function(shorthandEntries)
{
    var result = {};
    for (var i = 0; i < shorthandEntries.length; ++i)
        result[shorthandEntries[i].name] = shorthandEntries[i].value;
    return result;
}

/**
 * @param {CSSAgent.CSSStyle} payload
 * @return {WebInspector.CSSStyleDeclaration}
 */
WebInspector.CSSStyleDeclaration.parsePayload = function(payload)
{
    return new WebInspector.CSSStyleDeclaration(payload);
}

/**
 * @param {Array.<CSSAgent.CSSComputedStyleProperty>} payload
 * @return {WebInspector.CSSStyleDeclaration}
 */
WebInspector.CSSStyleDeclaration.parseComputedStylePayload = function(payload)
{
    var newPayload = /** @type {CSSAgent.CSSStyle} */ ({ cssProperties: [], shorthandEntries: [], width: "", height: "" });
    if (payload)
        newPayload.cssProperties = payload;

    return new WebInspector.CSSStyleDeclaration(newPayload);
}

WebInspector.CSSStyleDeclaration.prototype = {
    get allProperties()
    {
        return this._allProperties;
    },

    /**
     * @param {string} name
     * @return {WebInspector.CSSProperty|undefined}
     */
    getLiveProperty: function(name)
    {
        return this._livePropertyMap[name];
    },

    /**
     * @param {string} name
     * @return {string}
     */
    getPropertyValue: function(name)
    {
        var property = this._livePropertyMap[name];
        return property ? property.value : "";
    },

    /**
     * @param {string} name
     * @return {string}
     */
    getPropertyPriority: function(name)
    {
        var property = this._livePropertyMap[name];
        return property ? property.priority : "";
    },

    /**
     * @param {string} name
     * @return {boolean}
     */
    isPropertyImplicit: function(name)
    {
        var property = this._livePropertyMap[name];
        return property ? property.implicit : "";
    },

    /**
     * @param {string} name
     * @return {Array.<WebInspector.CSSProperty>}
     */
    longhandProperties: function(name)
    {
        var longhands = WebInspector.CSSCompletions.cssPropertiesMetainfo.longhands(name);
        var result = [];
        for (var i = 0; longhands && i < longhands.length; ++i) {
            var property = this._livePropertyMap[longhands[i]];
            if (property)
                result.push(property);
        }
        return result;
    },

    /**
     * @param {string} shorthandProperty
     * @return {string}
     */
    shorthandValue: function(shorthandProperty)
    {
        return this._shorthandValues[shorthandProperty];
    },

    /**
     * @param {number} index
     * @return {?WebInspector.CSSProperty}
     */
    propertyAt: function(index)
    {
        return (index < this.allProperties.length) ? this.allProperties[index] : null;
    },

    /**
     * @return {number}
     */
    pastLastSourcePropertyIndex: function()
    {
        for (var i = this.allProperties.length - 1; i >= 0; --i) {
            var property = this.allProperties[i];
            if (property.active || property.disabled)
                return i + 1;
        }
        return 0;
    },

    /**
     * @param {number=} index
     */
    newBlankProperty: function(index)
    {
        index = (typeof index === "undefined") ? this.pastLastSourcePropertyIndex() : index;
        return new WebInspector.CSSProperty(this, index, "", "", "", "active", true, false, "");
    },

    /**
     * @param {number} index
     * @param {string} name
     * @param {string} value
     * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
     */
    insertPropertyAt: function(index, name, value, userCallback)
    {
        /**
         * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
         * @param {?string} error
         * @param {CSSAgent.CSSStyle} payload
         */
        function callback(userCallback, error, payload)
        {
            WebInspector.cssModel._pendingCommandsMajorState.pop();
            if (!userCallback)
                return;

            if (error) {
                console.error(error);
                userCallback(null);
            } else {
                userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
            }
        }

        if (!this.id)
            throw "No style id";

        WebInspector.cssModel._pendingCommandsMajorState.push(true);
        CSSAgent.setPropertyText(this.id, index, name + ": " + value + ";", false, callback.bind(this, userCallback));
    },

    /**
     * @param {string} name
     * @param {string} value
     * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback
     */
    appendProperty: function(name, value, userCallback)
    {
        this.insertPropertyAt(this.allProperties.length, name, value, userCallback);
    }
}

/**
 * @constructor
 * @param {CSSAgent.CSSRule} payload
 * @param {Array.<number>=} matchingSelectors
 */
WebInspector.CSSRule = function(payload, matchingSelectors)
{
    this.id = payload.ruleId;
    if (matchingSelectors)
        this.matchingSelectors = matchingSelectors;
    this.selectors = payload.selectorList.selectors;
    this.selectorText = payload.selectorList.text;
    this.selectorRange = payload.selectorList.range;
    this.sourceLine = payload.sourceLine;
    this.sourceURL = payload.sourceURL;
    if (payload.sourceURL)
        this._rawLocation = new WebInspector.CSSLocation(payload.sourceURL, payload.sourceLine);
    this.origin = payload.origin;
    this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
    this.style.parentRule = this;
    if (payload.media)
        this.media = WebInspector.CSSMedia.parseMediaArrayPayload(payload.media);
}

/**
 * @param {CSSAgent.CSSRule} payload
 * @param {Array.<number>=} matchingIndices
 * @return {WebInspector.CSSRule}
 */
WebInspector.CSSRule.parsePayload = function(payload, matchingIndices)
{
    return new WebInspector.CSSRule(payload, matchingIndices);
}

WebInspector.CSSRule.prototype = {
    get isUserAgent()
    {
        return this.origin === "user-agent";
    },

    get isUser()
    {
        return this.origin === "user";
    },

    get isViaInspector()
    {
        return this.origin === "inspector";
    },

    get isRegular()
    {
        return this.origin === "regular";
    }
}

/**
 * @constructor
 * @param {?WebInspector.CSSStyleDeclaration} ownerStyle
 * @param {number} index
 * @param {string} name
 * @param {string} value
 * @param {?string} priority
 * @param {string} status
 * @param {boolean} parsedOk
 * @param {boolean} implicit
 * @param {?string=} text
 */
WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, text)
{
    this.ownerStyle = ownerStyle;
    this.index = index;
    this.name = name;
    this.value = value;
    this.priority = priority;
    this.status = status;
    this.parsedOk = parsedOk;
    this.implicit = implicit;
    this.text = text;
}

/**
 * @param {?WebInspector.CSSStyleDeclaration} ownerStyle
 * @param {number} index
 * @param {CSSAgent.CSSProperty} payload
 * @return {WebInspector.CSSProperty}
 */
WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
{
    // The following default field values are used in the payload:
    // priority: ""
    // parsedOk: true
    // implicit: false
    // status: "style"
    var result = new WebInspector.CSSProperty(
        ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.text);
    return result;
}

WebInspector.CSSProperty.prototype = {
    get propertyText()
    {
        if (this.text !== undefined)
            return this.text;

        if (this.name === "")
            return "";
        return this.name + ": " + this.value + (this.priority ? " !" + this.priority : "") + ";";
    },

    get isLive()
    {
        return this.active || this.styleBased;
    },

    get active()
    {
        return this.status === "active";
    },

    get styleBased()
    {
        return this.status === "style";
    },

    get inactive()
    {
        return this.status === "inactive";
    },

    get disabled()
    {
        return this.status === "disabled";
    },

    /**
     * Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
     *
     * @param {string} propertyText
     * @param {boolean} majorChange
     * @param {boolean} overwrite
     * @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
     */
    setText: function(propertyText, majorChange, overwrite, userCallback)
    {
        /**
         * @param {?WebInspector.CSSStyleDeclaration} style
         */
        function enabledCallback(style)
        {
            if (userCallback)
                userCallback(style);
        }

        /**
         * @param {?string} error
         * @param {?CSSAgent.CSSStyle} stylePayload
         */
        function callback(error, stylePayload)
        {
            WebInspector.cssModel._pendingCommandsMajorState.pop();
            if (!error) {
                if (majorChange)
                    WebInspector.domAgent.markUndoableState();
                this.text = propertyText;
                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
                var newProperty = style.allProperties[this.index];

                if (newProperty && this.disabled && !propertyText.match(/^\s*$/)) {
                    newProperty.setDisabled(false, enabledCallback);
                    return;
                }

                if (userCallback)
                    userCallback(style);
            } else {
                if (userCallback)
                    userCallback(null);
            }
        }

        if (!this.ownerStyle)
            throw "No ownerStyle for property";

        if (!this.ownerStyle.id)
            throw "No owner style id";

        // An index past all the properties adds a new property to the style.
        WebInspector.cssModel._pendingCommandsMajorState.push(majorChange);
        CSSAgent.setPropertyText(this.ownerStyle.id, this.index, propertyText, overwrite, callback.bind(this));
    },

    /**
     * @param {string} newValue
     * @param {boolean} majorChange
     * @param {boolean} overwrite
     * @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
     */
    setValue: function(newValue, majorChange, overwrite, userCallback)
    {
        var text = this.name + ": " + newValue + (this.priority ? " !" + this.priority : "") + ";"
        this.setText(text, majorChange, overwrite, userCallback);
    },

    /**
     * @param {boolean} disabled
     * @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback
     */
    setDisabled: function(disabled, userCallback)
    {
        if (!this.ownerStyle && userCallback)
            userCallback(null);
        if (disabled === this.disabled && userCallback)
            userCallback(this.ownerStyle);

        /**
         * @param {?string} error
         * @param {CSSAgent.CSSStyle} stylePayload
         */
        function callback(error, stylePayload)
        {
            WebInspector.cssModel._pendingCommandsMajorState.pop();
            if (error) {
                if (userCallback)
                    userCallback(null);
                return;
            }
            WebInspector.domAgent.markUndoableState();
            if (userCallback) {
                var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
                userCallback(style);
            }
        }

        if (!this.ownerStyle.id)
            throw "No owner style id";

        WebInspector.cssModel._pendingCommandsMajorState.push(false);
        CSSAgent.toggleProperty(this.ownerStyle.id, this.index, disabled, callback.bind(this));
    }
}

/**
 * @constructor
 * @param {CSSAgent.CSSMedia} payload
 */
WebInspector.CSSMedia = function(payload)
{
    this.text = payload.text;
    this.source = payload.source;
    this.sourceURL = payload.sourceURL || "";
    this.sourceLine = typeof payload.sourceLine === "undefined" || this.source === "linkedSheet" ? -1 : payload.sourceLine;
}

WebInspector.CSSMedia.Source = {
    LINKED_SHEET: "linkedSheet",
    INLINE_SHEET: "inlineSheet",
    MEDIA_RULE: "mediaRule",
    IMPORT_RULE: "importRule"
};

/**
 * @param {CSSAgent.CSSMedia} payload
 * @return {WebInspector.CSSMedia}
 */
WebInspector.CSSMedia.parsePayload = function(payload)
{
    return new WebInspector.CSSMedia(payload);
}

/**
 * @param {Array.<CSSAgent.CSSMedia>} payload
 * @return {Array.<WebInspector.CSSMedia>}
 */
WebInspector.CSSMedia.parseMediaArrayPayload = function(payload)
{
    var result = [];
    for (var i = 0; i < payload.length; ++i)
        result.push(WebInspector.CSSMedia.parsePayload(payload[i]));
    return result;
}

/**
 * @constructor
 * @param {CSSAgent.CSSStyleSheetBody} payload
 */
WebInspector.CSSStyleSheet = function(payload)
{
    this.id = payload.styleSheetId;
    this.rules = [];
    this.styles = {};
    for (var i = 0; i < payload.rules.length; ++i) {
        var rule = WebInspector.CSSRule.parsePayload(payload.rules[i]);
        this.rules.push(rule);
        if (rule.style)
            this.styles[rule.style.id] = rule.style;
    }
    if ("text" in payload)
        this._text = payload.text;
}

/**
 * @param {CSSAgent.StyleSheetId} styleSheetId
 * @param {function(?WebInspector.CSSStyleSheet)} userCallback
 */
WebInspector.CSSStyleSheet.createForId = function(styleSheetId, userCallback)
{
    /**
     * @param {?string} error
     * @param {CSSAgent.CSSStyleSheetBody} styleSheetPayload
     */
    function callback(error, styleSheetPayload)
    {
        if (error)
            userCallback(null);
        else
            userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
    }
    CSSAgent.getStyleSheet(styleSheetId, callback.bind(this));
}

WebInspector.CSSStyleSheet.prototype = {
    /**
     * @return {string|undefined}
     */
    getText: function()
    {
        return this._text;
    },

    /**
     * @param {string} newText
     * @param {boolean} majorChange
     * @param {function(?string)=} userCallback
     */
    setText: function(newText, majorChange, userCallback)
    {
        /**
         * @param {?string} error
         */
        function callback(error)
        {
            if (!error)
                WebInspector.domAgent.markUndoableState();

            WebInspector.cssModel._pendingCommandsMajorState.pop();
            if (userCallback)
                userCallback(error);
        }

        WebInspector.cssModel._pendingCommandsMajorState.push(majorChange);
        CSSAgent.setStyleSheetText(this.id, newText, callback.bind(this));
    }
}

/**
 * @constructor
 */
WebInspector.CSSStyleModelResourceBinding = function()
{
    this._frameAndURLToStyleSheetId = {};
    this._styleSheetIdToHeader = {};
    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged, this._inspectedURLChanged, this);
}

WebInspector.CSSStyleModelResourceBinding.prototype = {
    /**
     * @param {WebInspector.Resource} resource
     * @param {function(?CSSAgent.StyleSheetId)} callback
     */
    requestStyleSheetIdForResource: function(resource, callback)
    {
        function innerCallback()
        {
            callback(this._styleSheetIdForResource(resource));
        }

        if (this._styleSheetIdForResource(resource))
            innerCallback.call(this);
        else
            this._loadStyleSheetHeaders(innerCallback.bind(this));
    },

    /**
     * @param {CSSAgent.StyleSheetId} styleSheetId
     * @param {function(?string)} callback
     */
    requestResourceURLForStyleSheetId: function(styleSheetId, callback)
    {
        function innerCallback()
        {
            var header = this._styleSheetIdToHeader[styleSheetId];
            if (!header) {
                callback(null);
                return;
            }

            var frame = WebInspector.resourceTreeModel.frameForId(header.frameId);
            if (!frame) {
                callback(null);
                return;
            }

            var styleSheetURL = header.origin === "inspector" ? this._viaInspectorResourceURL(header.sourceURL) : header.sourceURL;
            callback(styleSheetURL);
        }

        if (this._styleSheetIdToHeader[styleSheetId])
            innerCallback.call(this);
        else
            this._loadStyleSheetHeaders(innerCallback.bind(this));
    },

    /**
     * @param {WebInspector.Resource} resource
     * @return {CSSAgent.StyleSheetId}
     */
    _styleSheetIdForResource: function(resource)
    {
        return this._frameAndURLToStyleSheetId[resource.frameId + ":" + resource.url];
    },

    /**
     * @param {WebInspector.Event} event
     */
    _inspectedURLChanged: function(event)
    {
        // Main frame navigation - clear history.
        this._frameAndURLToStyleSheetId = {};
        this._styleSheetIdToHeader = {};
    },

    /**
     * @param {function(?string)} callback
     */
    _loadStyleSheetHeaders: function(callback)
    {
        /**
         * @param {?string} error
         * @param {Array.<CSSAgent.CSSStyleSheetHeader>} infos
         */
        function didGetAllStyleSheets(error, infos)
        {
            if (error) {
                callback(error);
                return;
            }

            for (var i = 0; i < infos.length; ++i) {
                var info = infos[i];
                if (info.origin === "inspector") {
                    this._getOrCreateInspectorResource(info);
                    continue;
                }
                this._frameAndURLToStyleSheetId[info.frameId + ":" + info.sourceURL] = info.styleSheetId;
                this._styleSheetIdToHeader[info.styleSheetId] = info;
            }
            callback(null);
        }
        CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this));
    },

    /**
     * @param {CSSAgent.StyleSheetId} styleSheetId
     * @param {function(?WebInspector.Resource)} callback
     */
    _requestViaInspectorResource: function(styleSheetId, callback)
    {
        var header = this._styleSheetIdToHeader[styleSheetId];
        if (header) {
            callback(this._getOrCreateInspectorResource(header));
            return;
        }

        function headersLoaded()
        {
            var header = this._styleSheetIdToHeader[styleSheetId];
            if (header)
                callback(this._getOrCreateInspectorResource(header));
            else
                callback(null);
        }
        this._loadStyleSheetHeaders(headersLoaded.bind(this));
    },

    /**
     * @param {CSSAgent.CSSStyleSheetHeader} header
     * @return {?WebInspector.Resource}
     */
    _getOrCreateInspectorResource: function(header)
    {
        var frame = WebInspector.resourceTreeModel.frameForId(header.frameId);
        if (!frame)
            return null;

        var viaInspectorURL = this._viaInspectorResourceURL(header.sourceURL);
        var inspectorResource = frame.resourceForURL(viaInspectorURL);
        if (inspectorResource)
            return inspectorResource;

        var resource = frame.resourceForURL(header.sourceURL);
        if (!resource)
            return null;

        this._frameAndURLToStyleSheetId[header.frameId + ":" + viaInspectorURL] = header.styleSheetId;
        this._styleSheetIdToHeader[header.styleSheetId] = header;
        inspectorResource = new WebInspector.Resource(null, viaInspectorURL, resource.documentURL, resource.frameId, resource.loaderId, WebInspector.resourceTypes.Stylesheet, "text/css", true);
        /**
         * @param {function(?string, boolean, string)} callback
         */
        function overrideRequestContent(callback)
        {
            function callbackWrapper(error, content)
            {
                callback(error ? "" : content, false, "text/css");
            }
            CSSAgent.getStyleSheetText(header.styleSheetId, callbackWrapper);
        }
        inspectorResource.requestContent = overrideRequestContent;
        frame.addResource(inspectorResource);
        return inspectorResource;
    },

    /**
     * @param {string} documentURL
     * @return {string}
     */
    _viaInspectorResourceURL: function(documentURL)
    {
        var parsedURL = new WebInspector.ParsedURL(documentURL);
        var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComponents;
        if (!fakeURL.endsWith("/"))
            fakeURL += "/";
        fakeURL += "inspector-stylesheet";
        return fakeURL;
    }
}

/**
 * @constructor
 * @implements {CSSAgent.Dispatcher}
 * @param {WebInspector.CSSStyleModel} cssModel
 */
WebInspector.CSSDispatcher = function(cssModel)
{
    this._cssModel = cssModel;
}

WebInspector.CSSDispatcher.prototype = {
    mediaQueryResultChanged: function()
    {
        this._cssModel.mediaQueryResultChanged();
    },

    /**
     * @param {CSSAgent.StyleSheetId} styleSheetId
     */
    styleSheetChanged: function(styleSheetId)
    {
        this._cssModel._fireStyleSheetChanged(styleSheetId);
    },

    /**
     * @param {CSSAgent.NamedFlow} namedFlowPayload
     */
    namedFlowCreated: function(namedFlowPayload)
    {
        this._cssModel._namedFlowCreated(namedFlowPayload);
    },

    /**
     * @param {DOMAgent.NodeId} documentNodeId
     * @param {string} flowName
     */
    namedFlowRemoved: function(documentNodeId, flowName)
    {
        this._cssModel._namedFlowRemoved(documentNodeId, flowName);
    },

    /**
     * @param {CSSAgent.NamedFlow} namedFlowPayload
     */
    regionLayoutUpdated: function(namedFlowPayload)
    {
        this._cssModel._regionLayoutUpdated(namedFlowPayload);
    }
}

/**
 * @constructor
 * @param {CSSAgent.NamedFlow} payload
 */
WebInspector.NamedFlow = function(payload)
{
    this.documentNodeId = payload.documentNodeId;
    this.name = payload.name;
    this.overset = payload.overset;
    this.content = payload.content;
    this.regions = payload.regions;
}

/**
 * @param {CSSAgent.NamedFlow} payload
 * @return {WebInspector.NamedFlow}
 */
WebInspector.NamedFlow.parsePayload = function(payload)
{
    return new WebInspector.NamedFlow(payload);
}

/**
 * @constructor
 * @param {Array.<CSSAgent.NamedFlow>} payload
 */
WebInspector.NamedFlowCollection = function(payload)
{
    /** @type {Object.<string, WebInspector.NamedFlow>} */
    this.namedFlowMap = {};

    for (var i = 0; i < payload.length; ++i) {
        var namedFlow = WebInspector.NamedFlow.parsePayload(payload[i]);
        this.namedFlowMap[namedFlow.name] = namedFlow;
    }
}

WebInspector.NamedFlowCollection.prototype = {
    /**
     * @param {WebInspector.NamedFlow} namedFlow
     */
    _appendNamedFlow: function(namedFlow)
    {
        this.namedFlowMap[namedFlow.name] = namedFlow;
    },

    /**
     * @param {string} flowName
     */
    _removeNamedFlow: function(flowName)
    {
        delete this.namedFlowMap[flowName];
    },

    /**
     * @param {string} flowName
     * @return {WebInspector.NamedFlow}
     */
    flowByName: function(flowName)
    {
        var namedFlow = this.namedFlowMap[flowName];

        if (!namedFlow)
            return null;
        return namedFlow;
    }
}
/**
 * @type {WebInspector.CSSStyleModel}
 */
WebInspector.cssModel = null;


text:
package org.codehaus.griffon.runtime.domain.methods;

import griffon.exceptions.StaticMethodInvocationException;
import griffon.plugins.domain.GriffonDomain;
import griffon.plugins.domain.GriffonDomainClass;
import griffon.plugins.domain.GriffonDomainHandler;
import griffon.plugins.domain.exceptions.UnsupportedDomainMethodException;
import griffon.plugins.domain.methods.ExistsMethod;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static java.util.Objects.requireNonNull;

/**
 * @author Andres Almiray
 */
public abstract class AbstractExistsPersistentMethod extends AbstractPersistentStaticMethodInvocation implements ExistsMethod {
    public AbstractExistsPersistentMethod(@Nonnull GriffonDomainHandler griffonDomainHandler) {
        super(griffonDomainHandler);
    }

    @Nullable
    @Override
    protected final <T extends GriffonDomain> Object invokeInternal(@Nonnull GriffonDomainClass<T> domainClass, @Nonnull String methodName, @Nonnull Object[] arguments) {
        if (arguments.length == 1) {
            requireNonNull(arguments[0], "Argument 'key' must not be null");
            return exists(domainClass, arguments[0]);
        }
        throw new StaticMethodInvocationException(domainClass.getClazz(), methodName, arguments);
    }

    protected <T extends GriffonDomain> boolean exists(@Nonnull GriffonDomainClass<T> domainClass, @Nonnull Object key) {
        throw new UnsupportedDomainMethodException();
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.azure.resourcemanager.recoveryservicesbackup.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.recoveryservicesbackup.fluent.ProtectionPoliciesClient;
import com.azure.resourcemanager.recoveryservicesbackup.fluent.models.ProtectionPolicyResourceInner;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicies;
import com.azure.resourcemanager.recoveryservicesbackup.models.ProtectionPolicyResource;

public final class ProtectionPoliciesImpl implements ProtectionPolicies {
    private static final ClientLogger LOGGER = new ClientLogger(ProtectionPoliciesImpl.class);

    private final ProtectionPoliciesClient innerClient;

    private final com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager serviceManager;

    public ProtectionPoliciesImpl(
        ProtectionPoliciesClient innerClient,
        com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response<ProtectionPolicyResource> getWithResponse(
        String vaultName, String resourceGroupName, String policyName, Context context) {
        Response<ProtectionPolicyResourceInner> inner =
            this.serviceClient().getWithResponse(vaultName, resourceGroupName, policyName, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ProtectionPolicyResourceImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ProtectionPolicyResource get(String vaultName, String resourceGroupName, String policyName) {
        ProtectionPolicyResourceInner inner = this.serviceClient().get(vaultName, resourceGroupName, policyName);
        if (inner != null) {
            return new ProtectionPolicyResourceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public void delete(String vaultName, String resourceGroupName, String policyName) {
        this.serviceClient().delete(vaultName, resourceGroupName, policyName);
    }

    public void delete(String vaultName, String resourceGroupName, String policyName, Context context) {
        this.serviceClient().delete(vaultName, resourceGroupName, policyName, context);
    }

    public ProtectionPolicyResource getById(String id) {
        String vaultName = Utils.getValueFromIdByName(id, "vaults");
        if (vaultName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id)));
        }
        String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String policyName = Utils.getValueFromIdByName(id, "backupPolicies");
        if (policyName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id)));
        }
        return this.getWithResponse(vaultName, resourceGroupName, policyName, Context.NONE).getValue();
    }

    public Response<ProtectionPolicyResource> getByIdWithResponse(String id, Context context) {
        String vaultName = Utils.getValueFromIdByName(id, "vaults");
        if (vaultName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id)));
        }
        String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String policyName = Utils.getValueFromIdByName(id, "backupPolicies");
        if (policyName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id)));
        }
        return this.getWithResponse(vaultName, resourceGroupName, policyName, context);
    }

    public void deleteById(String id) {
        String vaultName = Utils.getValueFromIdByName(id, "vaults");
        if (vaultName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id)));
        }
        String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String policyName = Utils.getValueFromIdByName(id, "backupPolicies");
        if (policyName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id)));
        }
        this.delete(vaultName, resourceGroupName, policyName, Context.NONE);
    }

    public void deleteByIdWithResponse(String id, Context context) {
        String vaultName = Utils.getValueFromIdByName(id, "vaults");
        if (vaultName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String.format("The resource ID '%s' is not valid. Missing path segment 'vaults'.", id)));
        }
        String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");
        if (resourceGroupName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));
        }
        String policyName = Utils.getValueFromIdByName(id, "backupPolicies");
        if (policyName == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        String
                            .format("The resource ID '%s' is not valid. Missing path segment 'backupPolicies'.", id)));
        }
        this.delete(vaultName, resourceGroupName, policyName, context);
    }

    private ProtectionPoliciesClient serviceClient() {
        return this.innerClient;
    }

    private com.azure.resourcemanager.recoveryservicesbackup.RecoveryServicesBackupManager manager() {
        return this.serviceManager;
    }

    public ProtectionPolicyResourceImpl define(String name) {
        return new ProtectionPolicyResourceImpl(name, this.manager());
    }
}


text:
public class beforeFieldQualifiedType {
    public String foo;
}


text:
/*global describe, beforeEach, it */
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-generator').assert;

describe('bower generator', function () {

  var promt = {
    'bowerComponentName': 'bower mock',
    'description': 'A Mock to test this package.',
    'livereloadPort': 35000
  };

  beforeEach(function (done) {
    helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
      if (err) {
        return done(err);
      }

      this.app = helpers.createGenerator('bower:app', [
        '../../app'
      ]);
      done();
    }.bind(this));
  });

  describe('file generation test', function () {
    var expected = [
      // add files you expect to exist here.
      '.jshintrc',
      '.editorconfig',

      'bower.json',
      'package.json',

      'examples/index.html'
    ];
    var coffee_file = [
      'Gruntfile.coffee',
      'src/bower-mock.coffee',
      'test/bower-mock-tests.coffee'
    ];
    var javascript_files = [
      'Gruntfile.js',
      'src/bower-mock.js',
      'test/bower-mock-tests.js'
    ];

    // Mock each test with basic information.
    beforeEach(function () {
      helpers.mockPrompt(this.app, promt);
      this.app.options['skip-install'] = true;
    });

    it('creates expected common files', function (done) {
      // And check for them...
      this.app.run({}, function () {
        assert.file(expected);
        done();
      });
    });

    it('creates expected coffee files', function (done) {
      this.app.options['coffee'] = true;
      // And check for them...
      this.app.run({}, function () {
        assert.file([].concat(expected, coffee_file));
        assert.noFile(javascript_files);
        done();
      });
    });

    it('creates expected javascipt files', function (done) {
      // And check for them...
      this.app.run({}, function () {
        assert.file([].concat(expected, javascript_files));
        assert.noFile(coffee_file);
        done();
      });
    });

  });

  /**
   * Test file contents.
   */
  describe('test file contents', function () {
    // Check package.json and bower.json
    // it('test basic file values', function (done) {
    //   // body...
    //   done();
    // });
  });

});


text:
/*********************************************************************************************

Interrupt-Vektoren sind definiert in Header-File "iom32.h"

**********************************************************************************************/

#include "globals.h"

/* Interrupt Service Routine für Timer0 Overflow Interrupt
    -> wird verwendet um den Controller aus dem Sleep Modus
       wieder aufzuwecken

   Wenn der SleepMode als aktiv gesetzt ist, dann werden bei
   jedem ISR Aufruf von der SleepTime 33ms abgezogen.
   (Der Overflow tritt jeweils nach 33ms auf)
*/
ISR(TIM0_OVF_vect)
{
    if (sleepingActive==TRUE && leftSleepingTimeMs>33)
    {
        leftSleepingTimeMs -= 33;
    }
}


text:
package org.convx;

import org.convx.fsd.SchemaBuilder;
import org.convx.reader.FlatFileParser;
import org.convx.reader.Parser;
import org.convx.schema.SchemaImpl;
import org.convx.writer.FlatFileWriter;

import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import java.io.File;
import java.io.Reader;
import java.io.Writer;

/**
 * Represents a flat file schema. A schema instance is immutable and can be reused. The schema is thus thread safe, however the readers and writers it
 * returns are not.
 * @author johan
 * @since 2011-05-21
 */
public class Schema {
    /**
     * Builds a flat file schema from an xml representation.
     * @param schemaFile a file containing an xml representation.
     * @return an immutable flat file schema instance
     */
    public static Schema build(File schemaFile) {
        return new SchemaImpl(SchemaBuilder.build(schemaFile));
    }

    /**
     * Returns an {@link XMLEventReader} implementation that produces XML by parsing a flat file.
     * @param reader a reader returning flat file content
     * @return an {@link XMLEventReader} implementation
     */
    public XMLEventReader parser(Reader reader) {
        return new FlatFileParser(new Parser(this, reader));
    }

    /**
     * Returns an {@link XMLEventWriter} implementation that when fed with XML produces corresponding flat file content.
     * @param writer a writer to which flat file content is written
     * @return an {@link XMLEventWriter} implementation
     */
    public XMLEventWriter writer(Writer writer) {
        return new FlatFileWriter(this, writer);
    }
}


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome;

/**
 * Contains all of the command line switches that are specific to the chrome/
 * portion of Chromium on Android.
 */
public abstract class ChromeSwitches {
    // Switches used from Java.  Please continue switch style used Chrome where
    // options-have-hypens and are_not_split_with_underscores.

    /** Testing: pretend that the switch value is the name of a child account. */
    public static final String CHILD_ACCOUNT = "child-account";

    /** Mimic a low end device */
    public static final String ENABLE_ACCESSIBILITY_TAB_SWITCHER =
            "enable-accessibility-tab-switcher";

    /** Whether fullscreen support is disabled (auto hiding controls, etc...). */
    public static final String DISABLE_FULLSCREEN = "disable-fullscreen";

    /** Show the undo bar for high end UI devices. */
    public static final String ENABLE_HIGH_END_UI_UNDO = "enable-high-end-ui-undo";

    /** Enable toolbar swipe to change tabs in document mode */
    public static final String ENABLE_TOOLBAR_SWIPE_IN_DOCUMENT_MODE =
            "enable-toolbar-swipe-in-document-mode";

    /** Whether instant is disabled. */
    public static final String DISABLE_INSTANT = "disable-instant";

    /** Whether force-enable the "hardware acceleration" preference. */
    public static final String HARDWARE_ACCELERATION = "hardware-acceleration";

    /** If specified, enables notification center verbose logging. */
    public static final String NOTIFICATION_CENTER_LOGGING = "notification-center-logging";

    /** Enables StrictMode violation detection. By default this logs violations to logcat. */
    public static final String STRICT_MODE = "strict-mode";

    /** Don't restore persistent state from saved files on startup. */
    public static final String NO_RESTORE_STATE = "no-restore-state";

    /** Disable the First Run Experience. */
    public static final String DISABLE_FIRST_RUN_EXPERIENCE = "disable-fre";

    /** Force the crash dump to be uploaded regardless of preferences. */
    public static final String FORCE_CRASH_DUMP_UPLOAD = "force-dump-upload";

    /** Do not use OAuth2 tokens for communication with Cloud Print service for Chrome to Mobile. */
    public static final String DISABLE_CHROME_TO_MOBILE_OAUTH2 = "disable-chrome-to-mobile-oauth2";

    /** Enable debug logs for the video casting feature. */
    public static final String ENABLE_CAST_DEBUG_LOGS = "enable-cast-debug";

    /** Prevent automatic reconnection to current Cast video when Chrome restarts. */
    public static final String DISABLE_CAST_RECONNECTION = "disable-cast-reconnection";

    /** Whether site/user triggered persistent fullscreen is supported. */
    public static final String DISABLE_PERSISTENT_FULLSCREEN = "disable-persistent-fullscreen";

    /** Whether or not to enable the experimental tablet tab stack. */
    public static final String ENABLE_TABLET_TAB_STACK = "enable-tablet-tab-stack";

    /** Disables support for playing videos remotely via Android MediaRouter API. */
    public static final String DISABLE_CAST = "disable-cast";

    /** Never forward URL requests to external intents. */
    public static final String DISABLE_EXTERNAL_INTENT_REQUESTS =
            "disable-external-intent-requests";

    /** Disable document mode. */
    public static final String DISABLE_DOCUMENT_MODE = "disable-document-mode";

    /** Disable Contextual Search. */
    public static final String DISABLE_CONTEXTUAL_SEARCH = "disable-contextual-search";

    /** Enable Contextual Search. */
    public static final String ENABLE_CONTEXTUAL_SEARCH = "enable-contextual-search";

    /** Disable Contextual Search first-run flow, for testing. Not exposed to user. */
    public static final String DISABLE_CONTEXTUAL_SEARCH_PROMO_FOR_TESTING =
            "disable-contextual-search-promo-for-testing";

    /** Enable Contextual Search for instrumentation testing. Not exposed to user. */
    public static final String ENABLE_CONTEXTUAL_SEARCH_FOR_TESTING =
            "enable-contextual-search-for-testing";

    // How many thumbnails should we allow in the cache (per tab stack)?
    public static final String THUMBNAILS = "thumbnails";

    // How many "approximated" thumbnails should we allow in the cache
    // (per tab stack)?  These take very low memory but have poor quality.
    public static final String APPROXIMATION_THUMBNAILS = "approximation-thumbnails";

    ///////////////////////////////////////////////////////////////////////////////////////////////
    // Native Switches
    ///////////////////////////////////////////////////////////////////////////////////////////////

    /**
     * Sets the max number of render processes to use.
     * Native switch - content_switches::kRendererProcessLimit.
     */
    public static final String RENDER_PROCESS_LIMIT = "renderer-process-limit";

    /** Enable begin frame scheduling. */
    public static final String ENABLE_BEGIN_FRAME_SCHEDULING = "enable-begin-frame-scheduling";

    /**
     * Enable enhanced bookmarks feature.
     * Native switch - switches::kEnhancedBookmarksExperiment
     */
    public static final String ENABLE_ENHANCED_BOOKMARKS = "enhanced-bookmarks-experiment";

    /** Enable the DOM Distiller. */
    public static final String ENABLE_DOM_DISTILLER = "enable-dom-distiller";

    /** Enable experimental web-platform features, such as Push Messaging. */
    public static final String EXPERIMENTAL_WEB_PLAFTORM_FEATURES =
            "enable-experimental-web-platform-features";

    /** Enable the Reader Mode icon in toolbar. */
    public static final String ENABLE_READER_MODE_TOOLBAR_ICON = "enable-reader-mode-toolbar-icon";

    /** Enable Reader Mode button animation. */
    public static final String ENABLE_READER_MODE_BUTTON_ANIMATION =
            "enable-dom-distiller-button-animation";

    /** Enable the native app banners. */
    public static final String ENABLE_APP_INSTALL_ALERTS = "enable-app-install-alerts";

    /**
     * Use sandbox Wallet environment for requestAutocomplete.
     * Native switch - autofill::switches::kWalletServiceUseSandbox.
     */
    public static final String USE_SANDBOX_WALLET_ENVIRONMENT = "wallet-service-use-sandbox";

    /**
     * Change Google base URL.
     * Native switch - switches::kGoogleBaseURL.
     */
    public static final String GOOGLE_BASE_URL = "google-base-url";

    // Prevent instantiation.
    private ChromeSwitches() {}
}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.turn.ttorrent.protocol.test;

import com.google.common.io.Files;
import com.turn.ttorrent.protocol.torrent.Torrent;
import com.turn.ttorrent.protocol.torrent.TorrentCreator;
import io.netty.util.ResourceLeakDetector;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author shevek
 */
public class TorrentTestUtils {

    private static final Logger LOG = LoggerFactory.getLogger(TorrentTestUtils.class);

    static {
        ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
    }
    public static final String FILENAME = "torrent-data-file";
    private static File ROOT;

    @Nonnull
    public static synchronized File newTorrentRoot()
            throws IOException {
        if (ROOT != null)
            return ROOT;
        File buildDir = new File("build/tmp");
        FileUtils.forceMkdir(buildDir);
        File rootDir = File.createTempFile("ttorrent", ".tmp", buildDir);
        FileUtils.forceDeleteOnExit(rootDir);
        FileUtils.forceDelete(rootDir);
        FileUtils.forceMkdir(rootDir);
        ROOT = rootDir;
        return rootDir;
    }

    @Nonnull
    public static File newTorrentDir(@Nonnull String name)
            throws IOException {
        File torrentDir = new File(newTorrentRoot(), name);
        if (torrentDir.exists())
            FileUtils.forceDelete(torrentDir);
        FileUtils.forceMkdir(torrentDir);
        return torrentDir;
    }

    @Nonnull
    public static TorrentCreator newTorrentCreator(@Nonnull File dir, @Nonnegative final long size)
            throws IOException, InterruptedException {
        File file = new File(dir, FILENAME);
        Files.asByteSink(file).writeFrom(new PatternInputStream(size));
        return new TorrentCreator(file);
    }

    @Nonnull
    public static Torrent newTorrent(@Nonnull File dir, @Nonnegative long size)
            throws IOException, InterruptedException, URISyntaxException {
        return newTorrentCreator(dir, size).create();
    }
}


text:
// ****************************************************************************
// <copyright file="SaveEmailAddressService.cs" company="Pedro Lamas">
// Copyright © Pedro Lamas 2011
// </copyright>
// ****************************************************************************
// <author>Pedro Lamas</author>
// <email>pedrolamas@gmail.com</email>
// <date>25-11-2011</date>
// <project>Cimbalino.Phone.Toolkit</project>
// <web>http://www.pedrolamas.com</web>
// <license>
// See license.txt in this solution or http://www.pedrolamas.com/license_MIT.txt
// </license>
// ****************************************************************************

using Microsoft.Phone.Tasks;

namespace Cimbalino.Phone.Toolkit.Services
{
    /// <summary>
    /// Represents an implementation of the <see cref="ISaveEmailAddressService"/>.
    /// </summary>
    public class SaveEmailAddressService : ISaveEmailAddressService
    {
        /// <summary>
        /// Shows the contacts application, using the specified email address.
        /// </summary>
        /// <param name="emailAddress">The email address that can be saved to a contact.</param>
        public void Show(string emailAddress)
        {
            new SaveEmailAddressTask()
            {
                Email = emailAddress
            }.Show();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Sabio.Web.Models.Responses
{
    /// <summary>
    /// This is an example of a Generic class that you will gain an understanding of
    /// as you progress through the training.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ItemsResponse<T> : SuccessResponse
    {
        public List<T> Items { get; set; }
    }
}


text:
@interface SSCalendarAnnualLayout : UICollectionViewFlowLayout

- (void)updateLayoutForBounds:(CGRect)bounds;

@end


text:
#ifndef __RXML_PARSER__
#define __RXML_PARSER__

#define MAX_LIBXML_FEATURES_LEN 50

extern VALUE cXMLParser;

void rxml_init_parser();

#endif


text:
$(function() {

    var $seriesSelect = $('#seriesSelect'),
        $submit = $('#submit');

    $seriesSelect.on('change', function() {
        $submit.prop('disabled', !this.value);
    });
    var $imageGallery = $('#imageGallery'),
        $imageUpload = $('#imageUpload'),
        $uploadWrapper = $imageUpload.parent('a'),
        imgNum = 0;
    $imageUpload.ajaxfileupload({
        action: '/image/upload',
        onStart: function() {
            $imageUpload.prop('diaabled', true);
            $uploadWrapper.addClass('sending disabled');
        },
        onComplete: function(data) {
            if (imgNum < 9) {
                $imageUpload.prop('disabled', false);
                $uploadWrapper.removeClass('disabled');
            }
            $uploadWrapper.removeClass('sending');
            if (!data.state) {
                return;
            }
            $imageGallery.append('');
            imgNum++;
        }
    });

    var $carVerList = $('#carVerList');
    var index = 1;
    $('#carVerAdd').on('click', function(event) {
        event.preventDefault();
        html = '
<input name="carverList[' + index + '].carVerInfo" type="text" class="form-control upload-data">	<input name="carverList[' + index + '].carVerLink" type="text" class="form-control upload-data" placeholder="http://www.xxx.com">	<input name="carverList[' + index + '].carPriceDiff" type="text" class="form-control upload-data" placeholder="-23.0">	<button class="delete btn btn-default btn-sm"></button>
';
        index++;
        $carVerList.append(html);
    });
    $carVerList.on('click', '.delete', function(event) {
        event.preventDefault();
        $(this).closest('tr').remove();
    });

    var um = UM.getEditor('ueditor');

    function getContent() {
        return um.getContent();
    }
    $submit.on('click', function(event) {
        event.preventDefault();
        var $this = $(this),
            dataBool = true,
            dataObj = {};
        $('.upload-data').each(function(idx, elem) {
            var $elem = $(elem),
                text = $elem.val().trim();
            if (text == '') {
                dataBool = false;
                return;
            }
            dataObj[$elem.attr('name')] = text;
        });
        $('.upload-data-img').each(function(idx, elem) {
            var $elem = $(elem),
                imgUrl = $elem.attr('src').trim();
            if (imgUrl == '') {
                dataBool = false;
                return;
            }
            if (dataObj['images']) {
                dataObj['images'] += ';' + imgUrl;
            } else {
                dataObj['images'] = imgUrl;
            }
        });
        if ($('.upload-data-img').length === 0) {
            dataBool = false;
        }
        var editorText = getContent();
        if (editorText) {
            dataObj['carDescription'] = editorText;
        } else {
            dataBool = false;
        }
        if (!dataBool) {
            alert('信息未填写完整');
            return;
        }
        console.log(dataObj);
        $this.prop('disabled', true).text('正在提交').addClass('sending');
        $.ajax({
            url: '/keeper/car/add',
            type: 'post',
            dataType: 'json',
            data: dataObj,
        }).fail(function() {
            alert('提交失败, 请重试');
            $this.prop('disabled', false).text('提交新闻').removeClass('sending');
            console.log("error");
        }).done(function(data) {
            if (data.state) {
                $this.text('提交成功').removeClass('sending');
                $$.modal.show({
                    title: '提示',
                    content: '提交成功,点击确定跳转到列表页面',
                    type: 'info',
                    confirm: function() {
                        window.location.href = '/keeper/car/list/1';
                    }
                });
            } else {
                $$.modal.show({
                    title: '提示',
                    content: '提交失败,请重试',
                    type: 'info'
                });
                $this.text('提交表单').removeClass('sending').prop('disabled', false);
            }
        });
    });

});


text:
class CreateTr8nComponentTranslators < ActiveRecord::Migration
  def self.up
    create_table :tr8n_component_translators do |t|
      t.integer :component_id
      t.integer :translator_id
      t.timestamps
    end
    add_index :tr8n_component_translators, [:component_id], :name => "tr8n_comp_trn_comp_id"
    add_index :tr8n_component_translators, [:translator_id], :name => "tr8n_comp_trn_trn_id"
  end

  def self.down
    drop_table :tr8n_component_translators
  end
end


text:
extern "C" {
#include "shoveler/image.h"
#include "shoveler/image/ppm.h"
}

class ShovelerImagePpmTest : public ::testing::Test {
public:
  virtual void SetUp() {
    remove(testFilename);

    testImage = shovelerImageCreate(2, 2, 3);
    shovelerImageClear(testImage);
    shovelerImageGet(testImage, 0, 0, 0) = 255;
    shovelerImageGet(testImage, 0, 1, 1) = 255;
    shovelerImageGet(testImage, 1, 0, 2) = 255;
    shovelerImageGet(testImage, 1, 1, 1) = 255;
    shovelerImageGet(testImage, 1, 1, 2) = 255;
  }

  virtual void TearDown() {
    shovelerImageFree(testImage);
    remove(testFilename);
  }

  const char* testFilename = "test.ppm";
  ShovelerImage* testImage;
};

TEST_F(ShovelerImagePpmTest, writeReadFile) {
  bool written = shovelerImagePpmWriteFile(testImage, testFilename);
  ASSERT_TRUE(written) << "ppm should be written successfully";

  ShovelerImage* image = shovelerImagePpmReadFile(testFilename);
  ASSERT_TRUE(image != NULL) << "ppm should be read successfully";
  ASSERT_EQ(*image, *testImage) << "read image should be equal to test image";

  shovelerImageFree(image);
}

TEST_F(ShovelerImagePpmTest, writeReadMemory) {
  bool written = shovelerImagePpmWriteFile(testImage, testFilename);
  ASSERT_TRUE(written) << "png should be written successfully";

  std::ifstream file(testFilename, std::ios::binary);
  std::stringstream stream;
  stream << file.rdbuf();
  std::string contents(stream.str());

  ShovelerImage* image = shovelerImagePpmReadBuffer(
      reinterpret_cast<const unsigned char*>(contents.c_str()), contents.size());
  ASSERT_TRUE(image != NULL) << "ppm should be read successfully";
  ASSERT_EQ(*image, *testImage) << "read image should be equal to test image";

  shovelerImageFree(image);
}


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>Input | mini2d</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					mini2d

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

					mini2d

					Input

Class Input

Hierarchy

						Input

Index

Constructors

constructor

Properties

game

ios<wbr>Audio<wbr>Unlocked

mouse<wbr>Down

x

y

Methods

contains

handle<wbr>Cursor<wbr>Down

handle<wbr>Cursor<wbr>Up

init<wbr>Cursor<wbr>Events

unlock<wbr>Ios<wbr>Audio

update<wbr>Coordinates

Constructors

constructor

new <wbr>Input(game: Game): Input

Defined in core/input.ts:27

Constructor for the input class

Parameters

game: Game

A reference to the game instance

Returns Input

Properties

Private game

game: Game

Defined in core/input.ts:22

Reference to the game instance

Private ios<wbr>Audio<wbr>Unlocked

ios<wbr>Audio<wbr>Unlocked: boolean

Defined in core/input.ts:27

A flag signalizing whether iOS audio has been unlocked with an ontouchend event

mouse<wbr>Down

mouse<wbr>Down: boolean

Defined in core/input.ts:7

Signalizes whether cursor is down, can be both mouse or touch event

x

x: number

Defined in core/input.ts:12

The X coordinate of current or last input

y

y: number

Defined in core/input.ts:17

The Y coordinate of current or last input

Methods

contains

contains(measurable: Measurable): boolean

Defined in core/input.ts:42

A method to determine whether input's current or last position overlaps with a measurable object

Parameters

measurable: Measurable

any measurable object

Returns boolean

Private handle<wbr>Cursor<wbr>Down

handle<wbr>Cursor<wbr>Down(): void

Defined in core/input.ts:86

A handler function for when cursor is touched / clicked

Returns void

Private handle<wbr>Cursor<wbr>Up

handle<wbr>Cursor<wbr>Up(): void

Defined in core/input.ts:98

A handler function for when cursor is released

Returns void

Private init<wbr>Cursor<wbr>Events

init<wbr>Cursor<wbr>Events(): void

Defined in core/input.ts:49

Initiates the touch and mouse input events

Returns void

Private unlock<wbr>Ios<wbr>Audio

unlock<wbr>Ios<wbr>Audio(): void

Defined in core/input.ts:137

Plays an empty sound, used when first touchendevent happens, because iOS safari doesn't allow to play sounds otherwise

Returns void

Private update<wbr>Coordinates

update<wbr>Coordinates(x: number, y: number): void

Defined in core/input.ts:112

Updates the coordinates of this class, and recalculates based on canvas position, scaling, to hold accurate information

Parameters

x: number

Raw X coordinate which is then recalculated

y: number

Ray Y coordinate which is then recalculated

Returns void

						Globals

						mini2d

						Audio<wbr>Manager

						Body

						Button

						Camera

						Collision<wbr>Detector

						Collision<wbr>Engine

						Collision<wbr>Solver

						Debug

						Game

						Input

								constructor

								game

								ios<wbr>Audio<wbr>Unlocked

								mouse<wbr>Down

								x

								y

								contains

								handle<wbr>Cursor<wbr>Down

								handle<wbr>Cursor<wbr>Up

								init<wbr>Cursor<wbr>Events

								unlock<wbr>Ios<wbr>Audio

								update<wbr>Coordinates

						Point

						Resource<wbr>Manager

						Sound

						Sprite

						State

						State<wbr>Manager

						State<wbr>Prefab

						Text

						UI

						World

						Collision<wbr>Direction

						Destroyable

						Drawable

						Measurable

						State<wbr>Object

						author

						version

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.netapp.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Quota availability request content. */
@Fluent
public final class QuotaAvailabilityRequest {
    /*
     * Name of the resource to verify.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * Resource type used for verification.
     */
    @JsonProperty(value = "type", required = true)
    private CheckQuotaNameResourceTypes type;

    /*
     * Resource group name.
     */
    @JsonProperty(value = "resourceGroup", required = true)
    private String resourceGroup;

    /**
     * Get the name property: Name of the resource to verify.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the resource to verify.
     *
     * @param name the name value to set.
     * @return the QuotaAvailabilityRequest object itself.
     */
    public QuotaAvailabilityRequest withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the type property: Resource type used for verification.
     *
     * @return the type value.
     */
    public CheckQuotaNameResourceTypes type() {
        return this.type;
    }

    /**
     * Set the type property: Resource type used for verification.
     *
     * @param type the type value to set.
     * @return the QuotaAvailabilityRequest object itself.
     */
    public QuotaAvailabilityRequest withType(CheckQuotaNameResourceTypes type) {
        this.type = type;
        return this;
    }

    /**
     * Get the resourceGroup property: Resource group name.
     *
     * @return the resourceGroup value.
     */
    public String resourceGroup() {
        return this.resourceGroup;
    }

    /**
     * Set the resourceGroup property: Resource group name.
     *
     * @param resourceGroup the resourceGroup value to set.
     * @return the QuotaAvailabilityRequest object itself.
     */
    public QuotaAvailabilityRequest withResourceGroup(String resourceGroup) {
        this.resourceGroup = resourceGroup;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (name() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property name in model QuotaAvailabilityRequest"));
        }
        if (type() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property type in model QuotaAvailabilityRequest"));
        }
        if (resourceGroup() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property resourceGroup in model QuotaAvailabilityRequest"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(QuotaAvailabilityRequest.class);
}


text:
define(['dojo/_base/declare',
    'dijit/_WidgetBase',
    'dijit/_TemplatedMixin',
    'dojo/Evented',
    'dojo/_base/lang',
    'dojo/_base/html',
    'dojo/_base/array',
    'dojo/on',
    'dojo/query',
    'dijit/TooltipDialog',
    'dijit/popup',
    'dijit/registry',
    'jimu/dijit/SymbolChooser',
    'jimu/symbolUtils'
  ],
  function(declare, _WidgetBase, _TemplatedMixin, Evented, lang, html, array, on, query,
    TooltipDialog, dojoPopup, registry, SymbolChooser, jimuSymUtils) {
    return declare([_WidgetBase, _TemplatedMixin, Evented], {
      baseClass: 'jimu-symbol-picker',
      declaredClass: 'jimu.dijit.SymbolPicker',
      templateString: '
' +
                        '

' +
                        '

' +
                        '

' +
                      '
',
      tooltipDialog: null,
      _isTooltipDialogOpened: false,

      //options:
      //you must set symbol or type
      symbol: null, //optional
      type: null, //optional, available values:marker,line,fill,text

      //public methods:
      //reset
      //showBySymbol
      //showByType
      //getSymbol

      //events:
      //change

      postCreate: function() {
        this.inherited(arguments);
        this._createTooltipDialog();
        this._hideTooltipDialog();
        var symbol = this.symbolChooser.getSymbol();
        if(symbol){
          this._drawSymbol(symbol);
        }
      },

      destroy: function(){
        this._hideTooltipDialog();
        if(this.symbolChooser){
          this.symbolChooser.destroy();
        }
        this.symbolChooser = null;
        this.inherited(arguments);
      },

      _createTooltipDialog: function() {
        var ttdContent = html.create("div");
        this.tooltipDialog = new TooltipDialog({
          content: ttdContent
        });

        this.symbolChooser = new SymbolChooser({
          symbol: this.symbol,
          type: this.type
        });

        this.symbolChooser.placeAt(ttdContent);
        this.symbolChooser.startup();

        this.own(on(this.symbolChooser, 'change', lang.hitch(this, function(newSymbol){
          this._drawSymbol(newSymbol);
          this.emit('change', newSymbol);
        })));

        this.own(on(this.domNode, 'click', lang.hitch(this, function(event){
          event.stopPropagation();
          event.preventDefault();
          if(this._isTooltipDialogOpened){
            this._hideTooltipDialog();
          }else{
            this._showTooltipDialog();
          }
        })));

        this.own(on(document.body, 'click', lang.hitch(this, function(event){
          var target = event.target || event.srcElement;
          var colorPickers = this._getColorPickers();
          if(colorPickers.length > 0){
            var isClickColorPicker = array.some(colorPickers, function(colorPicker){
              return colorPicker.isPartOfPopup(target);
            });
            if(isClickColorPicker){
              return;
            }
          }
          var node = this.tooltipDialog.domNode;
          var isInternal = target === node || html.isDescendant(target, node);
          if(!isInternal){
            this._hideTooltipDialog();
          }
        })));

        this.own(on(this.symbolChooser, 'resize', lang.hitch(this, function(){
          if(this._isTooltipDialogOpened){
            this._hideTooltipDialog();
            this._showTooltipDialog();
          }
        })));
      },

      _getColorPickers: function(){
        var doms = query('.jimu-color-picker', this.symbolChooser.domNode);
        var colorPickers = array.map(doms, lang.hitch(this, function(dom){
          return registry.byNode(dom);
        }));
        return colorPickers;
      },

      reset: function(){
        this.type = null;
        this.symbol = null;
        html.empty(this.symbolNode);
        this.symbolChooser.reset();
      },

      showBySymbol: function(symbol){
        this.reset();
        if(symbol){
          this._drawSymbol(symbol);
          this.symbolChooser.showBySymbol(symbol);
        }
      },

      showByType: function(type){
        this.reset();
        this.symbolChooser.showByType(type);
        var symbol = this.symbolChooser.getSymbol();
        if (symbol) {
          this._drawSymbol(symbol);
        }
      },

      getSymbol: function(){
        return this.symbolChooser.getSymbol();
      },

      _drawSymbol: function(symbol) {
        html.empty(this.symbolNode);
        if (symbol) {
          var symbolDom = jimuSymUtils.createSymbolNode(symbol, {
            width: 16,
            height: 16
          });
          if (symbolDom) {
            html.place(symbolDom, this.symbolNode);
          }
        }
      },

      _showTooltipDialog: function(){
        if(this.tooltipDialog){
          dojoPopup.open({
            parent: this.getParent(),
            popup: this.tooltipDialog,
            around: this.domNode
          });
          this._isTooltipDialogOpened = true;
        }
      },

      _hideTooltipDialog: function(){
        if(this.tooltipDialog){
          dojoPopup.close(this.tooltipDialog);
          this._isTooltipDialogOpened = false;
        }
      }

    });
  });


text: SELECT f1 FROM test1 ORDER BY min(f1,f2)


text:
using UnityEngine;
using System;
using System.IO;
using System.Collections.Generic;

public class InitRachel : SmartbodyCharacterInit
{
    protected override void Awake()
    {
        base.Awake();

        unityBoneParent = "ChrRachel/CharacterRoot/JtRoot";
        //assetPaths.Add(new KeyValuePair<string, string>("ChrRachel.sk", "Art/Characters/SB/ChrRachel/sk"));
        //assetPaths.Add(new KeyValuePair<string, string>("ChrRachel.sk", "Art/Characters/SB/ChrRachel/face"));
        //assetPaths.Add(new KeyValuePair<string, string>("ChrRachel.sk", "Art/Characters/SB/ChrRachel/motion"));
        //assetPaths.Add(new KeyValuePair<string, string>("ChrBrad.sk", "Art/Characters/SB/ChrBrad/sk"));
        //assetPaths.Add(new KeyValuePair<string, string>("ChrBrad.sk", "Art/Characters/SB/ChrBrad/face"));
        //assetPaths.Add(new KeyValuePair<string, string>("ChrBrad.sk", "Art/Characters/SB/ChrBrad/motion"));
        skeletonName = "ChrRachel.sk";
        loadSkeletonFromSk = false;
        voiceType = "remote_audiofile";
        voiceCode = VHFile.GetExternalAssetsPath() + "Sounds";
        voiceTypeBackup = "remote";
        voiceCodeBackup = VHUtils.IsWindows8OrGreater() ? "Microsoft|Zira|Desktop" : "Microsoft|Anna";
        usePhoneBigram = false;
        startingPosture = "ChrRachel@IdleHandsAtSide01";

        locomotionInitPythonSkeletonName = "ChrRachel.sk";
        locomotionInitPythonFile = "locomotion-ChrBrad-init.py";
        locomotionSteerPrefix = "ChrMarine";

        PostLoadEvent += delegate(UnitySmartbodyCharacter character)
            {
                SmartbodyManager.Get().PythonCommand(string.Format(@"bml.execBML('{0}', '<gaze target=""Camera""   sbm:joint-range=""HEAD EYES NECK"" />')", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"bml.execBML('{0}', '<saccade mode=""talk""/>')", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setStringAttribute('saccadePolicy', 'alwayson')", character.SBMCharacterName));

                // limiting gaze
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('limitHeadingNeck', 60 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitHeadingBack', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitPitchDownBack', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitHeadingBack', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitRollBack', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitRollChest', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitHeadingChest', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitPitchDownChest', 0 )", character.SBMCharacterName));
                SmartbodyManager.Get().PythonCommand(string.Format(@"scene.getCharacter('{0}').setDoubleAttribute('gaze.limitPitchUpChest', 0 )", character.SBMCharacterName));
            };
    }

    protected override void Start()
    {
        base.Start();
    }
}