<commit_before>/******************************************************
 * Navigation timing
 * 
 *
 * Copyright (C) 2013 by <NAME> (http://peterhedenskog.com)
 *
 ******************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in 
 * compliance with the License. You may obtain a copy of the License at
 * 
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is 
 * distributed  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   
 * See the License for the specific language governing permissions and limitations under the License.
 *
 *******************************************************
 */
package com.soulgalore.web.performance.navigation.result;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlElement;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.soulgalore.web.performance.navigation.NavigationTiming;
import com.soulgalore.web.performance.navigation.run.NavigationTimingConfiguration;

/**
 * Info class used for output. The 
 *
 */
@XmlRootElement(name = "navigation-timing")
class NavigationTimingInfo {
	private String url;
	private String browser;
	private String browserVersion;
	private Date when;
	private int runs;
	private Set<Metric> metrics = new HashSet<Metric>();
	private List<NavigationTiming> individualTimings = null;

	/**
	 * Only to satisfy the Marshaller.
	 */
	public NavigationTimingInfo() {

	}

	NavigationTimingInfo(String url, String browser, String browserVersion, Date when,
			int runs, List<NavigationTiming> allTimings, NavigationTimingConfiguration conf) {
		super();
		this.url = url;
		this.browser = browser;
		this.browserVersion = browserVersion;
		this.when = when;
		this.runs = runs;

		if (conf.includeIndividualRuns()) {
			individualTimings = allTimings;
		}
	}

	@XmlElement
	public String getUrl() {
		return url;
	}

	@XmlElement
	public String getBrowser() {
		return browser;
	}

	@XmlElement
	public String getBrowserVersion() {
		return browserVersion;
	}

	@XmlElement
	public Date getWhen() {
		return when;
	}

	@XmlElement
	public int getRuns() {
		return runs;
	}

	@XmlElement
	public Set<Metric> getMetrics() {
		return metrics;
	}

	@XmlElement
	public List<NavigationTiming> getIndividualTimings() {
		return individualTimings;
	}

	void addMetric(Metric metric) {
		metrics.add(metric);
	}

	static class Metric {

		private String name;
		private Double median;
		private Double avg;
		private Double max;
		private Double min;
		private Double p60;
		private Double p70;
		private Double p80;
		private Double p90;<commit_msg>fixed the order of the xml elemnts part 1 #3<commit_after>/******************************************************
 * Navigation timing
 * 
 *
 * Copyright (C) 2013 by <NAME> (http://peterhedenskog.com)
 *
 ******************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in 
 * compliance with the License. You may obtain a copy of the License at
 * 
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is 
 * distributed  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   
 * See the License for the specific language governing permissions and limitations under the License.
 *
 *******************************************************
 */
package com.soulgalore.web.performance.navigation.result;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.soulgalore.web.performance.navigation.NavigationTiming;
import com.soulgalore.web.performance.navigation.run.NavigationTimingConfiguration;

/**
 * Info class used for output. The 
 *
 */
@XmlRootElement(name = "navigation-timing")
@XmlType(propOrder = {"url", "when","runs","browser","browserVersion","metrics","individualTimings"})
class NavigationTimingInfo {
	private String url;
	private String browser;
	private String browserVersion;
	private Date when;
	private int runs;
	private Set<Metric> metrics = new HashSet<Metric>();
	private List<NavigationTiming> individualTimings = null;

	/**
	 * Only to satisfy the Marshaller.
	 */
	public NavigationTimingInfo() {

	}

	NavigationTimingInfo(String url, String browser, String browserVersion, Date when,
			int runs, List<NavigationTiming> allTimings, NavigationTimingConfiguration conf) {
		super();
		this.url = url;
		this.browser = browser;
		this.browserVersion = browserVersion;
		this.when = when;
		this.runs = runs;

		if (conf.includeIndividualRuns()) {
			individualTimings = allTimings;
		}
	}

	@XmlElement
	public String getUrl() {
		return url;
	}

	@XmlElement
	public String getBrowser() {
		return browser;
	}

	@XmlElement
	public String getBrowserVersion() {
		return browserVersion;
	}

	@XmlElement
	public Date getWhen() {
		return when;
	}

	@XmlElement
	public int getRuns() {
		return runs;
	}

	@XmlElement
	public Set<Metric> getMetrics() {
		return metrics;
	}

	@XmlElement
	public List<NavigationTiming> getIndividualTimings() {
		return individualTimings;
	}

	void addMetric(Metric metric) {
		metrics.add(metric);
	}

	@XmlType(propOrder = {"name", "min", "max", "avg", "median","p60","p70","p80","p90"})
	static class Metric {

		private String name;
		private Double median;
		private Double avg;
		private Double max;
		private Double min;
		private Double p60;
		private Double p70;
		private Double p80;
		private Double p90;
{'fraction_non_alphanumeric': 0.14753822886909762, 'fraction_numerical': 0.007057637371870274, 'mean_word_length': 4.567820392890552, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, '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': '684129', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1685, 'n_words': 521}