xtc.parser
Class CharRange

java.lang.Object
  extended by xtc.tree.Node
      extended by xtc.parser.CharRange
All Implemented Interfaces:
java.lang.Comparable<CharRange>, java.lang.Iterable<java.lang.Object>, Locatable

public class CharRange
extends Node
implements java.lang.Comparable<CharRange>

A character range for a character classs.

Version:
$Revision: 1.10 $
Author:
Robert Grimm
See Also:
CharClass

Field Summary
 char first
          The first character.
 char last
          The last character.
 
Constructor Summary
CharRange(char c)
          Create a new single-character range with the specified character.
CharRange(char first, char last)
          Create a new character range with the specified characters.
 
Method Summary
 int compareTo(CharRange other)
           
 boolean contains(char c)
          Determine whether this character range contains the specified character.
 int count()
          Determine the number of characters covered by this character range.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 
Methods inherited from class xtc.tree.Node
add, add, addAll, addAll, addAll, addAll, addAllTo, addNode, contains, get, getBoolean, getBooleanProperty, getGeneric, getList, getLocation, getName, getNode, getProperty, getString, getStringProperty, getTokenText, hasLocation, hasName, hasProperty, hasTraversal, hasVariable, indexOf, isAnnotation, isEmpty, isGeneric, isList, isToken, iterator, lastIndexOf, properties, remove, removeProperty, set, setLocation, setLocation, setProperty, size, strip, toAnnotation, toList, toString, toToken, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public final char first
The first character.


last

public final char last
The last character.

Constructor Detail

CharRange

public CharRange(char c)
Create a new single-character range with the specified character.

Parameters:
c - The character.

CharRange

public CharRange(char first,
                 char last)
Create a new character range with the specified characters.

Parameters:
first - The first character.
last - The last character.
Method Detail

count

public int count()
Determine the number of characters covered by this character range.

Returns:
The number of characters for this character range.

contains

public boolean contains(char c)
Determine whether this character range contains the specified character.

Parameters:
c - The character.
Returns:
true if this character range contains the specified character.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(CharRange other)
Specified by:
compareTo in interface java.lang.Comparable<CharRange>


Copyright © 2012. All Rights Reserved.