Range.java 1.09 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.day.util.diff;

import com.day.util.diff.Document;

public class Range {
    static final String CVS_ID = "$URL$ $Rev$ $Date$";
    public final Document doc;
    public final int low;
    public final int high;
    static final /* synthetic */ boolean $assertionsDisabled;

    public Range(Document doc, int low, int high) {
        if (!$assertionsDisabled && low < 0) {
            throw new AssertionError();
        }
        if (!$assertionsDisabled && high < low) {
            throw new AssertionError();
        }
        this.doc = doc;
        this.low = low;
        this.high = high;
    }

    public int len() {
        return this.high - this.low;
    }

    public String toString() {
        return "" + this.low + "-" + this.high;
    }

    public String toRangeString() {
        if (this.len() == 1) {
            return String.valueOf(this.low + 1);
        }
        return "" + (this.low + 1) + "," + this.len();
    }

    static {
        Class class_ = Range.class;
        $assertionsDisabled = !class_.desiredAssertionStatus();
    }
}