package cnp.ew.richtext;

public class CpTextLocation
{
    int loc, offset;

    public CpTextLocation(int l1, int l2)
    {
        loc = l1;
        offset = l2;
    }

    public String toString()
    {
        return loc + ", " + offset;
    }

    public int index()
    {
        return loc;
    }

    public int paraNum()
    {
        return loc;
    }

    public int offset()
    {
        return offset;
    }

    public int lineNum()
    {
        return offset;
    }

    public boolean equals(CpTextLocation tl)
    {
        return (loc == tl.index() && offset == tl.offset());
    }

    public boolean isBefore(CpTextLocation tl)
    {
        return loc < tl.index() || (loc == tl.index() && offset < tl.offset());
    }
}
