text:
"use strict";
define(['./DvtToolkit'], function(dvt) {
  // Internal use only.  All APIs and functionality are subject to change at any time.

(function(dvt) {
/**
 * PictoChart component.  The component should never be instantiated directly.  Use the newInstance function instead
 * @param {dvt.Context} context The rendering context.
 * @param {string} callback The function that should be called to dispatch component events.
 * @param {object} callbackObj The optional object instance on which the callback function is defined.
 * @class
 * @constructor
 */
dvt.PictoChart = function(context, callback, callbackObj) {
  this.Init(context, callback, callbackObj);
};

dvt.Obj.createSubclass(dvt.PictoChart, dvt.BaseComponent);

/**
 * Returns a new instance of dvt.PictoChart.
 * @param {dvt.Context} context The rendering context.
 * @param {string} callback The function that should be called to dispatch component events.
 * @param {object} callbackObj The optional object instance on which the callback function is defined.
 * @return {dvt.PictoChart}
 */
dvt.PictoChart.newInstance = function(context, callback, callbackObj) {
  return new dvt.PictoChart(context, callback, callbackObj);
};

/**
 * Initializes the component.
 * @param {dvt.Context} context The rendering context.
 * @param {string} callback The function that should be called to dispatch component events.
 * @param {object} callbackObj The optional object instance on which the callback function is defined.
 * @protected
 */
dvt.PictoChart.prototype.Init = function(context, callback, callbackObj) {
  dvt.PictoChart.superclass.Init.call(this, context, callback, callbackObj);

  // Create the event handler and add event listeners
  this.EventManager = new DvtPictoChartEventManager(this);
  this.EventManager.addListeners(this);

  // Set up keyboard handler on non-touch devices
  if (!dvt.Agent.isTouchDevice())
    this.EventManager.setKeyboardHandler(new DvtPictoChartKeyboardHandler(this.EventManager));

  // Create the defaults object
  this.Defaults = new DvtPictoChartDefaults();

  // Create array of logical objects for pictoChart items
  this._items = [];
};

/**
 * Calculates the preferred dimensions for this pictoChart.
 * @param {Number=} width The component width, if defined.
 * @param {Number=} height The component height, if defined.
 * @return {dvt.Dimension} The preferred dimensions.
 * @private
 */
dvt.PictoChart.prototype._getPreferredSize = function(width, height) {
  // Calculate the preferred width or height if not defined
  if (!width || !height) {
    var info = DvtPictoChartRenderer.getInfo(this, width, height);
    this._info = info; // store for use in render()

    if (!width)
      width = info.items ? info.colCount * info.colWidth : 0;
    if (!height)
      height = info.items ? info.rowCount * info.rowHeight : 0;
  }

  return new dvt.Dimension(width, height);
};

/**
 * @override
 */
dvt.PictoChart.prototype.render = function(options, width, height) {
  // IMPORTANT: If width and height are passed, then flowing layout would be disabled.

  // Keep old references for animation
  this._oldContainer = this._container;
  var oldMarkers = this._markers;
  var oldWidth = this.Width ? this.Width : 0;
  var oldHeight = this.Height ? this.Height : 0;

  // Clean up
  this.EventManager.hideTooltip();
  this._items = [];
  this._markers = [];
  this._info = null;
  if (this._emptyText) {
    this._container.removeChild(this._emptyText);
    this._emptyText = null;
  }
  if (this._animation) {
    this._animationStopped = true;
    this._animation.stop();
  }

  // Update if a new options object has been provided or initialize with defaults if needed
  this.SetOptions(options);
  var context = this.getCtx();

  if (!width && !height) {
    // Set display=block to the SVG to enable flowing layout (removing extra gap in the outer div)
    context.getSvgDocument().style.display = 'block';

    // Determine whether the layout is fixed or flowing.
    // To find out, set the preferred dims on the SVG, and see if the outerDiv dims follow the SVG dims.
    var preferredSize = this._getPreferredSize();
    dvt.ToolkitUtils.setSvgSize(context, preferredSize.w, preferredSize.h);
    var outerDivSize = dvt.ToolkitUtils.getOuterDivSize(context);

    if (preferredSize.w == outerDivSize.w && preferredSize.h != outerDivSize.h) {
      // Height is fixed, but width is probably flowing.
      // Relayout with fixed height to find the preferred width.
      this.Height = outerDivSize.h;
      preferredSize = this._getPreferredSize(null, this.Height);
      dvt.ToolkitUtils.setSvgSize(context, preferredSize.w, this.Height);
      this.Width = dvt.ToolkitUtils.getOuterDivSize(context).w;
    }
    else if (preferredSize.w != outerDivSize.w && preferredSize.h == outerDivSize.h) {
      // Width is fixed, but height is probably flowing.
      // Relayout with fixed width to find the preferred height.
      this.Width = outerDivSize.w;
      preferredSize = this._getPreferredSize(this.Width, null);
      dvt.ToolkitUtils.setSvgSize(context, this.Width, preferredSize.h);
      this.Height = dvt.ToolkitUtils.getOuterDivSize(context).h;
    }
    else {
      // The width and height are either both fixed or both flowing.
      // In either case, we can render at the outerDivSize because:
      // - if both width and height are flowing, the outerDivSize matches the preferredSize,
      // - if both width and height are fixed, we're forced to render at the outerDivSize.
      this.Width = outerDivSize.w;
      this.Height = outerDivSize.h;
    }

    // If the width/height doesn't match the last computed preferredSize, the info has to be recomputed
    if (this.Width != preferredSize.w || this.Height != preferredSize.h)
      this._info = null;
  }
  else {
    // If width and height are passed, flowing layout is disabled.
    // Use this mode for unit tests and ADF printable pages.
    this.Width = width;
    this.Height = height;
  }

  // Render the component
  this._container = new dvt.Container(context);
  this.addChild(this._container);
  DvtPictoChartRenderer.render(this, this._container, new dvt.Rectangle(0, 0, this.Width, this.Height), this._info);

  // Construct the new animation playable
  if (!this._oldContainer) {
    this._animation = this._getAnimationOnDisplay();
  }
  else if (this.Options['animationOnDataChange'] != 'none' && options) {
    // Treat layout changes as data change animations and animate to new positions
    var animHandler = new dvt.DataAnimationHandler(context, null);
    animHandler.constructAnimation(oldMarkers, this._markers);
    this._animation = animHandler.getAnimation();
  }

  // If an animation was created, play it
  if (this._animation) {
    // Temporarily set the SVG size to max(oldSize, newSize) to ensure that the animation isn't truncated
    dvt.ToolkitUtils.setSvgSize(context, Math.max(oldWidth, this.Width), Math.max(oldHeight, this.Height));

    // Remove event listeners and empty text temporarily
    this.EventManager.removeListeners(this);
    if (this._emptyText)
      this._container.removeChild(this._emptyText);

    this._animation.setOnEnd(this._onRenderEnd, this);
    this._animation.play();
  }
  else
    this._onRenderEnd();
};

/**
 * @override
 */
dvt.PictoChart.prototype.SetOptions = function(options) {
  if (options) {
    // Combine the user options with the defaults and store
    this.Options = this.Defaults.calcOptions(options);
  }
  else if (!this.Options)
    this.Options = this.GetDefaults();

  // Disable animation for png
  if (!dvt.Agent.isEnvironmentBrowser()) {
    this.Options['animationOnDisplay'] = 'none';
    this.Options['animationOnDataChange'] = 'none';
  }

  // Initialize the selection handler
  var selectionMode = this.Options['selectionMode'];
  if (selectionMode == 'single')
    this._selectionHandler = new dvt.SelectionHandler(dvt.SelectionHandler.TYPE_SINGLE);
  else if (selectionMode == 'multiple')
    this._selectionHandler = new dvt.SelectionHandler(dvt.SelectionHandler.TYPE_MULTIPLE);
  else
    this._selectionHandler = null;

  // Pass to event manager
  this.EventManager.setSelectionHandler(this._selectionHandler);
};

/**
 * Cleaning and processing at the end of the render call.
 * @private
 */
dvt.PictoChart.prototype._onRenderEnd = function() {
  // Clean up the old container used by black box updates
  if (this._oldContainer) {
    this.removeChild(this._oldContainer);
    this._oldContainer.destroy();
    this._oldContainer = null;
  }

  if (this._animation) {
    this._animation = null;

    // Restore event listeners and empty text
    this.EventManager.addListeners(this);
    if (this._emptyText)
      this._container.addChild(this._emptyText);
  }

  // Set the preferred size on the SVG element
  dvt.ToolkitUtils.setSvgSize(this.getCtx(), this.Width, this.Height);

  // Set the initial keyboard focus
  this.EventManager.setFocusObj(this._items[0]);

  // Set initial selection
  if (this._selectionHandler)
    this._selectionHandler.processInitialSelections(this.Options['selection'], this._items);

  // Set initial highlighting
  dvt.CategoryRolloverHandler.highlight(this.Options['highlightedCategories'], this._items, this.Options['highlightMatch'] == 'any');

  this.UpdateAriaAttributes();

  if (!this._animationStopped)
    this.RenderComplete();
  this._animationStopped = null;
};

/**
 * @return {DvtPictoChartEventManager}
 */
dvt.PictoChart.prototype.getEventManager = function() {
  return this.EventManager;
};

/**
 * Registers the pictoChart items. The items must be registered to participate in interactivity.
 * @param {array} items Array of DvtPictoChartItem.
 */
dvt.PictoChart.prototype.registerItems = function(items) {
  this._items = items;
};

/**
 * Returns the pictoChart items.
 * @return {array} Array of DvtPictoChartItem.
 */
dvt.PictoChart.prototype.getItems = function() {
  return this._items;
};

/**
 * Registers the marker with the component. The marker must be registered to participate in animation.
 * @param {DvtPictoChartShapeMarker|DvtPictoChartImageMarker} marker
 */
dvt.PictoChart.prototype.registerMarker = function(marker) {
  this._markers.push(marker);
};

/**
 * Registers the "no data" text.
 * @param {dvt.OutputText} text
 */
dvt.PictoChart.prototype.registerEmptyText = function(text) {
  this._emptyText = text;
};

/**
 * Returns the total count of the all items.
 * @return {number}
 */
dvt.PictoChart.prototype.getTotalCount = function() {
  var count = 0;
  for (var i = 0; i < this._items.length; i++) {
    count += this._items[i].getCount();
  }
  return count;
};

/**
 * Returns the animation duration.
 * @return {number}
 */
dvt.PictoChart.prototype.getAnimationDuration = function() {
  return dvt.StyleUtils.getTimeMilliseconds(this.Options['animationDuration']) / 1000;
};

/**
 * Returns the animation on display.
 * @return {dvt.Playable}
 * @private
 */
dvt.PictoChart.prototype._getAnimationOnDisplay = function() {
  var animOnDisplay = this.Options['animationOnDisplay'];
  var duration = this.getAnimationDuration();
  var context = this.getCtx();
  var bounds = new dvt.Rectangle(0, 0, this.Width, this.Height);

  if (dvt.BlackBoxAnimationHandler.isSupported(animOnDisplay))
    return dvt.BlackBoxAnimationHandler.getInAnimation(context, animOnDisplay, this._container, bounds, duration);

  var playables = [];
  if (animOnDisplay == 'popIn') {
    for (var i = 0; i < this._markers.length; i++) {
      var marker = this._markers[i];
      playables.push(new dvt.AnimPopIn(context, marker, true, duration));
    }
  }
  else if (animOnDisplay != 'none') {
    // Grow animation
    for (var i = 0; i < this._markers.length; i++) {
      var marker = this._markers[i];
      var playable = new dvt.CustomAnimation(context, marker, duration);
      var startState, endState;

      if (DvtPictoChartRenderer.isVertical(this)) {
        startState = DvtPictoChartRenderer.isOriginRight(this) ? this.Width : 0;
        endState = marker.getCx();
        marker.setCx(startState);
        playable.getAnimator().addProp(dvt.Animator.TYPE_NUMBER, marker, marker.getCx, marker.setCx, endState);
      }
      else {
        startState = DvtPictoChartRenderer.isOriginBottom(this) ? this.Height : 0;
        endState = marker.getCy();
        marker.setCy(startState);
        playable.getAnimator().addProp(dvt.Animator.TYPE_NUMBER, marker, marker.getCy, marker.setCy, endState);
      }
      playables.push(playable);
    }
    // Add fade in to hide the ugly overlaps at the beginning
    playables.push(dvt.BlackBoxAnimationHandler.getInAnimation(context, dvt.BlackBoxAnimationHandler.ALPHA_FADE, this._container, bounds, duration));
  }

  if (playables.length > 0)
    return new dvt.ParallelPlayable(context, playables);
  else
    return null;
};

/**
 * @override
 */
dvt.PictoChart.prototype.destroy = function() {
  if (this.EventManager) {
    this.EventManager.removeListeners(this);
    this.EventManager.destroy();
    this.EventManager = null;
  }

  // Call super last during destroy
  dvt.PictoChart.superclass.destroy.call(this);
};

/**
 * @override
 */
dvt.PictoChart.prototype.highlight = function(categories) {
  // Update the options
  var options = this.getOptions();
  options['highlightedCategories'] = dvt.JsonUtils.clone(categories);

  // Perform the highlighting and propagate to children
  dvt.CategoryRolloverHandler.highlight(categories, this.getItems(), options['highlightMatch'] == 'any');
};

/**
 * @override
 */
dvt.PictoChart.prototype.select = function(selection) {
  // Update the options
  var options = this.getOptions();
  options['selection'] = dvt.JsonUtils.clone(selection);

  // Perform the selection
  if (this._selectionHandler)
    this._selectionHandler.processInitialSelections(selection, this.getItems());
};

/**
 * @override
 */
dvt.PictoChart.prototype.GetComponentDescription = function() {
  return dvt.Bundle.getTranslation(this.getOptions(), 'componentName', dvt.Bundle.UTIL_PREFIX, 'PICTOCHART');
};

/**
 * Returns the automation object for this component.
 * @return {DvtPictoChartAutomation} The automation object.
 */
dvt.PictoChart.prototype.getAutomation = function() {
  if (!this._automation)
    this._automation = new DvtPictoChartAutomation(this);
  return this._automation;
};
/**
 * Provides automation services for dvt.PictoChart.
 * @class  DvtPictoChartAutomation
 * @param {dvt.PictoChart} picto
 * @implements {dvt.Automation}
 * @constructor
 */
var DvtPictoChartAutomation = function(picto) {
  this._picto = picto;
};

dvt.Obj.createSubclass(DvtPictoChartAutomation, dvt.Automation);

/**
 * Valid subIds inlcude:
 *

 *
item[index]

 *
tooltip

 *

 * @override
 */
DvtPictoChartAutomation.prototype.GetSubIdForDomElement = function(displayable) {
  var logicalObj = this._picto.getEventManager().GetLogicalObject(displayable);
  if (logicalObj && (logicalObj instanceof DvtPictoChartItem)) {
    var index = this._picto.getItems().indexOf(logicalObj);
    return 'item[' + index + ']';
  }
  return null;
};

/**
 * Valid subIds inlcude:
 *

 *
item[index]

 *
tooltip

 *

 * @override
 */
DvtPictoChartAutomation.prototype.getDomElementForSubId = function(subId) {
  if (subId == dvt.Automation.TOOLTIP_SUBID)
    return this.GetTooltipElement(this._picto);

  var parenIdx = subId.indexOf('[');
  if (parenIdx > 0 && subId.substring(0, parenIdx) === 'item') {
    var index = parseInt(subId.substring(parenIdx + 1, subId.length - 1));
    var item = this._picto.getItems()[index];
    if (item)
      return item.getElem();
    else
      return null;
  }
  return null;
};

/**
 * Returns an object containing data for a pictoChart item. Used for verification.
 * Valid verification values inlcude:
 *

 *
color

 *
tooltip

 *
id

 *
name

 *
count

 *
selected

 *

 * @param {Number} index The index of the tag cloud item
 * @return {Object} An object containing data for the tag cloud item
 */
DvtPictoChartAutomation.prototype.getItem = function(index) {
  var item = this._picto.getItems()[index];
  if (item) {
    var data = {};
    data['color'] = item.getDatatipColor();
    data['tooltip'] = item.getShortDesc();
    data['id'] = item.getId();
    data['name'] = item.getName();
    data['count'] = item.getCount();
    data['selected'] = item.isSelected();
    return data;
  }
  return null;
};

/**
 * Returns the number of items in the pictoChart
 * @return {Number}
 */
DvtPictoChartAutomation.prototype.getItemCount = function() {
  return this._picto.getItems().length;
};
/**
 * Event Manager for pictoChart component.
 * @param {dvt.PictoChart} picto
 * @constructor
 */
var DvtPictoChartEventManager = function(picto) {
  this.Init(picto.getCtx(), picto.dispatchEvent, picto);
  this._picto = picto;
};

dvt.Obj.createSubclass(DvtPictoChartEventManager, dvt.EventManager);

/**
 * @override
 */
DvtPictoChartEventManager.prototype.ProcessRolloverEvent = function(event, obj, bOver) {
  var options = this._picto.getOptions();
  if (options['hoverBehavior'] == 'none')
    return;

  // Compute the new highlighted categories and update the options
  var categories = obj.getCategories ? obj.getCategories() : [];
  options['highlightedCategories'] = bOver ? categories.slice() : null;

  // Fire the event to the rollover handler, who will fire to the component callback.
  var rolloverEvent = dvt.EventFactory.newCategoryHighlightEvent(options['highlightedCategories'], bOver);
  var hoverBehaviorDelay = dvt.StyleUtils.getTimeMilliseconds(options['hoverBehaviorDelay']);
  this.RolloverHandler.processEvent(rolloverEvent, this._picto.getItems(), hoverBehaviorDelay, options['highlightMatch'] == 'any');
};

/**
 * @override
 */
DvtPictoChartEventManager.prototype.OnClickInternal = function(event) {
  var obj = this.GetLogicalObject(event.target);
  if (!obj)
    return;

  // Only drill if not selectable. If selectable, drill with double click.
  if (!(obj.isSelectable && obj.isSelectable()))
    this.processDrillEvent(obj);
};

/**
 * @override
 */
DvtPictoChartEventManager.prototype.OnDblClickInternal = function(event) {
  var obj = this.GetLogicalObject(event.target);
  if (!obj)
    return;

  // Only double click to drill if selectable. Otherwise, drill with single click.
  if (obj.isSelectable && obj.isSelectable())
    this.processDrillEvent(obj);
};

/**
 * @override
 */
DvtPictoChartEventManager.prototype.HandleTouchHoverEndInternal = function(event) {
  var obj = this.GetLogicalObject(event.target);
  if (!obj)
    return;

  // Only drill if not selectable. If selectable, drill using double click.
  if (!(obj.isSelectable && obj.isSelectable()))
    this.processDrillEvent(obj);
};

/**
 * @override
 */
DvtPictoChartEventManager.prototype.HandleTouchClickInternal = function(event) {
  var obj = this.GetLogicalObject(event.target);
  if (!obj)
    return;

  // Only drill if not selectable. If selectable, drill using double click.
  if (!(obj.isSelectable && obj.isSelectable()))
    this.processDrillEvent(obj);
};

/**
 * @override
 */
DvtPictoChartEventManager.prototype.HandleTouchDblClickInternal = function(event) {
  var obj = this.GetLogicalObject(event.target);
  if (!obj)
    return;

  // Only double click to drill if selectable. Otherwise, drill with single click.
  if (obj.isSelectable && obj.isSelectable()) {
    event.preventDefault();
    event.stopPropagation();
    this.processDrillEvent(obj);
  }
};

/**
 * Processes an drill on the specified object.
 * @param {DvtLogicalObject} obj The object that was clicked.
 */
DvtPictoChartEventManager.prototype.processDrillEvent = function(obj) {
  if (obj instanceof DvtPictoChartItem && obj.isDrillable())
    this.FireEvent(dvt.EventFactory.newDrillEvent(obj.getId()));
};
/**
 * Default values and utility functions for component versioning.
 * @class
 * @constructor
 * @extends {dvt.BaseComponentDefaults}
 */
var DvtPictoChartDefaults = function() {
  this.Init({'alta': DvtPictoChartDefaults.VERSION_1});
};

dvt.Obj.createSubclass(DvtPictoChartDefaults, dvt.BaseComponentDefaults);

/**
 * Contains overrides for version 1.
 * @const
 */
DvtPictoChartDefaults.VERSION_1 = {
  'animationOnDisplay': 'none',
  'animationOnDataChange': 'none',
  'animationDuration' : 750,
  'drilling': 'off',
  'hiddenCategories': [],
  'highlightedCategories': [],
  'highlightMatch' : 'all',
  'hoverBehavior': 'none',
  'hoverBehaviorDelay' : 200,
  'layout': 'horizontal',
  'layoutOrigin': 'topStart',
  'selection': [],
  'selectionMode': 'none',

  '_defaultColor': '#a6acb1',
  '_defaultSize': 32,
  '_defaultShape': 'rectangle',
  '_gapRatio': 0.25,
  '_textStyle': new dvt.CSSStyle(dvt.BaseComponentDefaults.FONT_FAMILY_ALTA_13 + 'color: #252525;'),
  '_statusMessageStyle': new dvt.CSSStyle(dvt.BaseComponentDefaults.FONT_FAMILY_ALTA_13 + 'color: #252525;'),
  '_tooltipStyle': new dvt.CSSStyle('border-collapse: separate; border-spacing: 1px'),
  '_tooltipLabelStyle': new dvt.CSSStyle('color: #737373; padding: 0px 2px'),
  '_tooltipValueStyle': new dvt.CSSStyle('color: #333333; padding: 0px 2px')
};
// Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.

/**
 * @param {dvt.PictoChart} picto
 * @param {number} cx  The x position of the center of the marker.
 * @param {number} cy  The y position of the center of the marker.
 * @param {number} width  The width of the marker.
 * @param {number} height  The height of the marker.
 * @param {String} source Image URI for the default state.
 * @param {String} sourceSelected Image URI for the selected state.
 * @param {String} sourceHover Image URI for the hover state.
 * @param {String} sourceHoverSelected Image URI for the hover selected state.
 * @param {String} id The id of the marker.
 * @extends {dvt.ImageMarker}
 * @constructor
 */
var DvtPictoChartImageMarker = function(picto, cx, cy, width, height, source, sourceSelected, sourceHover, sourceHoverSelected, id) {
  DvtPictoChartImageMarker.superclass.Init.call(this, picto.getCtx(), cx, cy, width, height, null, source, sourceSelected, sourceHover, sourceHoverSelected, id);
  this._picto = picto;
};

dvt.Obj.createSubclass(DvtPictoChartImageMarker, dvt.ImageMarker);

//---------------------------------------------------------------------//
// Animation support: dvt.DataAnimationHandler                          //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartImageMarker.prototype.animateUpdate = function(handler, oldMarker) {
  var animation = new dvt.CustomAnimation(this.getCtx(), this, this._picto.getAnimationDuration() * 0.75);
  var animator = animation.getAnimator();

  // Position and size animation
  var endParams = this._getAnimationParams();
  this._setAnimationParams(oldMarker._getAnimationParams());
  animator.addProp(dvt.Animator.TYPE_NUMBER_ARRAY, this, this._getAnimationParams, this._setAnimationParams, endParams);

  // Hide old item
  oldMarker.setAlpha(0);

  handler.add(animation, 1);
};

/**
 * @override
 */
DvtPictoChartImageMarker.prototype.animateDelete = function(handler) {
  handler.add(new dvt.AnimFadeOut(this.getCtx(), this, this._picto.getAnimationDuration() * 0.5), 0);
};

/**
 * @override
 */
DvtPictoChartImageMarker.prototype.animateInsert = function(handler) {
  this.setAlpha(0);
  handler.add(new dvt.AnimFadeIn(this.getCtx(), this, this._picto.getAnimationDuration() * 0.5), 2);
};

/**
 * Returns the animation params.
 * @return {Array}
 * @private
 */
DvtPictoChartImageMarker.prototype._getAnimationParams = function() {
  return [this.getCx(), this.getCy(), this.getWidth(), this.getHeight()];
};

/**
 * Sets the animation params.
 * @param {Array} params
 * @private
 */
DvtPictoChartImageMarker.prototype._setAnimationParams = function(params) {
  this.setCx(params[0]);
  this.setCy(params[1]);
  this.setWidth(params[2]);
  this.setHeight(params[3]);
};
// Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
/**
 * PictoChartItem
 * @param {dvt.PictoChart} picto
 * @param {object} item The option object of the pictoChart item
 * @class
 * @constructor
 * @implements {DvtCategoricalObject}
 * @implements {DvtLogicalObject}
 * @implements {DvtSelectable}
 * @implements {DvtTooltipSource}
 * @implements {DvtKeyboardNavigable}
 */
var DvtPictoChartItem = function(picto, item) {
  this.Init(picto, item);
};

dvt.Obj.createSubclass(DvtPictoChartItem, dvt.Container);

/**
 * Counter for generating default id
 * @private
 */
DvtPictoChartItem._counter = 0;

/**
 * @param {dvt.PictoChart} picto
 * @param {object} item The option object of the pictoChart item
 * @override
 */
DvtPictoChartItem.prototype.Init = function(picto, item) {
  DvtPictoChartItem.superclass.Init.call(this, picto.getCtx(), null, item['id']);

  this._picto = picto;
  this._item = item;

  this._id = (item['id'] != null) ? item['id'] : (item['name'] != null) ? item['name'] : '_defaultId' + DvtPictoChartItem._counter;
  DvtPictoChartItem._counter++;

  this._isSelected = false;
  this._isShowingKeyboardFocusEffect = false;
  this._keyboardTooltipLocation = new dvt.Point(0, 0);

  // Apply the selecting cursor if selectable or drillable
  if (this.isSelectable() || this.isDrillable())
    this.setCursor(dvt.SelectionEffectUtils.getSelectingCursor());

  // Associate using the event manager
  picto.getEventManager().associate(this, this);
};

/**
 * Returns the column span of the item.
 * @return {number}
 */
DvtPictoChartItem.prototype.getColSpan = function() {
  var colSpan = this._item['columnSpan'];
  return (colSpan != null && colSpan >= 0) ? colSpan : 1;
};

/**
 * Returns the row span of the item.
 * @return {number}
 */
DvtPictoChartItem.prototype.getRowSpan = function() {
  var rowSpan = this._item['rowSpan'];
  return (rowSpan != null && rowSpan >= 0) ? rowSpan : 1;
};

/**
 * Returns the count of the item.
 * @return {number}
 */
DvtPictoChartItem.prototype.getCount = function() {
  var count = this._item['count'];
  return (count != null) ? Math.max(count, 0) : 1;
};

/**
 * Returns the shape of the item.
 * @return {string}
 */
DvtPictoChartItem.prototype.getShape = function() {
  return this._item['shape'] || this._picto.getOptions()['_defaultShape'];
};

/**
 * Returns the color of the item.
 * @return {string}
 */
DvtPictoChartItem.prototype.getColor = function() {
  return this._item['color'] || this._picto.getOptions()['_defaultColor'];
};

/**
 * Returns the border color of the item.
 * @return {string}
 */
DvtPictoChartItem.prototype.getBorderColor = function() {
  return this._item['borderColor'];
};

/**
 * Returns the border width of the item.
 * @return {number}
 */
DvtPictoChartItem.prototype.getBorderWidth = function() {
  return this._item['borderWidth'];
};

/**
 * Returns the URI of the default state.
 * @return {string}
 */
DvtPictoChartItem.prototype.getSource = function() {
  return this._item['source'];
};

/**
 * Returns the URI of the selected state.
 * @return {string}
 */
DvtPictoChartItem.prototype.getSourceSelected = function() {
  return this._item['sourceSelected'];
};

/**
 * Returns the URI of the hover state.
 * @return {string}
 */
DvtPictoChartItem.prototype.getSourceHover = function() {
  return this._item['sourceHover'];
};

/**
 * Returns the URI of the hover selected state.
 * @return {string}
 */
DvtPictoChartItem.prototype.getSourceHoverSelected = function() {
  return this._item['sourceHoverSelected'];
};

/**
 * Returns the name of the item.
 * @return {string}
 */
DvtPictoChartItem.prototype.getName = function() {
  return this._item['name'];
};

/**
 * Returns the id of the item.
 * @return {string}
 */
DvtPictoChartItem.prototype.getId = function() {
  return this._id;
};

/**
 * Returns the short description of the item.
 * @return {string}
 */
DvtPictoChartItem.prototype.getShortDesc = function() {
  return this._item['shortDesc'];
};

/**
 * Returns whether the item is drillable
 * @return {boolean}
 */
DvtPictoChartItem.prototype.isDrillable = function() {
  var drilling = this._item['drilling'];
  if (drilling && drilling != 'inherit')
    return drilling == 'on';
  else
    return this._picto.getOptions()['drilling'] == 'on';
};

/**
 * Returns whether the item is double clickable.
 * @return {boolean}
 */
DvtPictoChartItem.prototype.isDoubleClickable = function() {
  // : IE double clicking workaround in dvt.EventManager.
  return this.isSelectable() && this.isDrillable();
};

/**
 * Updates the ARIA attributes. Must be called after all items have been registered with the component to ensure
 * that the accessibility string (total count) is correct.
 */
DvtPictoChartItem.prototype.updateAriaAttributes = function() {
  this.setAriaRole('img');
  this._updateAriaLabel();
};

//---------------------------------------------------------------------//
// Tooltip Support: DvtTooltipSource impl                              //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartItem.prototype.getDatatip = function(target) {
  // Custom Tooltip via Function
  var options = this._picto.getOptions();
  var tooltipFunc = this._picto.getOptions()['tooltip'];
  if (tooltipFunc) {
    var tooltipManager = this._picto.getCtx().getTooltipManager();
    var dataContext = {
      'id': this.getId(),
      'name': this.getName(),
      'count': this.getCount(),
      'color': this.getColor()
    };
    return tooltipManager.getCustomTooltip(tooltipFunc, dataContext);
  }

  if (this.getShortDesc() != null)
    return this.getShortDesc();

  // Default Tooltip Support
  var nameTd = '';
  var name = this.getName();
  if (name)
    nameTd = dvt.HtmlTooltipManager.createStartTag('td', options['_tooltipLabelStyle']) + name + '<\/td>';

  var isRTL = dvt.Agent.isRightToLeft(this._picto.getCtx());
  options['_tooltipLabelStyle'].setStyle(dvt.CSSStyle.TEXT_ALIGN, isRTL ? 'left' : 'right');
  options['_tooltipValueStyle'].setStyle(dvt.CSSStyle.TEXT_ALIGN, isRTL ? 'right' : 'left');

  return dvt.HtmlTooltipManager.createStartTag('table', options['_tooltipStyle']) + '
' + nameTd +
      dvt.HtmlTooltipManager.createStartTag('td', options['_tooltipValueStyle']) + this._getCountString() + '<\/td>' +
      '<\/tr><\/table>';
};

/**
 * @override
 */
DvtPictoChartItem.prototype.getDatatipColor = function() {
  return this.getColor();
};

/**
 * Returns the item count and total count tooltip string.
 * @return {string}
 * @private
 */
DvtPictoChartItem.prototype._getCountString = function() {
  return dvt.Bundle.getTranslation(this._picto.getOptions(), 'labelCountWithTotal', dvt.Bundle.UTIL_PREFIX, 'COUNT_WITH_TOTAL', [this.getCount(), this._picto.getTotalCount()]);
};

//---------------------------------------------------------------------//
// Selection Support: DvtSelectable impl                               //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartItem.prototype.isSelectable = function() {
  return this._picto.getOptions()['selectionMode'] != 'none';
};

/**
 * @override
 */
DvtPictoChartItem.prototype.isSelected = function() {
  return this._isSelected;
};

/**
 * @override
 */
DvtPictoChartItem.prototype.setSelected = function(bSelected) {
  this._isSelected = bSelected;
  this._updateAriaLabel();

  for (var i = 0; i < this.getNumChildren(); i++) {
    var child = this.getChildAt(i);
    if (child instanceof DvtPictoChartShapeMarker || child instanceof DvtPictoChartImageMarker)
      child.setSelected(bSelected);
  }
};

/**
 * @override
 */
DvtPictoChartItem.prototype.showHoverEffect = function() {
  for (var i = 0; i < this.getNumChildren(); i++) {
    var child = this.getChildAt(i);
    if (child instanceof DvtPictoChartShapeMarker || child instanceof DvtPictoChartImageMarker)
      child.showHoverEffect();
  }
};

/**
 * @override
 */
DvtPictoChartItem.prototype.hideHoverEffect = function() {
  for (var i = 0; i < this.getNumChildren(); i++) {
    var child = this.getChildAt(i);
    if (child instanceof DvtPictoChartShapeMarker || child instanceof DvtPictoChartImageMarker)
      child.hideHoverEffect();
  }
};

//---------------------------------------------------------------------//
// Rollover and Hide/Show Support: DvtLogicalObject impl               //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartItem.prototype.getDisplayables = function() {
  return [this];
};

