fr.cnes.sirius.patrius.events
Class Phenomenon

java.lang.Object
  extended by fr.cnes.sirius.patrius.events.Phenomenon
All Implemented Interfaces:
Comparable<Phenomenon>

public final class Phenomenon
extends Object
implements Comparable<Phenomenon>

This class represents an observable phenomenon.

A phenomenon is represented by a time interval and two boundaries; the boundaries can coincide with two CodedEvent, or just be computational boundaries.

Since:
1.1
Version:
$Id: Phenomenon.java 6322 2012-09-20 15:51:39Z CardosoP $
Author:
Pierre Cardoso, Tiziana Sabatini
Concurrency :
immutable

Constructor Summary
Phenomenon(CodedEvent boundaryOne, boolean boundaryOneDefined, CodedEvent boundaryTwo, boolean boundaryTwoDefined, String codeIn, String commentIn)
          Constructor for the Phenomenon instance.
The first and second CodedEvent boundaries can be in any time order.
 
Method Summary
 int compareTo(Phenomenon o)
          Compares the Phenomenon instances.
If the beginning events differ, their comparison is the result.
 boolean equals(Object phenomenon)
          Checks if the instance represents the same Phenomenon as another instance.
 String getCode()
           
 String getComment()
           
 CodedEvent getEndingEvent()
          Get the ending event.
 boolean getEndingIsDefined()
          True if the second boundary value is defined.
 CodedEvent getStartingEvent()
          Get the starting event.
 boolean getStartingIsDefined()
          True if the first boundary value is defined.
 AbsoluteDateInterval getTimespan()
          Get the timespan as an AbsoluteDateInterval.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Phenomenon

public Phenomenon(CodedEvent boundaryOne,
                  boolean boundaryOneDefined,
                  CodedEvent boundaryTwo,
                  boolean boundaryTwoDefined,
                  String codeIn,
                  String commentIn)
Constructor for the Phenomenon instance.
The first and second CodedEvent boundaries can be in any time order.

Parameters:
boundaryOne - CodedEvent representing the first boundary.
boundaryOneDefined - true if the first boundary value is defined, false if is just a meaningless placeholder.
boundaryTwo - CodedEvent representing the second boundary.
boundaryTwoDefined - true if the second boundary value is defined, false if is just a meaningless placeholder.
codeIn - the phenomenon code
commentIn - a comment for the phenomenon
Method Detail

getStartingEvent

public CodedEvent getStartingEvent()
Get the starting event.

Returns:
the CodedEvent instance.

getEndingEvent

public CodedEvent getEndingEvent()
Get the ending event.

Returns:
the CodedEvent instance.

getStartingIsDefined

public boolean getStartingIsDefined()
True if the first boundary value is defined.

Returns:
true or false

getEndingIsDefined

public boolean getEndingIsDefined()
True if the second boundary value is defined.

Returns:
true or false

getTimespan

public AbsoluteDateInterval getTimespan()
Get the timespan as an AbsoluteDateInterval.

Returns:
the AbsoluteDateInterval instance.

getCode

public String getCode()
Returns:
the phenomenon code

getComment

public String getComment()
Returns:
the phenomenon comment

compareTo

public int compareTo(Phenomenon o)
Compares the Phenomenon instances.
If the beginning events differ, their comparison is the result. If not, if the ending events differ, they are compared. If not, the status of the boundaries is used to order
Please note that the CodedEvent comparison uses more than the dates to order the CodedEvents.

Specified by:
compareTo in interface Comparable<Phenomenon>
Parameters:
o - the Phenomenon to compare to
Returns:
a negative integer, zero, or a positive integer as the Phenomenon is before, simultaneous, or after the specified one.
See Also:
Comparable.compareTo(java.lang.Object)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object phenomenon)
Checks if the instance represents the same Phenomenon as another instance.

Overrides:
equals in class Object
Parameters:
phenomenon - other phenomenon
Returns:
true if the instance and the other are equals

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2016 CNES. All Rights Reserved.