<commit_before>/*
 * Copyright (C) 2010 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 * 
 * Created on 20. December 2010 by <NAME>
 */
package com.thoughtworks.acceptance;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public abstract class AbstractReplacedReferenceTest extends AbstractAcceptanceTest {

    private TreeData parent;

    protected void setUp() throws Exception {
        super.setUp();

        parent = new TreeData("parent");
        parent.add(new TreeData("child") {});

        xstream.alias("element", TreeData.class);
        xstream.alias("anonymous-element", parent.children.get(0).getClass());
    }
    
    public static class TreeData implements Serializable {
        String data;
        TreeData parent;
        List children;
        
        public TreeData(String data) {
            this.data = data;
            children = new ArrayList();
        }
        
        private TreeData(TreeData clone) {
            data = clone.data;
            parent = clone.parent;
            children = clone.children;
        }
        
        public void add(TreeData child) {
            child.parent = this;
            children.add(child);
        }
        
        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((this.children == null) ? 0 : this.children.hashCode());
            result = prime * result + ((this.data == null) ? 0 : this.data.hashCode());
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) return true;
            if (obj == null) return false;
            if (!(obj instanceof TreeData)) return false;
            TreeData other = (TreeData)obj;
            if (this.children == null) {
                if (other.children != null) return false;
            } else if (!this.children.equals(other.children)) return false;
            if (this.data == null) {
                if (other.data != null) return false;
            } else if (!this.data.equals(other.data)) return false;
            return true;
        }<commit_msg>Fix code compatibility.<commit_after>/*
 * Copyright (C) 2010 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 * 
 * Created on 20. December 2010 by <NAME>
 */
package com.thoughtworks.acceptance;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public abstract class AbstractReplacedReferenceTest extends AbstractAcceptanceTest {

    private TreeData parent;

    protected void setUp() throws Exception {
        super.setUp();

        parent = new TreeData("parent");
        parent.add(new TreeData("child") {});

        xstream.alias("element", TreeData.class);
        xstream.alias("anonymous-element", parent.children.get(0).getClass());
    }
    
    public static class TreeData implements Serializable {
        String data;
        TreeData parent;
        List children;
        
        public TreeData(String data) {
            this.data = data;
            children = new ArrayList();
        }
        
        private TreeData(TreeData clone) {
            data = clone.data;
            parent = clone.parent;
            children = clone.children;
        }
        
        public void add(TreeData child) {
            child.parent = this;
            children.add(child);
        }
        
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((this.children == null) ? 0 : this.children.hashCode());
            result = prime * result + ((this.data == null) ? 0 : this.data.hashCode());
            return result;
        }

        public boolean equals(Object obj) {
            if (this == obj) return true;
            if (obj == null) return false;
            if (!(obj instanceof TreeData)) return false;
            TreeData other = (TreeData)obj;
            if (this.children == null) {
                if (other.children != null) return false;
            } else if (!this.children.equals(other.children)) return false;
            if (this.data == null) {
                if (other.data != null) return false;
            } else if (!this.data.equals(other.data)) return false;
            return true;
        }
{'fraction_non_alphanumeric': 0.10089209855564996, 'fraction_numerical': 0.006796941376380629, 'mean_word_length': 1.9248447204968944, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3023891', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1183, 'n_words': 384}