/**
 * @override
 */
DvtPictoChartItem.prototype.getAriaLabel = function() {
  var states = [];
  var options = this._picto.getOptions();
  if (this.isSelectable())
    states.push(dvt.Bundle.getTranslation(options, this.isSelected() ? 'stateSelected' : 'stateUnselected', dvt.Bundle.UTIL_PREFIX, this.isSelected() ? 'STATE_SELECTED' : 'STATE_UNSELECTED'));
  if (this.isDrillable())
    states.push(dvt.Bundle.getTranslation(options, 'stateDrillable', dvt.Bundle.UTIL_PREFIX, 'STATE_DRILLABLE'));

  var shortDesc;
  var name = this.getName();
  if (this.getShortDesc() != null)
    shortDesc = this.getShortDesc();
  else if (name == null)
    shortDesc = this._getCountString();
  else
    shortDesc = dvt.Bundle.getTranslatedString(dvt.Bundle.UTIL_PREFIX, 'COLON_SEP_LIST', [name, this._getCountString()]);

  return dvt.Displayable.generateAriaLabel(shortDesc, states);
};

/**
 * Updates the aria-label as needed. On desktop, we can defer the aria creation, and the aria-label will be updated
 * when the activeElement is set.
 * @private
 */
DvtPictoChartItem.prototype._updateAriaLabel = function() {
  if (!dvt.Agent.deferAriaCreation())
    this.setAriaProperty('label', this.getAriaLabel());
};

