<commit_before>package eu.ydp.empiria.player.client.controller.style;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gwt.core.client.JavaScriptObject;

import eu.ydp.gwtutil.client.collections.QueueSet;

public class StyleLinkManager {

	public StyleLinkManager(){
		solidStyles = new HashMap<String, JavaScriptObject>();
		removableStyles = new ArrayList<JavaScriptObject>();
	}

	private final Map<String, JavaScriptObject> solidStyles;
	private final List<JavaScriptObject> removableStyles;

	public void registerAssessmentStyles(QueueSet<String> styleLinks){
		doRegisterStyleLinks(styleLinks, false);
	}

	public void registerItemStyles(QueueSet<String> styleLinks){
		doRegisterStyleLinks(styleLinks, true);
	}

	private void doRegisterStyleLinks(QueueSet<String> styleLinks, boolean areRemovable){

		if (areRemovable){
			for (JavaScriptObject currLink : removableStyles){
				//removeStyleLink(currLink);
			}
			removableStyles.clear();
		}

		for (String link : styleLinks){
			if (solidStyles.containsKey(link)){
				removeStyleLink(solidStyles.get(link));
				solidStyles.remove(link);
				JavaScriptObject newLink = appendStyleLink(link);
				solidStyles.put(link, newLink);
			} else if (!areRemovable) {
				JavaScriptObject newLink = appendStyleLink(link);
				solidStyles.put(link, newLink);
			} else {
				JavaScriptObject newLink = appendStyleLink(link);
				removableStyles.add(newLink);
			}
		}

	}

	public native String getUserAgent() /*-{
		return navigator.userAgent;
	}-*/;<commit_msg>iOS 6 fix issue 73135<commit_after>package eu.ydp.empiria.player.client.controller.style;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gwt.core.client.JavaScriptObject;

import eu.ydp.gwtutil.client.collections.QueueSet;

public class StyleLinkManager {

	public StyleLinkManager(){
		solidStyles = new HashMap<String, JavaScriptObject>();
		removableStyles = new ArrayList<JavaScriptObject>();
	}

	private final Map<String, JavaScriptObject> solidStyles;
	private final List<JavaScriptObject> removableStyles;

	public void registerAssessmentStyles(QueueSet<String> styleLinks){
		doRegisterStyleLinks(styleLinks, false);
	}

	public void registerItemStyles(QueueSet<String> styleLinks){
		doRegisterStyleLinks(styleLinks, true);
	}

	private void doRegisterStyleLinks(QueueSet<String> styleLinks, boolean areRemovable){

		if (areRemovable){
			for (JavaScriptObject currLink : removableStyles){
				//removeStyleLink(currLink);
			}
			removableStyles.clear();
		}

		for (String link : styleLinks){
			if (solidStyles.containsKey(link)) {
				JavaScriptObject styleLink = solidStyles.get(link);
				if (styleLink !=  null) {
					removeStyleLink(styleLink);
				}
				solidStyles.remove(link);
				JavaScriptObject newLink = appendStyleLink(link);
				solidStyles.put(link, newLink);
			} else if (!areRemovable) {
				JavaScriptObject newLink = appendStyleLink(link);
				solidStyles.put(link, newLink);
			} else {
				JavaScriptObject newLink = appendStyleLink(link);
				removableStyles.add(newLink);
			}
		}

	}

	public native String getUserAgent() /*-{
		return navigator.userAgent;
	}-*/;
{'fraction_non_alphanumeric': 0.1079092581238504, 'fraction_numerical': 0.0018393623543838135, 'mean_word_length': 5.110486891385768, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1695695', 'n_tokens_mistral': 1126, 'n_tokens_neox': 997, 'n_words': 196}