<commit_before>package org.intermine.xml.full;

/*
 * Copyright (C) 2002-2009 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.intermine.metadata.ClassDescriptor;
import org.intermine.metadata.Model;
import org.intermine.util.StringUtil;
import org.intermine.util.XmlUtil;

/**
 * Representation of an object
 * @author <NAME>
 * @author <NAME>
 */
public class Item implements Comparable
{
    private String identifier = "";
    private String className = "";
    private String implementations = "";
    private Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    private Map<String, Reference> references = new HashMap();
    private Map<String, ReferenceList> collections = new HashMap();
    private Model model = null;
    private ClassDescriptor classDescriptor = null;
    private Set implementationClassDescriptors = null;

    /**
     * Construct an item.
     */
    public Item() { }

    /**
     * Construct an item.
     * @see ItemFactory
     * @param model the Model used to type-check set methods; if null no type checking is done
     * @param identifier item identifier
     * @param className name of described class
     * @param implementations names of implemented classes
     */
    public Item(Model model, String identifier, String className, String implementations) {
        this.identifier = identifier;
        this.className = className;
        this.implementations = implementations;
        setModel(model);
    }

    /**
     * Construct an item withno Model.  The calls to the set methods won't be type checked unless
     * setModel() is called.
     * @see ItemFactory
     * @param identifier item identifier
     * @param className name of described class
     * @param implementations names of implemented classes
     */
    public Item(String identifier, String className, String implementations) {
        this(null, identifier, className, implementations);
    }

    /**
     * Set the Model to use when checking calls to the other set methods
     * @param model the Model
     */
    public void setModel(Model model) {
        this.model = model;
        implementationClassDescriptors = null;
        setClassDescriptor(className);
    }

    /**
     * Return the model that was passed to the constructor or set with setModel().
     * @return the Model
     */
    public Model getModel() {
        return model;
    }


    /**
     * Set the identifier of this item
     * @param identifier the identifier
     */
    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }<commit_msg>Made Item constructors package-only, fixes #498.<commit_after>package org.intermine.xml.full;

/*
 * Copyright (C) 2002-2009 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.intermine.metadata.ClassDescriptor;
import org.intermine.metadata.Model;
import org.intermine.util.StringUtil;
import org.intermine.util.XmlUtil;

/**
 * Representation of an object
 * @author <NAME>
 * @author <NAME>
 */
public class Item implements Comparable
{
    private String identifier = "";
    private String className = "";
    private String implementations = "";
    private Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    private Map<String, Reference> references = new HashMap();
    private Map<String, ReferenceList> collections = new HashMap();
    private Model model = null;
    private ClassDescriptor classDescriptor = null;
    private Set implementationClassDescriptors = null;

    /**
     * Construct an item.
     */
    protected Item() { }

    /**
     * Construct an item.
     * @see ItemFactory
     * @param model the Model used to type-check set methods; if null no type checking is done
     * @param identifier item identifier
     * @param className name of described class
     * @param implementations names of implemented classes
     */
    protected Item(Model model, String identifier, String className, String implementations) {
        this.identifier = identifier;
        this.className = className;
        this.implementations = implementations;
        setModel(model);
    }

    /**
     * Construct an item withno Model.  The calls to the set methods won't be type checked unless
     * setModel() is called.
     * @see ItemFactory
     * @param identifier item identifier
     * @param className name of described class
     * @param implementations names of implemented classes
     */
    protected Item(String identifier, String className, String implementations) {
        this(null, identifier, className, implementations);
    }

    /**
     * Set the Model to use when checking calls to the other set methods
     * @param model the Model
     */
    public void setModel(Model model) {
        this.model = model;
        implementationClassDescriptors = null;
        setClassDescriptor(className);
    }

    /**
     * Return the model that was passed to the constructor or set with setModel().
     * @return the Model
     */
    public Model getModel() {
        return model;
    }


    /**
     * Set the identifier of this item
     * @param identifier the identifier
     */
    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }
{'fraction_non_alphanumeric': 0.0858085808580858, 'fraction_numerical': 0.0031353135313531354, 'mean_word_length': 2.961437908496732, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '1461462', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1511, 'n_words': 573}