<commit_before>package edu.sdsc.scigraph.annotation;

import javax.xml.bind.annotation.XmlRootElement;

/***
 * Represents an annotated section of text
 */
@XmlRootElement(name = "annotation")
public final class EntityAnnotation extends Token<Entity> implements Comparable<EntityAnnotation> {

  protected EntityAnnotation() {
    this(null, 0, 0);
  }

  public EntityAnnotation(Entity entity, int start, int end) {
    super(entity, start, end);
  }

  public int length() {
    return getEnd() - getStart();
  }

  /***
   * @param annotation
   * @return true if annotation contains or overlaps this
   */
  public boolean intersects(EntityAnnotation annotation) {
    return range.isConnected(annotation.range);
  }

  @Override
  public int compareTo(EntityAnnotation o) {
    if (equals(o))
      return 0;
    else if (getEnd() > o.getEnd())
      return 1;
    else if (getEnd() < o.getEnd())<commit_msg>Corrects comparison method<commit_after>package edu.sdsc.scigraph.annotation;

import javax.xml.bind.annotation.XmlRootElement;

/***
 * Represents an annotated section of text
 */
@XmlRootElement(name = "annotation")
public final class EntityAnnotation extends Token<Entity> implements Comparable<EntityAnnotation> {

  protected EntityAnnotation() {
    this(null, 0, 0);
  }

  public EntityAnnotation(Entity entity, int start, int end) {
    super(entity, start, end);
  }

  public int length() {
    return getEnd() - getStart();
  }

  /***
   * @param annotation
   * @return true if annotation contains or overlaps this
   */
  public boolean intersects(EntityAnnotation annotation) {
    return range.isConnected(annotation.range);
  }

  @Override
  public int compareTo(EntityAnnotation o) {
    if (range.equals(o.range))
      return 0;
    else if (getEnd() > o.getEnd())
      return 1;
    else if (getEnd() < o.getEnd())
{'fraction_non_alphanumeric': 0.11453268503511616, 'fraction_numerical': 0.004321988114532685, 'mean_word_length': 3.7609254498714653, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2496348', 'n_tokens_mistral': 571, 'n_tokens_neox': 535, 'n_words': 153}