Class YearRange

java.lang.Object
   |
   +----YearRange

public class YearRange
extends Object
This class represents a date that might not be precisely known. The date is stored as an earliest and latest possible year.

Author:
Vegard Brox

Variable Index

 o AFTER
A constant value used to indicate that the date was after a specified year.
 o BEFORE
A constant value used to indicate that the date was before a specified year.

Constructor Index

 o YearRange()
Parameterless constructor that initialises the year range with default values (0-9999).
 o YearRange(int, int)
Constructor that initialises the start and the end of the year range to the specified values.
 o YearRange(String, int)
Constructor that initialises either the start or the end of the year range to the specified value, and then uses the default value for the other year.

Method Index

 o getEnd()
Return the end of the year range
 o getStart()
Returns the start of the year range
 o isChanged()
Returns whether this year range has been changed since it was created.
 o isNegative()
Returns whether this year range is negative (i.e the end is before the start)
 o setEnd(int)
Set the end of the year range
 o setStart(int)
Set the start of the year range
 o toString()
Make a string representation of this object

Variables

 o BEFORE
 public static final String BEFORE
A constant value used to indicate that the date was before a specified year.

 o AFTER
 public static final String AFTER
A constant value used to indicate that the date was after a specified year.

Constructors

 o YearRange
 public YearRange(int start,
                  int end)
Constructor that initialises the start and the end of the year range to the specified values. If the same value is used for both parameters, this year range will represent a specific year.

Parameters:
start - The start of the year range
end - The end of the year range
 o YearRange
 public YearRange(String mode,
                  int year)
Constructor that initialises either the start or the end of the year range to the specified value, and then uses the default value for the other year.

Parameters:
mode - Either BEFORE to specify the end of the year range or BEFORE to specify the start of the year range
year - The year to initialise either start or end of the year range with
 o YearRange
 public YearRange()
Parameterless constructor that initialises the year range with default values (0-9999).

Methods

 o getStart
 public int getStart()
Returns the start of the year range

Returns:
The start of the year range
 o getEnd
 public int getEnd()
Return the end of the year range

Returns:
The end of the year range
 o setStart
 public void setStart(int value)
Set the start of the year range

Parameters:
value - The start of the year range
 o setEnd
 public void setEnd(int value)
Set the end of the year range

Parameters:
value - The end of the year range
 o isChanged
 public boolean isChanged()
Returns whether this year range has been changed since it was created.

Returns:
true if this year range has been changed, false otherwise
 o isNegative
 public boolean isNegative()
Returns whether this year range is negative (i.e the end is before the start)

Returns:
true if this year range is negative, false otherwise
 o toString
 public String toString()
Make a string representation of this object

Returns:
A string representation of this object
Overrides:
toString in class Object