tauZaman
v0.1

tauzaman.calendar.mapping
Class Mapping

java.lang.Object
  |
  +--tauzaman.calendar.mapping.Mapping
Direct Known Subclasses:
IrregularMapping, RegularMapping

public abstract class Mapping
extends java.lang.Object

Mapping abstract class represents the granularity mapping information of a Calendar.

See Also:
Calendar, IrregularMapping, RegularMapping, Granularity
Status:
design complete, implementation complete

Field Summary
static int COARSER_TO_FINER
           
static int CONGRUENT
           
static int FINER_TO_COARSER
           
protected  Granularity from
          from Granularity
protected  int relationship
          Relationship between the Granularities of this Mapping
protected  Granularity to
          to Granularity
 
Constructor Summary
Mapping(Granularity to, Granularity from, int relationship)
          Constructs a Mapping from "from" Granularity to "to" Granularity.
 
Method Summary
 boolean equals(java.lang.Object other)
          Returns true if this Mapping is equal to the given Mapping.
private static java.lang.String fetchRelationship(int relationship)
          Given a string corresponding of a relationship, used as in xml spec. files, returns int code of that relationship.
static int fetchRelationship(java.lang.String relationship)
          Given a string corresponding of a relationship, used as in xml spec. files, returns int code of that relationship.
 Granularity getFrom()
          Returns from Granularity
 int getRelationship()
          Returns relationship of this Mapping
 Granularity getTo()
          Returns to Granularity
abstract  long performAnchoredCast(long point)
          Casts a given anchored point.
abstract  long[] performAnchoredScale(long point)
          Scales a given anchored point.
abstract  long performUnanchoredCast(long point)
          Casts a given unanchored point.
abstract  long[] performUnanchoredScale(long point)
          Scales a given unanchored point.
 java.lang.String toString()
          toString method as abstract
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FINER_TO_COARSER

public static final int FINER_TO_COARSER
See Also:
Constant Field Values

COARSER_TO_FINER

public static final int COARSER_TO_FINER
See Also:
Constant Field Values

CONGRUENT

public static final int CONGRUENT
See Also:
Constant Field Values

relationship

protected int relationship
Relationship between the Granularities of this Mapping


to

protected Granularity to
to Granularity


from

protected Granularity from
from Granularity

Constructor Detail

Mapping

public Mapping(Granularity to,
               Granularity from,
               int relationship)
Constructs a Mapping from "from" Granularity to "to" Granularity.

Parameters:
to - Granularity that this Mapping starts
from - Granularity that this Mapping ends
relationship - (finer/coarser/congruent) relationship between Mapping Granularities
Method Detail

getRelationship

public int getRelationship()
Returns relationship of this Mapping

Returns:
relationship type of this Mapping

fetchRelationship

public static int fetchRelationship(java.lang.String relationship)
Given a string corresponding of a relationship, used as in xml spec. files, returns int code of that relationship.

Parameters:
relationship - String corresponding of a relationship
Returns:
int corresponding of input relationship, if input does not map into any valid relationships, then -1 is returned

fetchRelationship

private static java.lang.String fetchRelationship(int relationship)
Given a string corresponding of a relationship, used as in xml spec. files, returns int code of that relationship.

Parameters:
relationship - integer corresponding of a relationship
Returns:
String corresponding of input relationship, if input does not map into any valid relationships, then null is returned

getTo

public Granularity getTo()
Returns to Granularity

Returns:
to Granularity of this Mapping

getFrom

public Granularity getFrom()
Returns from Granularity

Returns:
from granularity of this mapping

equals

public boolean equals(java.lang.Object other)
Returns true if this Mapping is equal to the given Mapping. False otherwise.

Overrides:
equals in class java.lang.Object
Parameters:
other - Mapping to be compared with this Mapping
Returns:
boolean value true if Granularities of two Mapping matches. False otherwise.

performAnchoredCast

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

Parameters:
point - point in time to be casted
Returns:
long casted point

performAnchoredScale

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

Parameters:
point - point in time to be scaled
Returns:
long value(s) of scaled point

performUnanchoredCast

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

Parameters:
point - point in time to be casted
Returns:
long casted point

performUnanchoredScale

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

Parameters:
point - point in time to be scaled
Returns:
long value(s) of scaled point

toString

public java.lang.String toString()
toString method as abstract

Overrides:
toString in class java.lang.Object
Returns:
string representation of this object

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project