//---------------------------------------------------------------------//
// Rollover and Hide/Show Support: DvtCategoricalObject impl           //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartItem.prototype.getCategories = function(category) {
  return this._item['categories'] || [this.getId()];
};

//---------------------------------------------------------------------//
// Keyboard Support: DvtKeyboardNavigable impl                        //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartItem.prototype.getNextNavigable = function(event) {
  var keyboardHandler = this._picto.getEventManager().getKeyboardHandler();
  if (event.type == dvt.MouseEvent.CLICK || keyboardHandler.isMultiSelectEvent(event))
    return this;
  else if (keyboardHandler.isNavigationEvent(event))
    return DvtPictoChartKeyboardHandler.getNextNavigable(this._picto, this, event);
  else
    return null;
};

/**
 * @override
 */
DvtPictoChartItem.prototype.getKeyboardBoundingBox = function(targetCoordinateSpace) {
  return this.getDimensions(targetCoordinateSpace);
};

/**
 * @override
 */
DvtPictoChartItem.prototype.getTargetElem = function() {
  return this.getElem();
};

/**
 * @override
 */
DvtPictoChartItem.prototype.showKeyboardFocusEffect = function() {
  this._isShowingKeyboardFocusEffect = true;
  this.showHoverEffect();
};

/**
 * @override
 */
DvtPictoChartItem.prototype.hideKeyboardFocusEffect = function() {
  this._isShowingKeyboardFocusEffect = false;
  this.hideHoverEffect();
};

/**
 * @override
 */
DvtPictoChartItem.prototype.isShowingKeyboardFocusEffect = function() {
  return this._isShowingKeyboardFocusEffect;
};

/**
 * Sets where the tooltip should appear on keyboard navigation.
 * @param {dvt.Point} location
 */
