dk.brics.string.charset
Class Interval

java.lang.Object
  extended by dk.brics.string.charset.Interval
All Implemented Interfaces:
Comparable<Interval>

public class Interval
extends Object
implements Comparable<Interval>

Character interval.


Constructor Summary
Interval(char c)
          Constructs a new singleton character interval.
Interval(char min, char max)
          Constructs a new character interval.
 
Method Summary
 int compareTo(Interval v)
          Compares two intervals with start character as primary key and end character as secondary key.
 boolean equals(Object obj)
           
 char getMax()
          Returns the end character of this interval.
 char getMin()
          Returns the start character of this interval.
 int hashCode()
           
 Interval intersection(Interval other)
          Returns the intersection of two intervals, or null if the two interval do not intersect.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Interval

public Interval(char c)
Constructs a new singleton character interval.


Interval

public Interval(char min,
                char max)
Constructs a new character interval.

Method Detail

compareTo

public int compareTo(Interval v)
Compares two intervals with start character as primary key and end character as secondary key.

Specified by:
compareTo in interface Comparable<Interval>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getMax

public char getMax()
Returns the end character of this interval.


getMin

public char getMin()
Returns the start character of this interval.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

intersection

public Interval intersection(Interval other)
Returns the intersection of two intervals, or null if the two interval do not intersect.

Parameters:
other - an interval. May be the same as this.
Returns:
a new interval or null


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.