ca.odell.glazedlists.jfreechart
Class DefaultValueSegment<T extends java.lang.Comparable,V extends java.lang.Comparable>

java.lang.Object
  extended by ca.odell.glazedlists.jfreechart.DefaultValueSegment<T,V>
All Implemented Interfaces:
ValueSegment<T,V>, java.lang.Comparable<ValueSegment<T,V>>

public class DefaultValueSegment<T extends java.lang.Comparable,V extends java.lang.Comparable>
extends java.lang.Object
implements ValueSegment<T,V>

The default implementation of the ValueSegment interface.

Note: DefaultValueSegments must be immutable objects. Callers are strongly encouraged to construct DefaultValueSegments with defensive copies of the start, end, and value arguments if they are not themselves immutable.

Author:
James Lemieux

Constructor Summary
DefaultValueSegment(T start, T end, V value)
          Create a DefaultValueSegment indicating the value exists between the start and end on some continuum of Comparable objects.
 
Method Summary
 int compareTo(ValueSegment<T,V> o)
          DefaultValueSegments are compared by value, then by segment start, then by segment end.
 T getEnd()
          Returns the value marking the end of this segment.
 T getStart()
          Returns the value marking the start of this segment.
 V getValue()
          Returns the value observed within this segment.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultValueSegment

public DefaultValueSegment(T start,
                           T end,
                           V value)
Create a DefaultValueSegment indicating the value exists between the start and end on some continuum of Comparable objects.

Parameters:
start - the beginning of the segment
end - the end of the segment
value - the value observed between start and end
Throws:
java.lang.IllegalArgumentException - if start or end is null
Method Detail

getStart

public T getStart()
Returns the value marking the start of this segment.

Specified by:
getStart in interface ValueSegment<T extends java.lang.Comparable,V extends java.lang.Comparable>

getEnd

public T getEnd()
Returns the value marking the end of this segment.

Specified by:
getEnd in interface ValueSegment<T extends java.lang.Comparable,V extends java.lang.Comparable>

getValue

public V getValue()
Returns the value observed within this segment.

Specified by:
getValue in interface ValueSegment<T extends java.lang.Comparable,V extends java.lang.Comparable>

compareTo

public int compareTo(ValueSegment<T,V> o)
DefaultValueSegments are compared by value, then by segment start, then by segment end.

Specified by:
compareTo in interface java.lang.Comparable<ValueSegment<T extends java.lang.Comparable,V extends java.lang.Comparable>>

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by abuild at 2011-01-06 6:55