DvtPictoChartItem.prototype.setKeyboardTooltipLocation = function(location) {
  this._keyboardTooltipLocation = location;
};

/**
 * @override
 */
DvtPictoChartItem.prototype.getKeyboardTooltipLocation = function() {
  return this._keyboardTooltipLocation;
};
/**
 * @param {DvtPictoChartEventManager} eventManager The owning event manager.
 * @class DvtPictoChartKeyboardHandler
 * @extends {dvt.KeyboardHandler}
 * @constructor
 */
var DvtPictoChartKeyboardHandler = function(eventManager) {
  this.Init(eventManager);
};

dvt.Obj.createSubclass(DvtPictoChartKeyboardHandler, dvt.KeyboardHandler);

/**
 * @override
 */
DvtPictoChartKeyboardHandler.prototype.isSelectionEvent = function(event) {
  return this.isNavigationEvent(event) && !event.ctrlKey;
};

/**
 * @override
 */
DvtPictoChartKeyboardHandler.prototype.isMultiSelectEvent = function(event) {
  return event.keyCode == dvt.KeyboardEvent.SPACE && event.ctrlKey;
};

/**
 * Finds next navigable item based on direction.
 * @param {dvt.PictoChart} picto The component.
 * @param {DvtKeyboardNavigable} currentNavigable The navigable item with current focus.
 * @param {dvt.KeyboardEvent} event The keyboard event.
 * @return {DvtKeyboardNavigable} The next navigable.
 */
DvtPictoChartKeyboardHandler.getNextNavigable = function(picto, currentNavigable, event) {
  var isOriginRight = DvtPictoChartRenderer.isOriginRight(picto);
  var isOriginBottom = DvtPictoChartRenderer.isOriginBottom(picto);

  var isForward =
      (event.keyCode == dvt.KeyboardEvent.LEFT_ARROW && isOriginRight) ||
      (event.keyCode == dvt.KeyboardEvent.RIGHT_ARROW && !isOriginRight) ||
      (event.keyCode == dvt.KeyboardEvent.UP_ARROW && isOriginBottom) ||
      (event.keyCode == dvt.KeyboardEvent.DOWN_ARROW && !isOriginBottom);

  var navigableItems = picto.getItems();
  var nextIdx = dvt.ArrayUtils.getIndex(navigableItems, currentNavigable) + (isForward ? 1 : -1);
  if (nextIdx < navigableItems.length && nextIdx >= 0)
    return navigableItems[nextIdx];
  else
    return currentNavigable;
};

/**
 * @override
 */
DvtPictoChartKeyboardHandler.prototype.processKeyDown = function(event) {
  var currentNavigable = this._eventManager.getFocus();
  if (currentNavigable && event.keyCode == dvt.KeyboardEvent.ENTER) {
    this._eventManager.processDrillEvent(currentNavigable);
    dvt.EventManager.consumeEvent(event);
    return currentNavigable;
  }
  else
    return DvtPictoChartKeyboardHandler.superclass.processKeyDown.call(this, event);
};
// Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.

/**
 *  @param {DvtPictChart} picto
 *  @param {String} shape Marker shape.
 *  @param {number} cx The x position of the center of the marker.
 *  @param {number} cy The y position of the center of the marker.
 *  @param {number} width The width of the marker.
 *  @param {number} height The height of the marker.
 *  @param {String} id The id of the marker.
 *  @extends {dvt.SimpleMarker}
 *  @constructor
 */
var DvtPictoChartShapeMarker = function(picto, shape, cx, cy, width, height, id) {
  DvtPictoChartShapeMarker.superclass.Init.call(this, picto.getCtx(), shape, dvt.CSSStyle.SKIN_ALTA, cx, cy, width, height, null, true, id);
  this._picto = picto;
};

dvt.Obj.createSubclass(DvtPictoChartShapeMarker, dvt.SimpleMarker);

//---------------------------------------------------------------------//
// Animation support: dvt.DataAnimationHandler                          //
//---------------------------------------------------------------------//

/**
 * @override
 */
DvtPictoChartShapeMarker.prototype.animateUpdate = function(handler, oldMarker) {
  var animation = new dvt.CustomAnimation(this.getCtx(), this, this._picto.getAnimationDuration() * 0.75);
  var animator = animation.getAnimator();

  // Color animation
  var endFill = this.getFill();
  this.setFill(oldMarker.getFill().clone());
  animator.addProp(dvt.Animator.TYPE_FILL, this, this.getFill, this.setFill, endFill);

  // Position and size animation
  var endParams = this._getAnimationParams();
  this._setAnimationParams(oldMarker._getAnimationParams());
  animator.addProp(dvt.Animator.TYPE_NUMBER_ARRAY, this, this._getAnimationParams, this._setAnimationParams, endParams);

  // Hide old item
  oldMarker.setAlpha(0);

  handler.add(animation, 1);
};

/**
 * @override
 */
DvtPictoChartShapeMarker.prototype.animateDelete = function(handler) {
  handler.add(new dvt.AnimFadeOut(this.getCtx(), this, this._picto.getAnimationDuration() * 0.5), 0);
};

/**
 * @override
 */
DvtPictoChartShapeMarker.prototype.animateInsert = function(handler) {
  this.setAlpha(0);
  handler.add(new dvt.AnimFadeIn(this.getCtx(), this, this._picto.getAnimationDuration() * 0.5), 2);
};

/**
 * Returns the animation params.
 * @return {Array}
 * @private
 */
DvtPictoChartShapeMarker.prototype._getAnimationParams = function() {
  return [this.getCx(), this.getCy(), this.getWidth(), this.getHeight()];
};

/**
 * Sets the animation params.
 * @param {Array} params
 * @private
 */
DvtPictoChartShapeMarker.prototype._setAnimationParams = function(params) {
  this.setCx(params[0]);
  this.setCy(params[1]);
  this.setWidth(params[2]);
  this.setHeight(params[3]);
};
/**
 * Renderer for dvt.PictoChart.
 * @class
 */
var DvtPictoChartRenderer = {};

dvt.Obj.createSubclass(DvtPictoChartRenderer, dvt.Obj);

/**
 * Renders the pictoChart contents into the available space.
 * @param {dvt.PictoChart} picto The pictoChart being rendered.
 * @param {dvt.Container} container The container to render into.
 * @param {dvt.Rectangle} availSpace The available space.
 * @param {Object=} info (optional) The pictoChart info, obtained from DvtPictoChartRenderer.getInfo().
 */
DvtPictoChartRenderer.render = function(picto, container, availSpace, info) {
  // Add invisible background to allow interactivity (e.g. clear selection)
  var context = picto.getCtx();
  var background = new dvt.Rect(context, availSpace.x, availSpace.y, availSpace.w, availSpace.h);
  background.setInvisibleFill();
  container.addChild(background);

  if (!info)
    info = DvtPictoChartRenderer.getInfo(picto, availSpace.w, availSpace.h);

  if (!info.items) {
    DvtPictoChartRenderer.renderEmptyText(picto, container, availSpace);
    return;
  }

  // Register the items
  picto.registerItems(info.items);

  var options = picto.getOptions();
  var gapRatio = options['_gapRatio'];
  var isVert = DvtPictoChartRenderer.isVertical(picto);
  var isOriginBottom = DvtPictoChartRenderer.isOriginBottom(picto);
  var isOriginRight = DvtPictoChartRenderer.isOriginRight(picto);

  // Use a 2D cell map to keep track of which cells are occupied
  var cellMap = new dvt.Map2D();

  var prevColSpan = 0;
  var prevRowSpan = 0;
  var remainder = 0; // fractional remainder of the previous item

  for (var i = 0; i < info.items.length; i++) {
    var item = info.items[i];
    var colSpan = item.getColSpan();
    var rowSpan = item.getRowSpan();
    var w = colSpan * info.colWidth;
    var h = rowSpan * info.rowHeight;

    var count = item.getCount(); // number of markers left to be rendered
    var index = 0; // marker index for animation
    var isFirstMarker = true;
    var cell;

    while (count > 0) {
      // Fractional markers can't be combined if the colSpan and rowSpan don't match
      if (colSpan != prevColSpan || rowSpan != prevRowSpan)
        remainder = 0;

      // If there's no remainder, use a new cell. Otherwise, render on the previous cell
      if (remainder == 0)
        cell = DvtPictoChartRenderer._findNextAvailableCell(cellMap, colSpan, rowSpan, info.colCount, info.rowCount, isVert);

      if (cell == null)
        break;

      // Marker coords
      var xOffset = cell.col * info.colWidth + w / 2;
      var yOffset = cell.row * info.rowHeight + h / 2;
      var x = availSpace.x + (isOriginRight ? availSpace.w - xOffset : xOffset);
      var y = availSpace.y + (isOriginBottom ? availSpace.h - yOffset : yOffset);

      // Draw fractional marker if remaining count is less than one, or if there's a remainder from the previous item
      var fraction = Math.min(1 - remainder, count);

      // Coords for hit area and clip path
      var rectX, rectY, rectW, rectH;
      if (isVert) {
        rectX = x - w / 2;
        rectY = isOriginBottom ? y + h * (0.5 - fraction - remainder) : y + h * (remainder - 0.5);
        rectW = w;
        rectH = h * fraction;
      }
      else {
        rectX = isOriginRight ? x + w * (0.5 - fraction - remainder) : x + w * (remainder - 0.5);
        rectY = y - h / 2;
        rectW = w * fraction;
        rectH = h;
      }

      // Set the marker ID for data change animation
      var markerId;
      if (fraction == 1) {
        markerId = item.getId() + '_' + index;
        index++;
      }
      else {
        // Set a random ID so that fractional markers don't get animateUpdate (only animateInsert and animateDelete)
        // This is a workaround for not animating the clipPath
        markerId = Math.random();
      }

      var marker;
      if (item.getSource()) {
        // Custom image marker
        marker = new DvtPictoChartImageMarker(picto, x, y, w, h, item.getSource(), item.getSourceSelected(),
            item.getSourceHover(), item.getSourceHoverSelected(), markerId + '_I');
      }
      else {
        // Add hit area to remove gap between shapes (for selection, tooltip, etc)
        var hitArea = new dvt.Rect(context, rectX, rectY, rectW, rectH);
        hitArea.setInvisibleFill();
        item.addChild(hitArea);

        // Create shape marker
        marker = new DvtPictoChartShapeMarker(picto, item.getShape(), x, y,
            w - info.colWidth * gapRatio, h - info.rowHeight * gapRatio, markerId + '_S');
        marker.setSolidFill(item.getColor());
        marker.setSolidStroke(item.getBorderColor(), null, item.getBorderWidth());
        marker.setDataColor(item.getColor());
      }

      // Draw clip path if the marker is fractional
      if (fraction < 1) {
        var clipPath = new dvt.ClipPath();
        clipPath.addRect(rectX, rectY, rectW, rectH);
        marker.setClipPath(clipPath);
      }

      // Set the keyboard tooltip to show up on the first marker
      if (isFirstMarker) {
        item.setKeyboardTooltipLocation(new dvt.Point(x, y));
        isFirstMarker = false;
      }

      item.addChild(marker);
      picto.registerMarker(marker);

      count -= fraction;
      remainder = (remainder + fraction) % 1;
    }

    container.addChild(item);
    item.updateAriaAttributes();

    prevColSpan = colSpan;
    prevRowSpan = rowSpan;
  }
};

/**
 * Creates the pictoChart items and computes the layout variables.
 * @param {dvt.PictoChart} picto The pictoChart being rendered.
 * @param {number=} width The width, if fixed by user (optional)
 * @param {number=} height The height, if fixed by user (optional)
 * @return {Object} An object containing items, colCount, rowCount, colWidth, and rowHeight.
 */
