org.rr0.im.business.event
Class TimeLineImpl

org.rr0.im.business.event.TimeableImpl
  |
  +--org.rr0.im.business.event.TimeLineImpl

public class TimeLineImpl
extends TimeableImpl
implements TimeLine

TimeLine Reference Implementation.

Author:
Jérôme Beau
Version: 14 juil. 2003 17:44:30

Field Summary
 private SortedSetevents
          The sorted set of events.

Fields inherited from class org.rr0.im.business.event.TimeableImpl
history

Constructor Summary
TimeLineImpl(String name)
           

Method Summary
 voidaddEvent(Event event)
          Adds a event to the TimeLine.
 intcompareTo(Object o)
          Compares this object with the specified object for order.
 IteratoreventsIterator()
          Returns the collection of Events, in their chronological order.
 CategorygetForcedCategory(Classification classification)
          Returns if this classifiable has been manually forced to classify in some specific Category.
 intsize()
           

Methods inherited from class org.rr0.im.business.event.TimeableImpl
equals, getBegining, getDuration, getEnd, getHistory, getTitle, hashCode, setEndMoment, setTitle

Field Detail

events

private SortedSet events
The sorted set of events.
By default, events are compared using their respective begining moments.
See Also:
Comparable, EventImpl
Constructor Detail

TimeLineImpl

public TimeLineImpl(String name)
Method Detail

addEvent

public void addEvent(Event event)
Adds a event to the TimeLine.
Parameters:
event The event to add.

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object.



In the foregoing description, the notation
sgn(expression) designates the mathematical
signum function, which is defined to return one of -1,
0, or 1 according to whether the value of expression
is negative, zero or positive.

The implementor must ensure sgn(x.compareTo(y)) ==
-sgn(y.compareTo(x))
for all x and y. (This
implies that x.compareTo(y) must throw an exception iff
y.compareTo(x) throws an exception.)



The implementor must also ensure that the relation is transitive:
(x.compareTo(y)>0 && y.compareTo(z)>0) implies
x.compareTo(z)>0.



Finally, the implementer must ensure that x.compareTo(y)==0
implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for
all z.



It is strongly recommended, but not strictly required that
(x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any
class that implements the Comparable interface and violates
this condition should clearly indicate this fact. The recommended
language is "Note: this class has a natural ordering that is
inconsistent with equals."

Parameters:
o the Object to be compared.
Returns: a negative integer, zero, or a positive integer as this object
is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException if the specified object's type prevents it
from being compared to this Object.

eventsIterator

public Iterator eventsIterator()
Returns the collection of Events, in their chronological order.
Returns:

getForcedCategory

public Category getForcedCategory(Classification classification)
Returns if this classifiable has been manually forced to classify in some specific Category.
This allows to handle "exceptions" in Classification's systems ("everything like f(x) and also Y and Z)").
Parameters:
classification Some Classification function.
Returns: The Category in which that Classifiable has been forced to be classified in for that Classification.
null if no Category has been forced for that Classifiable.
associates <{org.rr0.im.service.function.classification.Category}>
supplierRole forced category
supplierCardinality 0..1

size

public int size()

Association Links

to Class java.util.SortedSet

The sorted set of events.
By default, events are compared using their respective begining moments.

see java.lang.Comparable, org.rr0.im.business.event.EventImpl

to Class org.rr0.im.service.function.classification.Category

Returns if this classifiable has been manually forced to classify in some specific Category.
This allows to handle "exceptions" in Classification's systems ("everything like f(x) and also Y and Z)").

Supplier Role forced category
Supplier Cardinality 0..1
associates <{org.rr0.im.service.function.classification.Category}>
return The Category in which that Classifiable has been forced to be classified in for that Classification.
null if no Category has been forced for that Classifiable.
param classification Some Classification function.