All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.isi.nlp.strings.offsets.CharOffset Maven / Gradle / Ivy

The newest version!
package edu.isi.nlp.strings.offsets;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

/** A character offset. Canonically this is counted by Unicode codepoints. */
public final class CharOffset extends AbstractOffset {

  private CharOffset(final int val) {
    super(val);
  }

  @JsonCreator
  public static CharOffset asCharOffset(@JsonProperty("value") final int val) {
    return new CharOffset(val);
  }

  @Override
  public String toString() {
    return "c" + Integer.toString(asInt());
  }

  @Override
  public CharOffset shiftedCopy(final int shiftAmount) {
    return CharOffset.asCharOffset(asInt() + shiftAmount);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy