fc.util
Class CharRange

java.lang.Object
  extended by fc.util.Range
      extended by 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
CharRange(char start, char end)
          Constructs a character range between the specified start and end chars (both inclusive).
 
Method Summary
 char getEnd()
          Get the end character for this character range.
 char getStart()
          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
 String toString()
          Output a string representation of the character range
 
Methods inherited from class fc.util.Range
isNegated, setNegated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

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)