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
-
AFTER
- A constant value used to indicate that the date was after
a specified year.
-
BEFORE
- A constant value used to indicate that the date was before
a specified year.
-
YearRange()
- Parameterless constructor that initialises the year range with
default values (0-9999).
-
YearRange(int, int)
- Constructor that initialises the start and the end of the year range
to the specified values.
-
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.
-
getEnd()
- Return the end of the year range
-
getStart()
- Returns the start of the year range
-
isChanged()
- Returns whether this year range has been changed since
it was created.
-
isNegative()
- Returns whether this year range is negative (i.e the end
is before the start)
-
setEnd(int)
- Set the end of the year range
-
setStart(int)
- Set the start of the year range
-
toString()
- Make a string representation of this object
BEFORE
public static final String BEFORE
- A constant value used to indicate that the date was before
a specified year.
AFTER
public static final String AFTER
- A constant value used to indicate that the date was after
a specified year.
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
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
YearRange
public YearRange()
- Parameterless constructor that initialises the year range with
default values (0-9999).
getStart
public int getStart()
- Returns the start of the year range
- Returns:
- The start of the year range
getEnd
public int getEnd()
- Return the end of the year range
- Returns:
- The end of the year range
setStart
public void setStart(int value)
- Set the start of the year range
- Parameters:
- value - The start of the year range
setEnd
public void setEnd(int value)
- Set the end of the year range
- Parameters:
- value - The end of the year range
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
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
toString
public String toString()
- Make a string representation of this object
- Returns:
- A string representation of this object
- Overrides:
- toString in class Object