tauZaman
v0.1

tauzaman.calendricsystem
Class Granularity

java.lang.Object
  |
  +--tauzaman.calendricsystem.Granularity
All Implemented Interfaces:
java.io.Serializable

public class Granularity
extends java.lang.Object
implements java.io.Serializable

The Granularity class is for granularities in calendars. A granularity is a "system of measurement" within a calendar, for example, days, months, and years are common granularities within the Gregorian calendar. A granularity is a modeled as a sequence of granules. The granules are labeled with integers. Each integer is the distance of the granule from the granularity's anchor point (the zeroth granule).

See Also:
Granule, Serialized Form
Status:
design complete, implementation complete

Field Summary
private  java.net.URL calendarUrl
          URL of Calendar of which this Granularity is created
private  java.lang.String name
          local name of this Granularity
 
Constructor Summary
Granularity(java.lang.String name)
          Constructs a Calendarless Granularity.
Granularity(java.lang.String name, java.net.URL calendarUrl)
          Constructs a Granularity.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if this Granularity's global identity is equal to the global identity of the given Granularity.
 java.net.URL getCalendarUrl()
          Returns calendar url part of this Granularity.
 java.lang.String getLocalName()
          Returns name of this Granularity.
 int hashCode()
           
 void setCalendarUrl(java.net.URL calendarUrl)
          Sets Calendar URL of this Granularity.
 java.lang.String toString()
          Returns String representation of this Granularity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name
local name of this Granularity


calendarUrl

private java.net.URL calendarUrl
URL of Calendar of which this Granularity is created

Constructor Detail

Granularity

public Granularity(java.lang.String name,
                   java.net.URL calendarUrl)
Constructs a Granularity.

Parameters:
name - String name of Granularity, such as "day"
calendarUrl - URL of Calendar that contains this Granularity name

Granularity

public Granularity(java.lang.String name)
Constructs a Calendarless Granularity.

Parameters:
name - String name of Granularity, such as "day"
Method Detail

setCalendarUrl

public void setCalendarUrl(java.net.URL calendarUrl)
Sets Calendar URL of this Granularity.

Parameters:
calendarUrl - URL of Calendar that contains this Granularity name

getLocalName

public java.lang.String getLocalName()
Returns name of this Granularity.

Returns:
String name of this Granularity

getCalendarUrl

public java.net.URL getCalendarUrl()
Returns calendar url part of this Granularity. If this Granularity is calendar-less Granularity, the null is returned.

Returns:
URL url of parent Calendar of this Granularity.

equals

public boolean equals(java.lang.Object obj)
Returns true if this Granularity's global identity is equal to the global identity of the given Granularity. There are three possibilities of this equality check:

Overrides:
equals in class java.lang.Object
Returns:
boolean true if two Granularities are equal, false otherwise.

toString

public java.lang.String toString()
Returns String representation of this Granularity. return a String representing this Granularity

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project