<commit_before>/* Copyright 2001 The JA-SIG Collaborative.  All rights reserved.
*  See license distributed with this file and
*  available online at http://www.uportal.org/license.html
*/

package org.jasig.portal;

import java.util.Enumeration;
import java.util.HashSet;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * Object managing user preferences.
 * @author <NAME>
 * @version $Revision$
 */

public class UserPreferences {

    protected UserProfile profile;

    protected StructureStylesheetUserPreferences fsup;
    protected ThemeStylesheetUserPreferences ssup;

    /*
     * Copy-constructor
     */
    public UserPreferences(UserPreferences up) {
        fsup=new StructureStylesheetUserPreferences(up.getStructureStylesheetUserPreferences());
        ssup=new ThemeStylesheetUserPreferences(up.getThemeStylesheetUserPreferences());
        profile=up.getProfile();
    }

    public void setProfile(UserProfile p) { profile=p; }
    public UserProfile getProfile() { return profile; }

    public UserPreferences(UserProfile p) { this.profile=p; }

    public void setStructureStylesheetUserPreferences(StructureStylesheetUserPreferences up) {
        this.fsup=up;
    }

    public void setThemeStylesheetUserPreferences(ThemeStylesheetUserPreferences up) {
        this.ssup=up;
    }

    public StructureStylesheetUserPreferences getStructureStylesheetUserPreferences() {
        return this.fsup;
    }

    public ThemeStylesheetUserPreferences getThemeStylesheetUserPreferences() {
        return this.ssup;
    }

    public void synchronizeWithUserLayoutXML(Document uLayoutXML) throws PortalException {
        // make a list of channels in the XML Layout
        NodeList channelNodes=uLayoutXML.getElementsByTagName("channel");
        HashSet channelSet=new HashSet();
        for(int i=0;i<channelNodes.getLength();i++) {<commit_msg>UP-1127, replaced hardcoded constructor copies with instance based dynamic-method-lookup copies distributed user preference values don't get discarded.<commit_after>/* Copyright 2001 The JA-SIG Collaborative.  All rights reserved.
*  See license distributed with this file and
*  available online at http://www.uportal.org/license.html
*/

package org.jasig.portal;

import java.util.Enumeration;
import java.util.HashSet;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * Object managing user preferences.
 * @author <NAME>
 * @version $Revision$
 */

public class UserPreferences {

    protected UserProfile profile;

    protected StructureStylesheetUserPreferences fsup;
    protected ThemeStylesheetUserPreferences ssup;

    /*
     * Copy-constructor
     */
    public UserPreferences(UserPreferences up) {
        fsup = (StructureStylesheetUserPreferences) up
                .getStructureStylesheetUserPreferences().newInstance();
        ssup = (ThemeStylesheetUserPreferences) up
                .getThemeStylesheetUserPreferences().newInstance();
        profile = up.getProfile();
    }

    public void setProfile(UserProfile p) { profile=p; }
    public UserProfile getProfile() { return profile; }

    public UserPreferences(UserProfile p) { this.profile=p; }

    public void setStructureStylesheetUserPreferences(StructureStylesheetUserPreferences up) {
        this.fsup=up;
    }

    public void setThemeStylesheetUserPreferences(ThemeStylesheetUserPreferences up) {
        this.ssup=up;
    }

    public StructureStylesheetUserPreferences getStructureStylesheetUserPreferences() {
        return this.fsup;
    }

    public ThemeStylesheetUserPreferences getThemeStylesheetUserPreferences() {
        return this.ssup;
    }

    public void synchronizeWithUserLayoutXML(Document uLayoutXML) throws PortalException {
        // make a list of channels in the XML Layout
        NodeList channelNodes=uLayoutXML.getElementsByTagName("channel");
        HashSet channelSet=new HashSet();
        for(int i=0;i<channelNodes.getLength();i++) {
{'fraction_non_alphanumeric': 0.08246398410332836, 'fraction_numerical': 0.004967709885742673, 'mean_word_length': 3.8576598311218335, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6021061', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1076, 'n_words': 255}