1package jdiff;
2
3import java.io.*;
4import java.util.*;
5
6/**
7 * Represents a single comment element. Has an identifier and some text.
8 *
9 * See the file LICENSE.txt for copyright details.
10 * @author Matthew Doar, mdoar@pobox.com
11 */
12class SingleComment implements Comparable {
13
14    /** The identifier for this comment. */
15    public String id_ = null;
16
17    /** The text of this comment. */
18    public String text_ = null;
19
20    /** If false, then this comment is inactive. */
21    public boolean isUsed_ = true;
22
23    public SingleComment(String id, String text) {
24        // Escape the commentID in case it contains "<" or ">"
25        // characters (generics)
26        id_ = id.replaceAll("<", "&lt;").replaceAll(">", "&gt;");;
27        text_ = text;
28    }
29
30    /** Compare two SingleComment objects using just the id. */
31    public int compareTo(Object o) {
32        return id_.compareTo(((SingleComment)o).id_);
33    }
34}
35