Class UnicodeRange

java.lang.Object
io.github.sergeloie.languagecheck.model.UnicodeRange

public final class UnicodeRange extends Object
A Unicode code-point range [start, end] (inclusive).

Immutability is guaranteed by final fields; all constructors validate invariants and throw IllegalArgumentException on illegal arguments. This class is designed for Gson deserialization via UnicodeRangeDeserializer - Gson allocates the object through Unsafe and the deserializer calls the public constructor, so invariants are always enforced.

  • Constructor Summary

    Constructors
    Constructor
    Description
    UnicodeRange(int start, int end)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int codePoint)
    True if codePoint falls within this range (inclusive).
    int
    end()
    Upper bound (inclusive).
    boolean
     
    int
     
    of(int start, int end)
    Create a range from start to end (inclusive).
    single(int codePoint)
    Create a single-codepoint "range".
    int
    Number of code points in this range (end - start + 1).
    int
    Lower bound (inclusive).
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UnicodeRange

      public UnicodeRange(int start, int end)
  • Method Details

    • of

      public static UnicodeRange of(int start, int end)
      Create a range from start to end (inclusive).
    • single

      public static UnicodeRange single(int codePoint)
      Create a single-codepoint "range".
    • start

      public int start()
      Lower bound (inclusive).
    • end

      public int end()
      Upper bound (inclusive).
    • size

      public int size()
      Number of code points in this range (end - start + 1).
    • contains

      public boolean contains(int codePoint)
      True if codePoint falls within this range (inclusive).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object