<commit_before>/*
 * Copyright (c) 1998-2017 by <NAME>. All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, version 2.0. If a copy of the MPL was not distributed with
 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses", as
 * defined by the Mozilla Public License, version 2.0.
 */

package com.trollworks.gcs.character;

/** An entry in a hit location table. */
public class HitLocationTableEntry {
    private HitLocation mLocation;
    private String      mTitleOverride;
    private int         mHitPenaltyModifier;
    private int         mLowRoll;
    private int         mHighRoll;

    public HitLocationTableEntry(HitLocation location) {
        this(location, null, 0, 0, 0);
    }

    public HitLocationTableEntry(HitLocation location, int hitPenaltyModifier) {
        this(location, null, hitPenaltyModifier, 0, 0);
    }

    public HitLocationTableEntry(HitLocation location, int lowRoll, int highRoll) {
        this(location, null, 0, lowRoll, highRoll);
    }

    public HitLocationTableEntry(HitLocation location, String titleOverride, int lowRoll, int highRoll) {
        this(location, titleOverride, 0, lowRoll, highRoll);
    }

    public HitLocationTableEntry(HitLocation location, String titleOverride, int hitPenaltyModifier, int lowRoll, int highRoll) {
        mLocation = location;
        mTitleOverride = titleOverride;
        mHitPenaltyModifier = hitPenaltyModifier;
        mLowRoll = lowRoll;
        mHighRoll = highRoll;
    }

    public String getKey() {
        return mLocation.getKey();
    }

    public HitLocation getLocation() {
        return mLocation;
    }

    public String getName() {
        return mTitleOverride != null ? mTitleOverride : mLocation.getTitle();
    }

    public int getHitPenalty() {
        return mLocation.getHitPenalty() + mHitPenaltyModifier;
    }

    public boolean hasRoll() {
        return mLowRoll != 0;
    }

    public int getLowRoll() {
        return mLowRoll;
    }

    public int getHighRoll() {
        return mHighRoll;
    }

    public String getRoll() {
        if (hasRoll()) {
            return mLowRoll + "-" + mHighRoll; //$NON-NLS-1$
        }
        return "-"; //$NON-NLS-1$
    }
}<commit_msg>Collapse ranges in hit location chart<commit_after>/*
 * Copyright (c) 1998-2017 by <NAME>. All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, version 2.0. If a copy of the MPL was not distributed with
 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses", as
 * defined by the Mozilla Public License, version 2.0.
 */

package com.trollworks.gcs.character;

/** An entry in a hit location table. */
public class HitLocationTableEntry {
    private HitLocation mLocation;
    private String      mTitleOverride;
    private int         mHitPenaltyModifier;
    private int         mLowRoll;
    private int         mHighRoll;

    public HitLocationTableEntry(HitLocation location) {
        this(location, null, 0, 0, 0);
    }

    public HitLocationTableEntry(HitLocation location, int hitPenaltyModifier) {
        this(location, null, hitPenaltyModifier, 0, 0);
    }

    public HitLocationTableEntry(HitLocation location, int lowRoll, int highRoll) {
        this(location, null, 0, lowRoll, highRoll);
    }

    public HitLocationTableEntry(HitLocation location, String titleOverride, int lowRoll, int highRoll) {
        this(location, titleOverride, 0, lowRoll, highRoll);
    }

    public HitLocationTableEntry(HitLocation location, String titleOverride, int hitPenaltyModifier, int lowRoll, int highRoll) {
        mLocation = location;
        mTitleOverride = titleOverride;
        mHitPenaltyModifier = hitPenaltyModifier;
        mLowRoll = lowRoll;
        mHighRoll = highRoll;
    }

    public String getKey() {
        return mLocation.getKey();
    }

    public HitLocation getLocation() {
        return mLocation;
    }

    public String getName() {
        return mTitleOverride != null ? mTitleOverride : mLocation.getTitle();
    }

    public int getHitPenalty() {
        return mLocation.getHitPenalty() + mHitPenaltyModifier;
    }

    public boolean hasRoll() {
        return mLowRoll != 0;
    }

    public int getLowRoll() {
        return mLowRoll;
    }

    public int getHighRoll() {
        return mHighRoll;
    }

    public String getRoll() {
        if (hasRoll()) {
            if (mLowRoll == mHighRoll) {
                return Integer.toString(mLowRoll);
            }
            return mLowRoll + "-" + mHighRoll; //$NON-NLS-1$
        }
        return "-"; //$NON-NLS-1$
    }
}
{'fraction_non_alphanumeric': 0.0888704318936877, 'fraction_numerical': 0.009966777408637873, 'mean_word_length': 2.6354716981132076, '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': '5449473', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1350, 'n_words': 418}