DvtPictoChartRenderer.getInfo = function(picto, width, height) {
  var options = picto.getOptions();
  var itemObjs = options['items'];
  if (!itemObjs)
    return {};

  // Create a boolean map of hidden categories for better performance
  var categoryMap = dvt.ArrayUtils.createBooleanMap(options['hiddenCategories']);

  // Create items and compute the number of cells that are needed to fit all items
  var items = [];
  var numCells = 0;
  var maxColSpan = 1;
  var maxRowSpan = 1;

  for (var i = 0; i < itemObjs.length; i++) {
    if (itemObjs[i] == null)
      continue;

    var item = new DvtPictoChartItem(picto, itemObjs[i]);
    if (categoryMap && dvt.ArrayUtils.hasAnyMapItem(categoryMap, item.getCategories()))
      continue;

    // Compute the maximum colSpan and rowSpan
    var colSpan = item.getColSpan();
    var rowSpan = item.getRowSpan();
    if (colSpan > maxColSpan)
      maxColSpan = colSpan;
    if (rowSpan > maxRowSpan)
      maxRowSpan = rowSpan;

    numCells += colSpan * rowSpan * item.getCount();
    items.push(item);
  }
  if (numCells == 0)
    return {};

  // Default colWidth and rowHeight for flowing layout
  var colWidth = options['columnWidth'];
  var rowHeight = options['rowHeight'];
  if (!width || !height) {
    if (!colWidth)
      colWidth = rowHeight ? rowHeight : options['_defaultSize'];
    if (!rowHeight)
      rowHeight = colWidth;
  }

  // Default colCount and rowCount for both layouts
  // We set the default colCount (or rowCount) to be an integer multiple of the maxColSpan (or maxRowSpan) to
  // ensure that all the items can find a spot to occupy in the mixed sizes case.
  var isVert = DvtPictoChartRenderer.isVertical(picto);
  var colCount = options['columnCount'];
  var rowCount = options['rowCount'];
  if (!colCount && !rowCount) {
    // Try to achieve square cells, (width / colCount) = (height / rowCount)
    if (width && height) {
      if (isVert)
        rowCount = DvtPictoChartRenderer._ceil(Math.sqrt(numCells * height / width), maxRowSpan);
      else
        colCount = DvtPictoChartRenderer._ceil(Math.sqrt(numCells * width / height), maxColSpan);
    }
    else if (width)
      colCount = Math.max(Math.floor(width / colWidth), 1);
    else if (height)
      rowCount = Math.max(Math.floor(height / rowHeight), 1);
    else {
      if (isVert)
        rowCount = DvtPictoChartRenderer._ceil(Math.sqrt(numCells), maxRowSpan);
      else
        colCount = DvtPictoChartRenderer._ceil(Math.sqrt(numCells), maxColSpan);
    }
  }
  // Now only either colCount or rowCount is undefined
  if (!colCount)
    colCount = DvtPictoChartRenderer._ceil(numCells / rowCount, maxColSpan);
  else if (!rowCount)
    rowCount = DvtPictoChartRenderer._ceil(numCells / colCount, maxRowSpan);

  // Default colWidth and rowHeight for fixed layout
  if (width && height) {
    if (!colWidth)
      colWidth = rowHeight ? rowHeight : Math.min(width / colCount, height / rowCount);
    if (!rowHeight)
      rowHeight = colWidth;
  }

  if (colCount <= 0 || rowCount <= 0 || colWidth <= 0 || rowHeight <= 0)
    return {};

  return {items: items, colCount: colCount, rowCount: rowCount, colWidth: colWidth, rowHeight: rowHeight};
};

/**
 * Round "a" up to the closest number that is an integer multiple of "b"
 * @param {number} a
 * @param {number} b
 * @return {number}
 * @private
 */
DvtPictoChartRenderer._ceil = function(a, b) {
  return Math.ceil(a / b) * b;
};

/**
 * Returns the next available cell for the shape.
 * @param {dvt.Map2D} cellMap
 * @param {number} colSpan
 * @param {number} rowSpan
 * @param {number} colCount
 * @param {number} rowCount
 * @param {boolean} isVert Whether the layout is vertical.
 * @return {object} Contains the col and row of the next available cell.
 * @private
 */
DvtPictoChartRenderer._findNextAvailableCell = function(cellMap, colSpan, rowSpan, colCount, rowCount, isVert) {
  if (isVert) {
    // For vertical layout, switch row and col in the computation, and switch the result back
    var cell = DvtPictoChartRenderer._findNextAvailableCell(cellMap, rowSpan, colSpan, rowCount, colCount, false);
    return cell ? {col: cell.row, row: cell.col} : null;
  }

  for (var r = 0; r < rowCount - rowSpan + 1; r++) {
    for (var c = 0; c < colCount - colSpan + 1; c++) {
      if (DvtPictoChartRenderer._areCellsAvailable(cellMap, c, r, colSpan, rowSpan)) {
        DvtPictoChartRenderer._occupyCells(cellMap, c, r, colSpan, rowSpan);
        return {col: c, row: r};
      }
    }
  }

  return null;
};

/**
 * Returns whether the cells are available.
 * @param {dvt.Map2D} cellMap
 * @param {number} col
 * @param {number} row
 * @param {number} colSpan
 * @param {number} rowSpan
 * @return {boolean}
 * @private
 */
DvtPictoChartRenderer._areCellsAvailable = function(cellMap, col, row, colSpan, rowSpan) {
  for (var r = 0; r < rowSpan; r++) {
    for (var c = 0; c < colSpan; c++) {
      if (cellMap.get(col + c, row + r))
        return false;
    }
  }
  return true;
};

/**
 * Occupies the specified cells.
 * @param {dvt.Map2D} cellMap
 * @param {number} col
 * @param {number} row
 * @param {number} colSpan
 * @param {number} rowSpan
 * @private
 */
DvtPictoChartRenderer._occupyCells = function(cellMap, col, row, colSpan, rowSpan) {
  for (var r = 0; r < rowSpan; r++) {
    for (var c = 0; c < colSpan; c++) {
      cellMap.put(col + c, row + r, true);
    }
  }
};

/**
 * Renders the empty text for the component.
 * @param {dvt.PictoChart} picto The pictoChart being rendered.
 * @param {dvt.Container} container The container to render into.
 * @param {dvt.Rectangle} availSpace The available space.
 */
DvtPictoChartRenderer.renderEmptyText = function(picto, container, availSpace) {
  var options = picto.getOptions();
  var emptyTextStr = dvt.Bundle.getTranslation(options, 'labelNoData', dvt.Bundle.UTIL_PREFIX, 'NO_DATA');
  var emptyText = dvt.TextUtils.renderEmptyText(container, emptyTextStr, availSpace.clone(),
      picto.getEventManager(), options['_statusMessageStyle']);
  picto.registerEmptyText(emptyText);
};

/**
 * Returns whether the pictoChart is vertical.
 * @param {dvt.PictoChart} picto
 * @return {boolean}
 */
DvtPictoChartRenderer.isVertical = function(picto) {
  return picto.getOptions()['layout'] == 'vertical';
};

/**
 * Returns whether the pictoChart is layout from bottom to top.
 * @param {dvt.PictoChart} picto
 * @return {boolean}
 */
DvtPictoChartRenderer.isOriginBottom = function(picto) {
  var origin = picto.getOptions()['layoutOrigin'];
  return origin == 'bottomStart' || origin == 'bottomEnd';
};

/**
 * Returns whether the pictoChart is layout from right to left.
 * @param {dvt.PictoChart} picto
 * @return {boolean}
 */
DvtPictoChartRenderer.isOriginRight = function(picto) {
  var origin = picto.getOptions()['layoutOrigin'];
  var isEnd = origin == 'topEnd' || origin == 'bottomEnd';
  return dvt.Agent.isRightToLeft(picto.getCtx()) ? !isEnd : isEnd;
};
dvt.exportProperty(dvt, 'PictoChart', dvt.PictoChart);
dvt.exportProperty(dvt.PictoChart, 'newInstance', dvt.PictoChart.newInstance);
dvt.exportProperty(dvt.PictoChart.prototype, 'destroy', dvt.PictoChart.prototype.destroy);
dvt.exportProperty(dvt.PictoChart.prototype, 'getAutomation', dvt.PictoChart.prototype.getAutomation);
dvt.exportProperty(dvt.PictoChart.prototype, 'highlight', dvt.PictoChart.prototype.highlight);
dvt.exportProperty(dvt.PictoChart.prototype, 'render', dvt.PictoChart.prototype.render);
dvt.exportProperty(dvt.PictoChart.prototype, 'select', dvt.PictoChart.prototype.select);

dvt.exportProperty(DvtPictoChartAutomation.prototype, 'getDomElementForSubId', DvtPictoChartAutomation.prototype.getDomElementForSubId);
dvt.exportProperty(DvtPictoChartAutomation.prototype, 'getItem', DvtPictoChartAutomation.prototype.getItem);
dvt.exportProperty(DvtPictoChartAutomation.prototype, 'getItemCount', DvtPictoChartAutomation.prototype.getItemCount);
})(dvt);

  return dvt;
});


text:
require 'helper'

describe Twitter::List do

  describe "#==" do
    it "should return true when ids and classes are equal" do
      list = Twitter::List.new('id' => 1)
      other = Twitter::List.new('id' => 1)
      (list == other).should be_true
    end
    it "should return false when classes are not equal" do
      list = Twitter::List.new('id' => 1)
      other = Twitter::User.new('id' => 1)
      (list == other).should be_false
    end
    it "should return false when ids are not equal" do
      list = Twitter::List.new('id' => 1)
      other = Twitter::List.new('id' => 2)
      (list == other).should be_false
    end
  end

  describe "#user" do
    it "should return a User when user is set" do
      user = Twitter::List.new('user' => {}).user
      user.should be_a Twitter::User
    end
    it "should return nil when status is not set" do
      user = Twitter::List.new.user
      user.should be_nil
    end
  end

end

redpajama_set_name: RedPajamaGithub


text:
/*
** This code was written by Kent Paul Dolan, from knowledge of good
** programming practice.  See accompanying file TravellerDoc.html for
** status for your use.
*/

package tccrouter.gbl.tsp.genetic.tools;

public interface Sortable
{

  public static final int THIS_LESS_THAN    = -1;
  public static final int THIS_EQUAL_TO     =  0;
  public static final int THIS_GREATER_THAN =  1;

  public int compareTo( Object that );
  public void swap( Object object_1 , Object object_2 );
}


text:
<?php
/**
 * TOP API: taobao.openim.chatlogs.import request
 *
 * @author auto create
 * @since 1.0, 2015.12.31
 */
class OpenimChatlogsImportRequest
{
	/**
	 * 消息序列
	 **/
	private $messages;

	private $apiParas = array();

	public function setMessages($messages)
	{
		$this->messages = $messages;
		$this->apiParas["messages"] = $messages;
	}

	public function getMessages()
	{
		return $this->messages;
	}

	public function getApiMethodName()
	{
		return "taobao.openim.chatlogs.import";
	}

	public function getApiParas()
	{
		return $this->apiParas;
	}

	public function check()
	{

	}

	public function putOtherTextParam($key, $value) {
		$this->apiParas[$key] = $value;
		$this->$key = $value;
	}
}


text:
package com.acervera.osmfacts.fact3

import com.acervera.osm4scala.model.{NodeEntity, OSMTypes, WayEntity}
import com.acervera.osmfacts.FactsCommons
import org.apache.spark.{SparkConf, SparkContext}

/**
  * Passing a node and ways, extract all ways' coordinates and the node coordinate preparing it for the javascript demo.
  *
  * Used only from the integration test.
  */
object Fact3ExtractExampleDriver extends FactsCommons {

  case class LatLng(lat: Double, lng: Double) {
    def toLatLongString(): String = s"[$lat,$lng]"
  }

