net.sourceforge.pebble.domain
Class Year

java.lang.Object
  extended by net.sourceforge.pebble.domain.TimePeriod
      extended by net.sourceforge.pebble.domain.Year
All Implemented Interfaces:
java.lang.Comparable

public class Year
extends TimePeriod
implements java.lang.Comparable

Represents a blog at a yearly level. This manages a collection of Month instances.

Author:
Simon Brown

Constructor Summary
Year(Blog blog, int year)
          Creates a new Year instance for the specified year.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 java.util.List<Month> getArchives()
          Gets a collection of all Months, to date and in reverse order.
 Month getBlogForFirstMonth()
          Gets the first Month that actually contains blog entries.
 Month getBlogForMonth(int month)
          Gets the Month for the specified month.
 Month[] getMonths()
          Gets a collection of all Months managed by this blog.
 int getYear()
          Gets an integer representing the year that this yearly blog is for.
 java.lang.String toString()
          Gets a string representation of this object.
 
Methods inherited from class net.sourceforge.pebble.domain.TimePeriod
getBlog, getDate, setDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Year

public Year(Blog blog,
            int year)
Creates a new Year instance for the specified year.

Parameters:
blog - the Blog on which this Year is based
year - the year that this Year is for
Method Detail

getYear

public int getYear()
Gets an integer representing the year that this yearly blog is for.

Returns:
an int representing the year (e.g. 2003)

getBlogForMonth

public Month getBlogForMonth(int month)
Gets the Month for the specified month. Months are lazy loaded as needed.

Parameters:
month - the month as an int
Returns:
a Month instance

getBlogForFirstMonth

public Month getBlogForFirstMonth()
Gets the first Month that actually contains blog entries.

Returns:
a Month instance

getMonths

public Month[] getMonths()
Gets a collection of all Months managed by this blog.

Returns:
a Collection of Month instances

getArchives

public java.util.List<Month> getArchives()
Gets a collection of all Months, to date and in reverse order.

Returns:
a Collection of Month instances

compareTo

public int compareTo(java.lang.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.

Specified by:
compareTo in interface java.lang.Comparable
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.

toString

public java.lang.String toString()
Gets a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a String


Copyright © 2003-2006, Simon Brown. All Rights Reserved.