tauZaman
v0.1

tauzaman.calendar
Class RegularMapping

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

public class RegularMapping
extends Mapping

RegularMapping class represents the granularity and granularity mapping information of a Calendar. For example;

   < granularity name = "dayHundreth" >
      < regularMapping from = "second" groupSize = "864" anchor = "0"
           anchorGranularity = "second" />
   < /granularity >
 

See Also:
Calendar
Status:
design complete, implementation complete

Field Summary
private  int anchor
          Value of anchor
private  Granularity anchorGranularity
          anchor Granularity
private  int groupSize
          Group size of from Granularity in to Granularity.
private  int periodSize
          Period size of from Granularity in to Granularity.
 
Fields inherited from class tauzaman.calendar.mapping.Mapping
COARSER_TO_FINER, CONGRUENT, FINER_TO_COARSER, from, relationship, to
 
Constructor Summary
RegularMapping(Granularity to, Granularity from, int relationship, org.w3c.dom.Element root)
          Constructs a RegularMapping object, which stores a Regular Mapping information for a Calendar.
RegularMapping(Granularity to, Granularity from, int relationship, int groupSize, int periodSize, int anchor)
           
 
Method Summary
private  void formRegularMapping(org.w3c.dom.Element root)
          Forms an RegularMapping object by parsing a xml specification file.
 int getAnchor()
          Returns the value anchor
 Granularity getAnchorGranularity()
          Returns anchor Granularity
 int getGroupSize()
          Returns the group size of from Granularity with respect to to Granularity.
 int getPeriodSize()
          Returns the period size of from Granularity with respect to to Granularity.
 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.
 java.lang.String toString()
          toString method
 
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

groupSize

private int groupSize
Group size of from Granularity in to Granularity.


periodSize

private int periodSize
Period size of from Granularity in to Granularity.


anchorGranularity

private Granularity anchorGranularity
anchor Granularity


anchor

private int anchor
Value of anchor

Constructor Detail

RegularMapping

public RegularMapping(Granularity to,
                      Granularity from,
                      int relationship,
                      int groupSize,
                      int periodSize,
                      int anchor)

RegularMapping

public RegularMapping(Granularity to,
                      Granularity from,
                      int relationship,
                      org.w3c.dom.Element root)
Constructs a RegularMapping object, which stores a Regular Mapping information for a Calendar.

Parameters:
to - Granularity, which mapping is declared to
from - Granularity, which mapping is declated from
root - DOM Element, which points to RegularMapping information of corresponding xml specification file.
See Also:
IrregularMapping
Method Detail

formRegularMapping

private void formRegularMapping(org.w3c.dom.Element root)
Forms an RegularMapping object by parsing a xml specification file.

Parameters:
root - DOM Element, which points to RegularMapping information of corresponding xml specification file.

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, if mapping can not be performed -1 is returned

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, , if mapping can not be performed -1 is returned

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, if mapping can not be performed -1 is returned

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, if mapping can not be performed -1 is returned

getPeriodSize

public int getPeriodSize()
Returns the period size of from Granularity with respect to to Granularity.

Returns:
int period size

getGroupSize

public int getGroupSize()
Returns the group size of from Granularity with respect to to Granularity.

Returns:
int group size

getAnchor

public int getAnchor()
Returns the value anchor

Returns:
int value

getAnchorGranularity

public Granularity getAnchorGranularity()
Returns anchor Granularity

Returns:
Granularity

toString

public java.lang.String toString()
toString method

Overrides:
toString in class Mapping
Returns:
string representation of this object

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project