  def extractWays(defaultConfig: SparkConf, input: String, nodeIntersectionId: Long, wayIds: Seq[Long]): String = {

    val conf = defaultConfig.setAppName("Check connections in extremes")
    conf.set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
    val sc = new SparkContext(conf)
    try {

      val errorCounter = sc.longAccumulator

      // Process entities to cache only necessary data.
      val entities = sc
        .binaryFiles(input)
        .flatMap { case (path, binaryBlob) => parseBlob(path, binaryBlob.toArray(), errorCounter) }
        .filter(entity => entity.osmModel == OSMTypes.Way || entity.osmModel == OSMTypes.Node)
        .flatMap {
          case entity if entity.osmModel == OSMTypes.Way && wayIds.contains(entity.id) => {
            val way = entity.asInstanceOf[WayEntity]
            Some(Left((way.id, way.nodes))) // Ways with nodes.
          }
          case entity if entity.osmModel == OSMTypes.Node => {
            val node = entity.asInstanceOf[NodeEntity]
            Some(Right((node.id, LatLng(node.latitude, node.longitude)))) // Nodes with Coords.
          }
          case _ => None
        }
        .cache()

      // WARNING!!!! We can do the follow because we know that ways and nodes related with ways data fit in memory.

      val ways: Array[(Long, Seq[Long])] = entities
        .flatMap {
          case Left(way) => Some(way)
          case _         => None
        }
        .collect()

      val nodeIds: Seq[Long] = ways.flatMap(_._2)

      val nodes: Map[Long, LatLng] = entities
        .flatMap {
          case Right(node) if (nodeIds.contains(node._1)) => Some(node)
          case _                                          => None
        }
        .collect()
        .toMap

      // Generate Javascript
      val intersectionPoint = nodes(nodeIntersectionId).toLatLongString
      val waysJs = ways.map(way => way._2.map(nodes(_).toLatLongString)).map(_.mkString("[", ",", "]"))

      val javascript =
        s"""
           |var fact3IntersectionPoint = ${intersectionPoint}
           |var fact3Ways = ${waysJs.mkString("[\n   ", ",\n   ", "\n]")}
    """.stripMargin

      javascript

    } finally {
      if (!sc.isStopped) sc.stop()
    }
  }

}


text:
//
//  JKVC2.m
//  JKCrashProtect
//
//  Created by Jack on 2017/6/3.
//  Copyright © 2017年 HHL110120. All rights reserved.
//

#import "JKVC2.h"

#import "JKPerson.h"

@interface JKVC2 ()
{
    JKPerson *_jack;
}
@end

@implementation JKVC2

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    _jack = [JKPerson new];
 [_jack addObserver:self forKeyPath:@"name" options:NSKeyValueObservingOptionNew context:nil];
//    dispatch_async(dispatch_get_global_queue(0, 0), ^{
//      [_jack addObserver:self forKeyPath:@"name" options:NSKeyValueObservingOptionNew context:nil];
//    });

    UIButton *button = [UIButton new];
    button.frame = CGRectMake(0, 0, 80, 30);
    button.center = self.view.center;
    button.backgroundColor = [UIColor redColor];
    [button setTitle:@"Click" forState:UIControlStateNormal];
    [button addTarget: self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];

}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{

    if ([keyPath isEqualToString:@"name"]) {
        NSLog(@"height changed!!!");
    }

}

- (void)buttonClicked:(UIButton *)button{

_jack.name = @"Jack";

}

- (void)dealloc{

    dispatch_async(dispatch_get_global_queue(0, 0), ^{
          //[_jack removeObserver:self forKeyPath:@"name"];
        [_jack removeObserver:self forKeyPath:@"name" context:nil];
    });
    [_jack removeObserver:self forKeyPath:@"name"];

//    [_jack removeObserver:self forKeyPath:@"name" context:nil];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
#ifndef __i386_h__
#define __i386_h__

#ifndef OBJC_FORWARDING_STACK_OFFSET
#define OBJC_FORWARDING_STACK_OFFSET	0
#endif

#ifndef OBJC_FORWARDING_MIN_OFFSET
#define OBJC_FORWARDING_MIN_OFFSET 0
#endif

/* Define the size of the block returned by __builtin_apply_args. This value is
   computed by the function in expr.c. The block contains in order: a pointer
   to the stack arguments frame, the structure value address unless this is
   passed as an "invisible" first argument and all registers that may be used
   in calling a function. */

#define APPLY_ARGS_SIZE	8

/* Define the size of the result block returned by the __builtin_apply. This
   block contains all registers that could be used to return the function
   value. This value is computed by apply_result_size function in expr.c. There
   are also machines where this value is predefined in the machine description
   file, so that machine specific information can be stored. */

#define APPLY_RESULT_SIZE	116

/* Define how to find the value returned by a function. TYPE is a Objective-C
   encoding string describing the type of the returned value. ARGS is the
   arguments frame passed to __builtin_apply. RESULT_FRAME is the address of
   the block returned by __builtin_apply. RETURN_VALUE is an address where
   this macro should put the returned value. */

#ifdef BROKEN_BUILTIN_APPLY

#define FUNCTION_VALUE(TYPE, ARGS, RESULT_FRAME, RETURN_VALUE) \
    ({	int type_size = objc_sizeof_type(TYPE); \
	if(*(TYPE) == _C_FLT) { \
	    float aFloat; \
	    asm("fsts %0" : "=f2" (aFloat) :); \
	    *(float*)(RETURN_VALUE) = aFloat; \
	} \
	else if(*(TYPE) == _C_DBL) { \
	    double aDouble; \
	    asm("fstl %0" : "=f2" (aDouble)); \
	    *(double*)(RETURN_VALUE) = aDouble; \
	} \
	else if(*(TYPE) == _C_STRUCT_B || *(TYPE) == _C_UNION_B \
		|| *(TYPE) == _C_ARY_B) \
	    memcpy((RETURN_VALUE), \
		   *(void**)(((char*)(ARGS)) + sizeof(void*)), type_size); \
	else memcpy((RETURN_VALUE), (RESULT_FRAME), type_size); })

#else /* !BROKEN_BUILTIN_APPLY */

#define FUNCTION_VALUE(TYPE, ARGS, RESULT_FRAME, RETURN_VALUE) \
    ({	int type_size = objc_sizeof_type(TYPE); \
	if(*(TYPE) == _C_FLT) { \
	    *(float*)(RETURN_VALUE) = \
		(float)*(long double*)(((char*)(RESULT_FRAME)) + 8); \
	} \
	else if(*(TYPE) == _C_DBL) { \
	    *(double*)(RETURN_VALUE) = \
		(double)*(long double*)(((char*)(RESULT_FRAME)) + 8); \
	} \
	else if(*(TYPE) == _C_STRUCT_B || *(TYPE) == _C_UNION_B \
		|| *(TYPE) == _C_ARY_B) \
	    memcpy((RETURN_VALUE), \
		   *(void**)(((char*)(ARGS)) + sizeof(void*)), type_size); \
	else memcpy((RETURN_VALUE), (RESULT_FRAME), type_size); })

#endif /* !BROKEN_BUILTIN_APPLY */

/* Set the value in RETURN_VALUE to be the value returned by a function.
   Assume that the fucntion was previously called and RESULT_FRAME is the
   address of the block returned by __builtin_apply. TYPE is the actual
   type of this value. ARGS is the address of block that was passed
   to __builtin_apply. */

#ifdef BROKEN_BUILTIN_APPLY

#define FUNCTION_SET_VALUE(TYPE, ARGS, RESULT_FRAME, RETURN_VALUE) \
    ({  int type_size = objc_sizeof_type(TYPE); \
	if(*(TYPE) == _C_FLT) { \
	    float aFloat = *(float*)(RETURN_VALUE); \
	    asm("fld %0" : : "f" (aFloat)); \
	} \
	else if(*(TYPE) == _C_DBL) { \
	    double aDouble = *(double*)(RETURN_VALUE); \
	    asm("fldl %0" : : "f" (aDouble)); \
	} \
	else if(*(TYPE) == _C_STRUCT_B || *(TYPE) == _C_UNION_B \
		|| *(TYPE) == _C_ARY_B) \
	    memcpy(*(void**)(((char*)(ARGS)) + sizeof(void*)), \
		   (RETURN_VALUE), type_size); \
	else memcpy((RESULT_FRAME), (RETURN_VALUE), type_size); })

#else /* !BROKEN_BUILTIN_APPLY */

#define FUNCTION_SET_VALUE(TYPE, ARGS, RESULT_FRAME, RETURN_VALUE) \
    ({  int type_size = objc_sizeof_type(TYPE); \
	if(*(TYPE) == _C_FLT) \
	    *(long double*)(((char*)(RESULT_FRAME)) + 8) = \
		(long double)*(float*)(RETURN_VALUE); \
	else if(*(TYPE) == _C_DBL) \
	    *(long double*)(((char*)(RESULT_FRAME)) + 8) = \
		(long double)*(double*)(RETURN_VALUE); \
	else if(*(TYPE) == _C_STRUCT_B || *(TYPE) == _C_UNION_B \
		|| *(TYPE) == _C_ARY_B) \
	    memcpy(*(void**)(((char*)(ARGS)) + sizeof(void*)), \
		   (RETURN_VALUE), type_size); \
	else memcpy((RESULT_FRAME), (RETURN_VALUE), type_size); })

#endif /* !BROKEN_BUILTIN_APPLY */

/* If the RETTYPE is a structure and the address of the structure value is
   passed to the called function, then obtain from ARGS its address. In general
   this address is the second pointer into the arguments frame. This macro
   should produce 0 if the RETTYPE doesn't match the conditions above. */

#define GET_STRUCT_VALUE_ADDRESS(ARGS, RETTYPE) \
    ((*(RETTYPE) == _C_STRUCT_B || *(RETTYPE) == _C_UNION_B \
	    || *(RETTYPE) == _C_ARY_B) ? \
	  *(void**)(((char*)(ARGS)) + sizeof(void*)) \
	: 0)

/* Prepare ARGS for calling the function. If the function returns a struct by
   value, it's the caller responsability to pass to the called function the
   address of where to store the structure value. */

#define SET_STRUCT_VALUE_ADDRESS(ARGS, ADDR, RETTYPE) \
    *(void**)(((char*)(ARGS)) + sizeof(void*)) = (ADDR)

/* The following macros are used to determine the encoding of a selector given
   the types of arguments. This macros follows the similar ones defined in the
   target machine description from the compiler sources. */

/* Define a data type for recording info about the arguments list of a method.
   A variable of this type is further used by FUNCTION_ARG_ENCODING to
   determine the encoding of an argument. This type should record all info
   about arguments processed so far. */

#define CUMULATIVE_ARGS int

/* Initialize a variable of type CUMULATIVE_ARGS. This macro is called before
   processing the first argument of a method. */

#define INIT_CUMULATIVE_ARGS(CUM)	((CUM) = 0)

/* This macro determines the encoding of the next argument of a method. It is
   called repetitively, starting with the first argument and continuing to the
   last one. CUM is a variable of type CUMULATIVE_ARGS. TYPE is a NSString
   which represents the type of the argument processed. This macro must
   produce a NSString whose value represents the encoding and position of the
   current argument. STACKSIZE is a variable that counts the number of bytes
   occupied by the arguments on the stack. */

#ifndef ROUND
#define ROUND(V, A) \
  ({ typeof(V) __v=(V); typeof(A) __a=(A); \
     __a*((__v+__a-1)/__a); })
#endif

#define FUNCTION_ARG_ENCODING(CUM, TYPE, STACK_ARGSIZE) \
    ({  id encoding; \
	const char* type = [(TYPE) cString]; \
	int align = objc_alignof_type(type); \
	int type_size = objc_sizeof_type(type); \
\
	(CUM) = ROUND((CUM), align); \
	encoding = [NSString stringWithFormat:@"%@%d", \
				    (TYPE), \
				    (CUM) + OBJC_FORWARDING_STACK_OFFSET]; \
	if((*type == _C_STRUCT_B || *type == _C_UNION_B || *type == _C_ARY_B) \
		&& type_size > 2) \
	    (STACK_ARGSIZE) = (CUM) + ROUND(type_size, align); \
	else (STACK_ARGSIZE) = (CUM) + type_size; \
	(CUM) += ROUND(type_size, sizeof(void*)); \
	encoding; })

#endif /* __i386_h__ */

/*
  Local Variables:
  c-basic-offset: 4
  tab-width: 8
  End:
*/


text:
import { IotPlatform32 } from "../../";

export = IotPlatform32;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Schlechtendalia 4: 7 (2000)

#### Original name
Microsphaera coryli (Jacz.) Golovin

### Remarks
null


text:
package com.networknt.schema;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.networknt.schema.walk.JsonSchemaWalkListener;
import com.networknt.schema.walk.WalkEvent;
import com.networknt.schema.walk.WalkFlow;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Set;

public class Issue461Test {
    protected ObjectMapper mapper = new ObjectMapper();

    protected JsonSchema getJsonSchemaFromStreamContentV7(URI schemaUri) {
        JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7);
        SchemaValidatorsConfig svc = new SchemaValidatorsConfig();
        svc.addKeywordWalkListener(ValidatorTypeCode.PROPERTIES.getValue(), new Walker());
        return factory.getSchema(schemaUri, svc);
    }

    @Test
    public void shouldWalkWithValidation() throws URISyntaxException, IOException {
        JsonSchema schema = getJsonSchemaFromStreamContentV7(new URI("http://json-schema" +
                ".org/draft-07/schema#"));
        JsonNode data = mapper.readTree(Issue461Test.class.getResource("/data/issue461-v7.json"));
        ValidationResult result = schema.walk(data, true);
        Assertions.assertTrue(result.getValidationMessages().isEmpty());
    }

    /**
     * Example NOP walker
     */
    private static class Walker implements JsonSchemaWalkListener {
        @Override
        public WalkFlow onWalkStart(final WalkEvent walkEvent) {
            return WalkFlow.CONTINUE;
        }

        @Override
        public void onWalkEnd(final WalkEvent walkEvent,
                              final Set<ValidationMessage> validationMessages) {
        }
    }
}


