Class CharRange

java.lang.Object
fc.util.Range
fc.util.CharRange

public class CharRange extends Range
A range of characters.

Note, many methods in this particular class have the same signatures as in the apache commons.lang package but the implementation was strictly clean-room.

Thread Safety: This class is not thread safe in the face of any concurrent modification (via changing the start/end chars or union/intersection operations).

  • Constructor Summary

    Constructors
    Constructor
    Description
    CharRange(char start, char end)
    Constructs a character range between the specified start and end chars (both inclusive).
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    Get the end character for this character range.
    char
    Get the start character for this character range
    boolean
    inRange(char c)
    Is the passed in character inside this range
    static void
    main(String[] args)
     
    void
    setEnd(char c)
    Sets the end character for this character range
    void
    setStart(char c)
    Set the start character for this character range
    Output a string representation of the character range

    Methods inherited from class Range

    isNegated, setNegated

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CharRange

      public CharRange(char start, char end)
      Constructs a character range between the specified start and end chars (both inclusive).
      Throws:
      IllegalArgumentException - if the end char is lesser (via a < comparison) than the start char (equal to the start char is ok)
  • Method Details

    • getStart

      public char getStart()
      Get the start character for this character range
    • getEnd

      public char getEnd()
      Get the end character for this character range.
    • inRange

      public boolean inRange(char c)
      Is the passed in character inside this range
    • setEnd

      public void setEnd(char c)
      Sets the end character for this character range
      Parameters:
      c - the end char
      Throws:
      IllegalArgumentException - if the end char is lesser (via a < comparison) than the current start char (equal to the start char is ok)
    • setStart

      public void setStart(char c)
      Set the start character for this character range
      Throws:
      IllegalArgumentException - if the start char is greater (via a > comparison) than the current end char (equal to the end char is ok)
    • toString

      public String toString()
      Output a string representation of the character range
      Overrides:
      toString in class Object
    • main

      public static void main(String[] args)