tauZaman
v0.1

tauzaman.calendar
Class IrregularMapping

java.lang.Object
  |
  +--tauzaman.calendar.mapping.Mapping
        |
        +--tauzaman.calendar.IrregularMapping

public class IrregularMapping
extends Mapping

IrregularMapping class represents the irregular granularity mapping information of a Calendar. For example;

   < granularity name = "month" >
      < irregularMapping from = "day" url = ".../classname.class" >
         < method name = "gregCastMonthToDay" />
         < method name = "gregCastDayToMonth" />
         < method name = "gregScaleMonthToDay" />
      < /irregularmapping >
   < /granularity >
 

See Also:
Calendar, Mapping, Granularity
Status:
design complete, implementation complete

Field Summary
private  ClassLoaderMethodCaller clmc
          Instance of ClassLoaderMethodCaller, which keeps dynamically loaded classes by this IrregularMapping
private  java.util.Hashtable methodBehaviorTypeToNames
          A Hashtable relates type and behavior of methods to method names.
private  java.net.URL url
          URL that points either to a (.jar file | directory) or a class file
 
Fields inherited from class tauzaman.calendar.mapping.Mapping
COARSER_TO_FINER, CONGRUENT, FINER_TO_COARSER, from, relationship, to
 
Constructor Summary
IrregularMapping(Granularity to, Granularity from, int relationship, java.net.URL url, org.w3c.dom.Element root)
          Constructs an IrregularMapping object, which allocates memory for method names and urls.
 
Method Summary
private  void formIrregularMapping(org.w3c.dom.Element root)
          Forms an IrregularMapping object by parsing a xml specification file.
 java.net.URL getUrl()
          Returns irregular mapping implementation url.
 long performAnchoredCast(long point)
          Casts a given anchored point.
 long[] performAnchoredScale(long point)
          Scales a given anchored point.
 long performUnanchoredCast(long point)
          Casts a given unanchored point.
 long[] performUnanchoredScale(long point)
          Scales a given unanchored point.
private  void testPerformMappings()
          Tests mappings when constructed...
 java.lang.String toString()
          Returns a String representing this IrregularMapping object.
 
Methods inherited from class tauzaman.calendar.mapping.Mapping
equals, fetchRelationship, getFrom, getRelationship, getTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

methodBehaviorTypeToNames

private java.util.Hashtable methodBehaviorTypeToNames
A Hashtable relates type and behavior of methods to method names. There two possible types and behaviors for methods; cast, scale as types and anchored, unanchored for bahaviors. A method for IrregularMapping can only belong to one of these types. Keys are behavior+type names, "anchoredscale", "unachoredscale", "anchoredcast", "unanchoredcast" and values are method names.


url

private java.net.URL url
URL that points either to a (.jar file | directory) or a class file


clmc

private ClassLoaderMethodCaller clmc
Instance of ClassLoaderMethodCaller, which keeps dynamically loaded classes by this IrregularMapping

Constructor Detail

IrregularMapping

public IrregularMapping(Granularity to,
                        Granularity from,
                        int relationship,
                        java.net.URL url,
                        org.w3c.dom.Element root)
                 throws IrregularMappingFormationException
Constructs an IrregularMapping object, which allocates memory for method names and urls.

Parameters:
to - Granularity, which IrregularMapping is declared to
from - Granularity, which IrregularMapping is declared from
relationship - int between the Granularities of this IrregularMapping
url - URL of irregular method implementations
root - DOM Element, which points to IrregularMapping information of corresponding xml specification file.
Throws:
IrregularMappingFormationException - if any abnormal condition occurs when parsing a IrregularMapping
Method Detail

formIrregularMapping

private void formIrregularMapping(org.w3c.dom.Element root)
                           throws IrregularMappingFormationException
Forms an IrregularMapping object by parsing a xml specification file.

Parameters:
root - DOM Element, which points to IrregularMapping information of corresponding xml specification file.
Throws:
IrregularMappingFormationException - if any abnormal condition occurs when parsing a IrregularMapping

testPerformMappings

private void testPerformMappings()
Tests mappings when constructed...


performAnchoredCast

public long performAnchoredCast(long point)
Casts a given anchored point.

Specified by:
performAnchoredCast in class Mapping
Parameters:
point - point in time to be casted
Returns:
long casted point

performAnchoredScale

public long[] performAnchoredScale(long point)
Scales a given anchored point.

Specified by:
performAnchoredScale in class Mapping
Parameters:
point - point in time to be scaled
Returns:
long value(s) of scaled point

performUnanchoredCast

public long performUnanchoredCast(long point)
Casts a given unanchored point.

Specified by:
performUnanchoredCast in class Mapping
Parameters:
point - point in time to be casted
Returns:
long casted point

performUnanchoredScale

public long[] performUnanchoredScale(long point)
Scales a given unanchored point.

Specified by:
performUnanchoredScale in class Mapping
Parameters:
point - point in time to be scaled
Returns:
long value(s) of scaled point

getUrl

public java.net.URL getUrl()
Returns irregular mapping implementation url.

Returns:
Url of this irregular mapping implementation

toString

public java.lang.String toString()
Returns a String representing this IrregularMapping object.

Overrides:
toString in class Mapping
Returns:
string URL of this IrregularMapping

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project