text:
/* $Id$ */

package org.apache.fop.fonts.type1;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.awt.Rectangle;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;

import org.junit.Test;

import org.apache.fop.fonts.NamedCharacter;
import org.apache.fop.fonts.type1.AFMParser.ValueHandler;

/**
 * Test case for {@link CharMetricsHandler}.
 */
public class CharMetricsHandlerTestCase {

    private static final String GOOD_LINE = "C 32 ; WX 32 ; N space ; B 1 1 1 1";

    private static final AFMCharMetrics EXPECTED_CHM;

    static {
        EXPECTED_CHM = new AFMCharMetrics();
        EXPECTED_CHM.setCharCode(32);
        EXPECTED_CHM.setWidthX(32.0);
        EXPECTED_CHM.setCharacter(new NamedCharacter("space"));
        EXPECTED_CHM.setBBox(new Rectangle(1, 1, 0, 0));
    }

    @Test
    public void testHandlers() throws IOException {
        testEncodingWithMetricsLine("", GOOD_LINE);
        testEncodingWithMetricsLine("WrongEncoding", GOOD_LINE);
        testEncodingWithMetricsLine("AdobeStandardEncoding", GOOD_LINE);
    }

    private void testEncodingWithMetricsLine(String encoding, String line) throws IOException {
        Map<String, ValueHandler> valueParsers = mock(HashMap.class);
        ValueHandler cHandler = mock(ValueHandler.class);
        ValueHandler wxHandler = mock(ValueHandler.class);
        ValueHandler nHandler = mock(ValueHandler.class);
        ValueHandler bHandler = mock(ValueHandler.class);
        when(valueParsers.get("C")).thenReturn(cHandler);
        when(valueParsers.get("WX")).thenReturn(wxHandler);
        when(valueParsers.get("N")).thenReturn(nHandler);
        when(valueParsers.get("B")).thenReturn(bHandler);

        CharMetricsHandler handler = CharMetricsHandler.getHandler(valueParsers, encoding);
        Stack<Object> stack = new Stack<Object>();
        handler.parse(line, stack, null);

        verify(valueParsers).get("C");
        verify(valueParsers).get("WX");
        verify(valueParsers).get("N");
        verify(valueParsers).get("B");
        verify(cHandler).parse("32", 0, new Stack<Object>());
        verify(wxHandler).parse("32", 0, new Stack<Object>());
        verify(nHandler).parse("space", 0, new Stack<Object>());
        verify(bHandler).parse("1 1 1 1", 0, new Stack<Object>());
    }
}


text:
package com.opengamma.analytics.financial.interestrate.bond.definition;

import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.Validate;

import com.opengamma.analytics.financial.interestrate.InstrumentDerivative;
import com.opengamma.analytics.financial.interestrate.InstrumentDerivativeVisitor;
import com.opengamma.financial.convention.yield.YieldConvention;
import com.opengamma.util.money.Currency;

/**
 * Describes a (Treasury) Bill with settlement date.
 */
public class BillSecurity implements InstrumentDerivative {

  /**
   * The bill currency.
   */
  private final Currency _currency;
  /**
   * The bill time to settlement.
   */
  private final double _settlementTime;
  /**
   * The bill end or maturity time.
   */
  private final double _endTime;
  /**
   * The bill nominal.
   */
  private final double _notional;
  /**
   * The yield (to maturity) computation convention.
   */
  private final YieldConvention _yieldConvention;
  /**
   * The accrual factor in the bill day count between settlement and maturity.
   */
  private final double _accrualFactor;
  /**
   * The bill issuer name.
   */
  private final String _issuer;
  /**
   * The name of the curve used for the bill cash flows (issuer credit).
   */
  private final String _creditCurveName;
  /**
   * The name of the curve used for settlement amount discounting.
   */
  private final String _discountingCurveName;

  /**
   * Constructor from all details.
   * @param currency The bill currency.
   * @param settlementTime The bill time to settlement.
   * @param endTime The bill end or maturity time.
   * @param notional The bill nominal.
   * @param yieldConvention The yield (to maturity) computation convention.
   * @param accrualFactor The accrual factor in the bill day count between settlement and maturity.
   * @param issuer The bill issuer name.
   * @param creditCurveName The name of the curve used for the bill cash flows (issuer credit).
   * @param discountingCurveName The name of the curve used for settlement amount discounting.
   */
  public BillSecurity(final Currency currency, final double settlementTime, final double endTime, double notional, final YieldConvention yieldConvention, final double accrualFactor,
      final String issuer, final String creditCurveName, final String discountingCurveName) {
    Validate.notNull(currency, "Currency");
    Validate.notNull(yieldConvention, "Yield convention");
    Validate.notNull(issuer, "Issuer");
    Validate.notNull(creditCurveName, "Credit curve");
    Validate.notNull(discountingCurveName, "Discounting curve");
    Validate.isTrue(notional > 0.0, "Notional should be positive");
    Validate.isTrue(endTime >= settlementTime, "End time should be after settlement time");
    Validate.isTrue(settlementTime >= 0, "Settlement time should be positive");
    _currency = currency;
    _endTime = endTime;
    _settlementTime = settlementTime;
    _notional = notional;
    _yieldConvention = yieldConvention;
    _accrualFactor = accrualFactor;
    _issuer = issuer;
    _creditCurveName = creditCurveName;
    _discountingCurveName = discountingCurveName;
  }

  /**
   * Get the bill currency.
   * @return The currency.
   */
  public Currency getCurrency() {
    return _currency;
  }

  /**
   * Gets the bill time to settlement.
   * @return The time.
   */
  public double getSettlementTime() {
    return _settlementTime;
  }

  /**
   * Gets the bill end or maturity time.
   * @return The time.
   */
  public double getEndTime() {
    return _endTime;
  }

  /**
   * Gets the bill notional.
   * @return The notional.
   */
  public double getNotional() {
    return _notional;
  }

  /**
   * Gets the yield (to maturity) computation convention.
   * @return The convention.
   */
  public YieldConvention getYieldConvention() {
    return _yieldConvention;
  }

  /**
   * Gets the accrual factor in the bill day count between settlement and maturity.
   * @return The accrual factor.
   */
  public double getAccralFactor() {
    return _accrualFactor;
  }

  /**
   * Gets the bill issuer name.
   * @return The name.
   */
  public String getIssuer() {
    return _issuer;
  }

  /**
   * Gets the name of the curve used for settlement amount discounting.
   * @return The name.
   */
  public String getDiscountingCurveName() {
    return _discountingCurveName;
  }

  /**
   * Gets the name of the curve used for the bill cash flows (issuer credit).
   * @return The name.
   */
  public String getCreditCurveName() {
    return _creditCurveName;
  }

  @Override
  public String toString() {
    return "Bill " + _issuer + " " + _currency + ": settle" + _settlementTime + " - maturity " + _endTime + " - notional " + _notional;
  }

  @Override
  public <S, T> T accept(InstrumentDerivativeVisitor<S, T> visitor, S data) {
    return visitor.visitBillSecurity(this, data);
  }

  @Override
  public <T> T accept(InstrumentDerivativeVisitor<?, T> visitor) {
    return visitor.visitBillSecurity(this);
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    long temp;
    temp = Double.doubleToLongBits(_accrualFactor);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _creditCurveName.hashCode();
    result = prime * result + _currency.hashCode();
    result = prime * result + _discountingCurveName.hashCode();
    temp = Double.doubleToLongBits(_endTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _issuer.hashCode();
    temp = Double.doubleToLongBits(_notional);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    temp = Double.doubleToLongBits(_settlementTime);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + _yieldConvention.hashCode();
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    BillSecurity other = (BillSecurity) obj;
    if (Double.doubleToLongBits(_accrualFactor) != Double.doubleToLongBits(other._accrualFactor)) {
      return false;
    }
    if (!ObjectUtils.equals(_creditCurveName, other._creditCurveName)) {
      return false;
    }
    if (!ObjectUtils.equals(_currency, other._currency)) {
      return false;
    }
    if (!ObjectUtils.equals(_discountingCurveName, other._discountingCurveName)) {
      return false;
    }
    if (Double.doubleToLongBits(_endTime) != Double.doubleToLongBits(other._endTime)) {
      return false;
    }
    if (_issuer == null) {
      if (other._issuer != null) {
        return false;
      }
    } else if (!_issuer.equals(other._issuer)) {
      return false;
    }
    if (Double.doubleToLongBits(_notional) != Double.doubleToLongBits(other._notional)) {
      return false;
    }
    if (Double.doubleToLongBits(_settlementTime) != Double.doubleToLongBits(other._settlementTime)) {
      return false;
    }
    if (!ObjectUtils.equals(_yieldConvention, other._yieldConvention)) {
      return false;
    }
    return true;
  }

}


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.Management.Compute.Models
{
    public partial class VirtualMachineScaleSetSku
    {
        internal static VirtualMachineScaleSetSku DeserializeVirtualMachineScaleSetSku(JsonElement element)
        {
            string resourceType = default;
            Sku sku = default;
            VirtualMachineScaleSetSkuCapacity capacity = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("resourceType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    resourceType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("capacity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    capacity = VirtualMachineScaleSetSkuCapacity.DeserializeVirtualMachineScaleSetSkuCapacity(property.Value);
                    continue;
                }
            }
            return new VirtualMachineScaleSetSku(resourceType, sku, capacity);
        }
    }
}


text:
package org.deri.vocidex.describers;

import com.hp.hpl.jena.datatypes.xsd.impl.XMLLiteralType;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.vocabulary.RDFS;
import com.hp.hpl.jena.vocabulary.XSD;

/**
 * TODO: This is really ugly. Should probably be a Describer and should look up the resource's definition.
 *
 * @author Richard Cyganiak
 */
public class DatatypeIdentifier {

	public boolean isDatatype(Resource uri) {
		// xsd:anything
		if (uri.getNameSpace().equals(XSD.getURI())) return true;
		// rdf:XMLLiteral
		if (uri.getURI().equals(XMLLiteralType.theXMLLiteralType.getURI())) return true;
		// rdf:Literal (not strictly speaking a datatype, but the class of all literals)
		if (uri.equals(RDFS.Literal)) return true;
		return false;
	}
}


text:
using namespace Gaffer;
using namespace GafferScene;
using namespace GafferArnold;

GAFFER_NODE_DEFINE_TYPE( ArnoldMeshLight );

