cz.cuni.amis.pogamut.episodic.episodes
Class AgeInterval

Package class diagram package AgeInterval
java.lang.Object
  extended by cz.cuni.amis.pogamut.episodic.episodes.AgeInterval
All Implemented Interfaces:
Serializable

public class AgeInterval
extends Object
implements Serializable

The AgeInterval class contains information about the age of a chronobag. Age of all episodes in chronobag should be at least minAge and at most maxAge days.

An instance of this class exist in each Chronobag instance.

Author:
Michal Cermak
See Also:
Serialized Form

Constructor Summary
AgeInterval(int min, int max)
          Instantiate the class by providing the ends of age interval.
 
Method Summary
 int getMaxAge()
          Getter method for maxAge variable.
 int getMinAge()
          Getter method for minAge variable.
 void increase()
          Increases the values of minAge and maxAge by one.
 boolean intersects(AgeInterval b)
          Checks if there is non-zero intersection between the current and the specified interval.
 AgeInterval join(AgeInterval other)
          Joins the interval with another Age Interval.
 String toString()
          Returns a String object representing this AgeInterval's value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgeInterval

public AgeInterval(int min,
                   int max)
Instantiate the class by providing the ends of age interval.

Both bounds should be zero in case of the chronobag representing the current day. (Episodes are zero days old).

Parameters:
min - Minimum age of episodes.
max - Maximum age of episodes.
Method Detail

getMinAge

public int getMinAge()
Getter method for minAge variable.

Returns:
Lower bound for age of episodes in a chronobag (in days).

getMaxAge

public int getMaxAge()
Getter method for maxAge variable.

Returns:
Upper bound for age of episodes in a chronobag (in days).

intersects

public boolean intersects(AgeInterval b)
Checks if there is non-zero intersection between the current and the specified interval.

Parameters:
b - An interval to check the intersection with.
Returns:
True if the intervals have non-empty intersection, false otherwise.

join

public AgeInterval join(AgeInterval other)
Joins the interval with another Age Interval. If there is no intersection between the two intervals, their union will not be an interval.

Parameters:
other - Interval to join with.
Returns:
If union of both intervals is an interval returns the new unified interval, otherwise returns null.

increase

public void increase()
Increases the values of minAge and maxAge by one.

In other words, increases the age of interval by one day.


toString

public String toString()
Returns a String object representing this AgeInterval's value. The lower and upper bounds both appears in the representation.

Overrides:
toString in class Object
Returns:
a string representation of the value of this object.


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.