<commit_before>import Ember from 'ember';

/**
 * A component for grouping and stacking `nf-area` components in an `nf-graph`.
 * 
 * This component looks at the order of the `nf-area` components underneath it 
 * and uses the ydata of the next sibling `nf-area` component to determine the bottom 
 * of each `nf-area` components path to be drawn.
 *
 * ### Example
 *
 *  		{{#nf-graph width=300 height=100}}
 *  			{{#nf-graph-content}}
 *  				{{#nf-area-stack}}
 *  					{{nf-area data=myData xprop="time" yprop="high"}}
 *  					{{nf-area data=myData xprop="time" yprop="med"}}
 *  					{{nf-area data=myData xprop="time" yprop="low"}}
 *  				{{/nf-area-stack}}
 *  			{{/nf-graph-content}}
 *  		{{/nf-graph}}
 *
 * @namespace components
 * @class nf-area-stack 
 */
export default Ember.Component.extend({
	tagName: 'g',

	/**
	 * Used by `nf-area` to identify an area stack parent
	 * @property isAreaStack
	 * @type Boolean
	 * @default true
	 * @readonly
	 */
	isAreaStack: true,

	/**
	 * The collection of `nf-area` components under this stack.
	 * @property areas
	 * @type Array
	 * @readonly
	 */
	areas: function(){
		return [];
	}.property(),

	/**
	 * Registers an area component with this stack. Also links areas to one
	 * another by setting `nextArea` on each area component.
	 * @function registerArea
	 * @param area {Ember.Component} The area component to register.
	 */
	registerArea: function(area) {
		var areas = this.get('areas');
		var last = areas[areas.length - 1];
		if(last) {
			last.set('nextArea', area);
			this.set('prevArea', last);
		}
		
		areas.pushObject(area);
	},

	/**
	 * Unregisters an area component from this stack. Also updates next
	 * and previous links.
	 * @function unregisterArea
	 * @param area {Ember.Component} the area to unregister
	 */
	unregisterArea: function(area) {
		var prev = area.get('prevArea');
		var next = area.get('nextArea');

		prev.set('nextArea', next);
		next.set('prevArea', prev);

		this.get('areas').removeObject(area);
	},
});<commit_msg>add reference check (Issue #9<commit_after>import Ember from 'ember';

/**
 * A component for grouping and stacking `nf-area` components in an `nf-graph`.
 * 
 * This component looks at the order of the `nf-area` components underneath it 
 * and uses the ydata of the next sibling `nf-area` component to determine the bottom 
 * of each `nf-area` components path to be drawn.
 *
 * ### Example
 *
 *  		{{#nf-graph width=300 height=100}}
 *  			{{#nf-graph-content}}
 *  				{{#nf-area-stack}}
 *  					{{nf-area data=myData xprop="time" yprop="high"}}
 *  					{{nf-area data=myData xprop="time" yprop="med"}}
 *  					{{nf-area data=myData xprop="time" yprop="low"}}
 *  				{{/nf-area-stack}}
 *  			{{/nf-graph-content}}
 *  		{{/nf-graph}}
 *
 * @namespace components
 * @class nf-area-stack 
 */
export default Ember.Component.extend({
	tagName: 'g',

	/**
	 * Used by `nf-area` to identify an area stack parent
	 * @property isAreaStack
	 * @type Boolean
	 * @default true
	 * @readonly
	 */
	isAreaStack: true,

	/**
	 * The collection of `nf-area` components under this stack.
	 * @property areas
	 * @type Array
	 * @readonly
	 */
	areas: function(){
		return [];
	}.property(),

	/**
	 * Registers an area component with this stack. Also links areas to one
	 * another by setting `nextArea` on each area component.
	 * @function registerArea
	 * @param area {Ember.Component} The area component to register.
	 */
	registerArea: function(area) {
		var areas = this.get('areas');
		var last = areas[areas.length - 1];
		
		if(last) {
			last.set('nextArea', area);
			this.set('prevArea', last);
		}
		
		areas.pushObject(area);
	},

	/**
	 * Unregisters an area component from this stack. Also updates next
	 * and previous links.
	 * @function unregisterArea
	 * @param area {Ember.Component} the area to unregister
	 */
	unregisterArea: function(area) {
		var prev = area.get('prevArea');
		var next = area.get('nextArea');

		if(next) {
			prev.set('nextArea', next);
			next.set('prevArea', prev);
		}

		this.get('areas').removeObject(area);
	},
});
{'fraction_non_alphanumeric': 0.1530562347188264, 'fraction_numerical': 0.003667481662591687, 'mean_word_length': 3.248182762201454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7042370', 'n_tokens_mistral': 1481, 'n_tokens_neox': 1328, 'n_words': 393}