ArnoldMeshLight::ArnoldMeshLight( const std::string &name )
	:	GafferScene::FilteredSceneProcessor( name, IECore::PathMatcher::NoMatch )
{

	// ArnoldAttributesNode. This hides the objects from the majority
	// of ray types, since we don't want to add the poor sampling of the
	// object on top of the nice sampling of the light. The only visibility
	// option we don't turn off is camera visibility - instead we promote
	// so the user can decide whether or not the mesh should be visible in
	// the render.

	ArnoldAttributesPtr attributes = new ArnoldAttributes( "__attributes" );
	attributes->inPlug()->setInput( inPlug() );
	attributes->filterPlug()->setInput( filterPlug() );
	for( NameValuePlug::Iterator it( attributes->attributesPlug() ); !it.done(); ++it )
	{
		if(
			boost::ends_with( (*it)->getName().string(), "Visibility" ) &&
			(*it)->getName().string().find( "AutoBump" ) == std::string::npos &&
			(*it)->getName() != "cameraVisibility"
		)
		{
			(*it)->enabledPlug()->setValue( true );
			(*it)->valuePlug<BoolPlug>()->setValue( false );
		}
	}

	addChild( attributes );

	Plug *internalCameraVisibilityPlug = attributes->attributesPlug()->getChild<Plug>( "cameraVisibility" );
	PlugPtr cameraVisibilityPlug = internalCameraVisibilityPlug->createCounterpart( "cameraVisibility", Plug::In );
	addChild( cameraVisibilityPlug );
	internalCameraVisibilityPlug->setInput( cameraVisibilityPlug );

	// Shader node. This loads the Arnold mesh_light shader.

	ArnoldShaderPtr shader = new ArnoldShader( "__shader" );
	shader->loadShader( "mesh_light" );
	addChild( shader );

	PlugPtr parametersPlug = shader->parametersPlug()->createCounterpart( "parameters", Plug::In );
	addChild( parametersPlug );
	for( Plug::Iterator srcIt( parametersPlug.get() ), dstIt( shader->parametersPlug() ); !srcIt.done(); ++srcIt, ++dstIt )
	{
		(*dstIt)->setInput( *srcIt );
		// We don't need the parameters to be dynamic, because we create the
		// plugs in our constructor when calling `loadShader()`.
		(*srcIt)->setFlags( Plug::Dynamic, false );
	}

	// ShaderAssignment node. This assigns the mesh_light shader
	// to the objects chosen by the filter.

	ShaderAssignmentPtr shaderAssignment = new ShaderAssignment( "__shaderAssignment" );
	shaderAssignment->inPlug()->setInput( attributes->outPlug() );
	shaderAssignment->filterPlug()->setInput( filterPlug() );
	shaderAssignment->shaderPlug()->setInput( shader->outPlug() );
	addChild( shaderAssignment );

	// Set node. This adds the objects into the __lights set,
	// so they will be output correctly to the renderer.

	SetPtr set = new Set( "__set" );
	set->inPlug()->setInput( shaderAssignment->outPlug() );
	set->filterPlug()->setInput( filterPlug() );
	set->namePlug()->setValue( "__lights" );
	set->modePlug()->setValue( Set::Add );
	addChild( set );

	// Default lights Set node.

	BoolPlugPtr defaultLightPlug = new BoolPlug( "defaultLight", Plug::In, true );
	addChild( defaultLightPlug );

	SetPtr defaultLightsSet = new Set( "__defaultLightsSet" );
	defaultLightsSet->inPlug()->setInput( set->outPlug() );
	defaultLightsSet->filterPlug()->setInput( filterPlug() );
	defaultLightsSet->enabledPlug()->setInput( defaultLightPlug.get() );
	defaultLightsSet->namePlug()->setValue( "defaultLights" );
	defaultLightsSet->modePlug()->setValue( Set::Add );
	addChild( defaultLightsSet );

	// Switch for enabling/disabling

	SwitchPtr enabledSwitch = new Switch( "__switch" );
	enabledSwitch->setup( inPlug() );
	enabledSwitch->inPlugs()->getChild<ScenePlug>( 0 )->setInput( inPlug() );
	enabledSwitch->inPlugs()->getChild<ScenePlug>( 1 )->setInput( defaultLightsSet->outPlug() );
	enabledSwitch->indexPlug()->setValue( 1 );
	enabledSwitch->enabledPlug()->setInput( enabledPlug() );
	addChild( enabledSwitch );

	outPlug()->setInput( enabledSwitch->outPlug() );
	// We don't need to serialise the connection because we make
	// it upon construction.
	/// \todo Can we just do this in the SceneProcessor base class?
	outPlug()->setFlags( Plug::Serialisable, false );
}

ArnoldMeshLight::~ArnoldMeshLight()
{
}


text:
layout: study--newsletter
title: 'Portable pasta party kit'
number: '34'
date: '2018-04-29 13:35:00 -0400'
published: true
---

{:h2: .f6 .ttu .tracked .mt5 .lh-title}
{:link: .dim .light-purple}
{:blockquote: .ml0 .pl4 .bl .bw3 .b--black-10 .f4}
{:blockquote__citation: .f5 .measure}
{:hr: .w-40 .mv5 .bw1 .ba .b--black-10}

Hi there!

I'm writing this after finishing a lunch of stuffed shells from my nonna (Italian grandmother); this morning's breakfast was some slices of cake, also from her.

This weekend, I've been visiting my family during my sister's volleyball tournament. Between games, the team gathers around a table full of food contributed by the different families, sharing some snacks during their downtime.

Last weekend, some friends visited Ottawa. We cooked together throughout their visit—the food wasn't inherently special (at one point we cooked perogies from a box), but the company made it so.

***
{:hr}

Whether it's eating together as a family, cooking with friends, having coffee with a mentor, enjoying big Sunday dinners with the Italian family, or maintaining yearly traditions at certain restaurants, food has a wonderful ability to bring us together. At times it's the main event, while at others it's the background thereto.

The food doesn't have to be homemade, nor does it have to be enjoyed at home. Something that strikes me about Tim Hortons is that it's often a regular social venue for groups of friends or families; go to any coffee place often enough and you'll likely notice a group that gathers regularly. My parents's walking group does just that, walking five or six kilometres every Saturday morning before sitting down at [Seven Shores](http://www.sevenshores.ca){:link}, a local cafe.

And it's not just eating food! I spent half an hour this morning idly flipping through an old cookbook, enjoying the descriptions of the dishes and dreaming of possible meals. My favourite cookbook is [*An Everlasting Meal*](http://www.tamareadler.com/book/about/){:link}, by Tamar Adler. Though she includes recipes, above all Adler teaches *principles*: by reading her book, I get excited to cook and to experiment while doing so. (I really appreciate her approach, because I often get overwhelmed by overly prescriptive recipes.)

***
{:hr}

People are sometimes shocked when I mention that I spend two to three hours a day cooking (including eating and clean-up). For me, it's a time of relaxation. When done with friends, it's also a chance to chat and catch up. If there's a lull in conversation it's no issue, because you have your food to focus on.

To support good time with friends in the kitchen, I've developed my "portable pasta party kit". I bring pasta, freshly made sauce, cheese, and even an apron and colander if necessary. All I need is a few hours notice and we have a party! I like having a go-to dish that brings people together; it lowers the social barrier and makes it easier to focus on having a good time.

What's your favourite dish? Do you have a recipe or approach to cooking that you particularly enjoy? Or perhaps you have some good food-related memories? Regardless, I'd love to hear from you.

All the best for the week ahead.

Lucas

P.S. I'm done exams now and will start work next week! My evenings and weekends are thus freeing up—if you're ever in Ottawa and want to get together, maybe over pasta, let's do so.

*Sent on April 29th, 2018.*


text:
require 'ostruct'
require File.expand_path(File.dirname(__FILE__) + '/lib/rdepend.rb')
require File.expand_path(File.dirname(__FILE__) + '/fixtures/een.rb')
require File.expand_path(File.dirname(__FILE__) + '/fixtures/twee.rb')
require File.expand_path(File.dirname(__FILE__) + '/fixtures/drie.rb')

=begin
Rdepend.with_trace do
  @een = Een.new
  @een.start
end
=end

Rdepend.trace
@een = Een.new
@een.start


text:
{% extends 'general/base.html' %}
{% load myfilters %}

{% block pagetitle %} Profile {% endblock %}

{% block container %}

Rewards:{{ user_profile.reward_dollars|default:" Nothing " }}

{% endblock %}


text:
(function (module) {
    function ProfileCtrl($scope, $auth, toastr, Account, $state, $window, $rootScope) {
        $scope.myImage='';
        $scope.myCroppedImage='';
         $scope.blockingObject = {block:true};
        var handleFileSelect=function(evt) {
          var file=evt.currentTarget.files[0];
          var reader = new FileReader();
          reader.onload = function (evt) {
            $scope.$apply(function($scope){
              $scope.myImage=evt.target.result;
            });
          };
          reader.readAsDataURL(file);
        };
        angular.element(document.querySelector('#fileInput')).on('change',handleFileSelect);

        $scope.getProfile = function () {
            Account.getProfile()
                .then(function (response) {
                    $scope.user = response.data;
                })
                .catch(function (response) {
                    toastr.error(response.data.message, response.status);
                });
        };

       // $scope.picture = '';
        $scope.updatePreview = function () {
            //$scope.user.picture = $scope.picture.src;
        };

        $scope.updateProfile = function () {

          $scope.user.picture=  $scope.myCroppedImage;
            Account.updateProfile($scope.user)
                .then(function (response) {
                    Account.getProfile()
                        .then(function (response) {
                            $window.localStorage.currentUser = JSON.stringify(response.data);
                            $rootScope.currentUser = JSON.parse($window.localStorage.currentUser);
                            $scope.user = response.data;
                            if ($scope.user.font.length < 2 || $scope.user.color.length < 2) {
                                //$location.path('/setting');
                                $state.go('setting.color');
                            }
                            else
                                $state.go('home');
                            //toastr.success('You have successfully signed in!');
                        })
                    //toastr.success('Profile has been updated');
                    //$state.go('home');
                })
                .catch(function (response) {
                    toastr.error(response.data.message, response.status);
                });
        };
        $scope.link = function (provider) {
            $auth.link(provider)
                .then(function () {
                    //toastr.success('You have successfully linked a ' + provider + ' account');
                    $scope.getProfile();
                })
                .catch(function (response) {
                    toastr.error(response.data.message, response.status);
                });
        };
        $scope.unlink = function (provider) {
            $auth.unlink(provider)
                .then(function () {
                    //toastr.info('You have unlinked a ' + provider + ' account');
                    $scope.getProfile();
                })
                .catch(function (response) {
                    toastr.error(response.data ? response.data.message : 'Could not unlink ' + provider + ' account', response.status);
                });
        };

        $scope.getProfile();
    }

    ProfileCtrl.$inject = ["$scope", "$auth", "toastr", "Account", "$state", "$window", "$rootScope"];
    module.controller('ProfileCtrl', ProfileCtrl);
})(angular.module('MyApp'));

//angular.module('MyApp')
//    .controller('ProfileCtrl', function ($scope, $auth, toastr, Account, $state, $window, $rootScope) {
//    $scope.getProfile = function () {
//      Account.getProfile()
//        .then(function (response) {
//          $scope.user = response.data;
//        })
//        .catch(function (response) {
//          toastr.error(response.data.message, response.status);
//        });
//    };

//    $scope.picture = '';
//    $scope.updatePreview = function () {
//      $scope.user.picture = $scope.picture.src;
//    };

//    $scope.updateProfile = function () {
//      Account.updateProfile($scope.user)
//          .then(function (response) {
//              Account.getProfile()
//                  .then(function (response) {
//                      $window.localStorage.currentUser = JSON.stringify(response.data);
//                      $rootScope.currentUser = JSON.parse($window.localStorage.currentUser);
//                      $scope.user = response.data;
//                      if ($scope.user.font.length < 2 || $scope.user.color.length < 2) {
//                          //$location.path('/setting');
//                          $state.go('setting.color');
//                      }
//                      else
//                          $state.go('home');
//                      //toastr.success('You have successfully signed in!');
//                  })
//            //toastr.success('Profile has been updated');
//            //$state.go('home');
//        })
//        .catch(function (response) {
//          toastr.error(response.data.message, response.status);
//        });
//    };
//    $scope.link = function (provider) {
//      $auth.link(provider)
//        .then(function () {
//          //toastr.success('You have successfully linked a ' + provider + ' account');
//          $scope.getProfile();
//        })
//        .catch(function (response) {
//          toastr.error(response.data.message, response.status);
//        });
//    };
//    $scope.unlink = function (provider) {
//      $auth.unlink(provider)
//        .then(function () {
//          //toastr.info('You have unlinked a ' + provider + ' account');
//          $scope.getProfile();
//        })
//        .catch(function (response) {
//          toastr.error(response.data ? response.data.message : 'Could not unlink ' + provider + ' account', response.status);
//        });
//    };

//    $scope.getProfile();
//  });


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../../../libc/constant.ABMON_7.html">

Redirecting to ../../../../libc/constant.ABMON_7.html...