<commit_before>package etomica.atom;

import etomica.units.Dimension;
import etomica.units.Mass;

/**
 * Type for an atom that is a leaf in the species hierarchy. An atom of this
 * type is typically representing a physical atom, rather than a group of other
 * atoms.
 * 
 * @author andrew
 */

/*
 * Created on May 20, 2005
 */

public class AtomTypeLeaf extends AtomType {

    /**
     * Constructs type with position defined by AtomPositionDefinitionSimple.
     */
    public AtomTypeLeaf(AtomTypeGroup parentType, double mass) {
        this(parentType, new AtomPositionDefinitionSimple(), mass);
    }

    /**
     * Invokes parent constructor with and sets the mass to the given value.
     */
    public AtomTypeLeaf(AtomTypeGroup parentType,
            AtomPositionDefinition positionDefinition, double mass) {
        super(parentType, positionDefinition);
        setMass(mass);
    }

    /**
     * Returns true, indicating that this is a leaf type.
     */
    public boolean isLeaf() {
        return true;
    }

    /**
     * Sets mass of this atom and updates reciprocal mass accordingly. Setting
     * mass to largest machine double (Double.MAX_VALUE) causes reciprocal mass
     * to be set to zero.
     * 
     * @param mass
     *            new value for mass
     */
    public void setMass(double m) {
        mass = m;
        rm = (m == Double.MAX_VALUE) ? 0.0 : 1.0 / mass;
    }<commit_msg>throw exceptions when people do stupid things.  they deserve it<commit_after>package etomica.atom;

import etomica.units.Dimension;
import etomica.units.Mass;

/**
 * Type for an atom that is a leaf in the species hierarchy. An atom of this
 * type is typically representing a physical atom, rather than a group of other
 * atoms.
 * 
 * @author andrew
 */

/*
 * Created on May 20, 2005
 */

public class AtomTypeLeaf extends AtomType {

    /**
     * Constructs type with position defined by AtomPositionDefinitionSimple.
     */
    public AtomTypeLeaf(AtomTypeGroup parentType, double mass) {
        this(parentType, new AtomPositionDefinitionSimple(), mass);
    }

    /**
     * Invokes parent constructor with and sets the mass to the given value.
     */
    public AtomTypeLeaf(AtomTypeGroup parentType,
            AtomPositionDefinition positionDefinition, double mass) {
        super(parentType, positionDefinition);
        setMass(mass);
    }

    /**
     * Returns true, indicating that this is a leaf type.
     */
    public boolean isLeaf() {
        return true;
    }

    /**
     * Sets mass of this atom and updates reciprocal mass accordingly. Setting
     * mass to largest machine double (Double.MAX_VALUE) causes reciprocal mass
     * to be set to zero.
     * 
     * @param mass
     *            new value for mass
     */
    public void setMass(double m) {
        if (m < 0) {
            throw new IllegalArgumentException("mass must not be negative");
        }
        mass = m;
        rm = (m == Double.MAX_VALUE) ? 0.0 : 1.0 / mass;
    }
{'fraction_non_alphanumeric': 0.08272425249169435, 'fraction_numerical': 0.0069767441860465115, 'mean_word_length': 2.4099660249150623, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '2950504', 'n_tokens_mistral': 862, 'n_tokens_neox': 825, 'n_words': 305}