org.deri.iris.terms.concrete
Class Duration

java.lang.Object
  extended by org.deri.iris.terms.concrete.Duration
All Implemented Interfaces:
Comparable<ITerm>, IDuration, IConcreteTerm, ITerm
Direct Known Subclasses:
DayTimeDuration, YearMonthDuration

public class Duration
extends Object
implements IDuration

Simple implementation of IDuration.


Method Summary
 int compareTo(ITerm o)
           
 boolean equals(Object obj)
           
 URI getDatatypeIRI()
          Returns the fully qualified identifier for the data type corresponding to this term.
 int getDay()
          Returns the days
 double getDecimalSecond()
          Return the complete floating point representation of the seconds components.
 int getHour()
          Returns the hours
 int getMillisecond()
          Returns the milliseconds.
 int getMinute()
          returns the minutes
 int getMonth()
          Returns the months
 int getSecond()
          Returns the seconds
 Duration getValue()
          Return the wrapped type.
 int getYear()
          Returns the years.
 int hashCode()
           
 boolean isGround()
          Checks whether the term is ground (a term with no variables).
 boolean isPositive()
          Returns true if this is a positive duration, false otherwise.
 String toCanonicalString()
          Returns a canonical string representation of this term.
 String toString()
           Returns a short string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getYear

public int getYear()
Description copied from interface: IDuration
Returns the years.

Specified by:
getYear in interface IDuration
Returns:
the years

getMonth

public int getMonth()
Description copied from interface: IDuration
Returns the months

Specified by:
getMonth in interface IDuration
Returns:
the months

getDay

public int getDay()
Description copied from interface: IDuration
Returns the days

Specified by:
getDay in interface IDuration
Returns:
the days

getHour

public int getHour()
Description copied from interface: IDuration
Returns the hours

Specified by:
getHour in interface IDuration
Returns:
the hours

getMinute

public int getMinute()
Description copied from interface: IDuration
returns the minutes

Specified by:
getMinute in interface IDuration
Returns:
the minutes

getSecond

public int getSecond()
Description copied from interface: IDuration
Returns the seconds

Specified by:
getSecond in interface IDuration
Returns:
the seconds

getMillisecond

public int getMillisecond()
Description copied from interface: IDuration
Returns the milliseconds.

Specified by:
getMillisecond in interface IDuration
Returns:
the milliseconds

getDecimalSecond

public double getDecimalSecond()
Description copied from interface: IDuration
Return the complete floating point representation of the seconds components.

Specified by:
getDecimalSecond in interface IDuration
Returns:
Decimal seconds

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()

Returns a short string representation of this object. The format of the returned string is subject to change.

The resutl is formatted according to the XML 1.0 specification.

Overrides:
toString in class Object
Returns:
the string representation

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(ITerm o)
Specified by:
compareTo in interface Comparable<ITerm>

isGround

public boolean isGround()
Description copied from interface: ITerm
Checks whether the term is ground (a term with no variables).

Specified by:
isGround in interface ITerm
Returns:
true if the term is ground, otherwise false.

getValue

public Duration getValue()
Description copied from interface: IDuration
Return the wrapped type.

Specified by:
getValue in interface IDuration
Specified by:
getValue in interface ITerm
Returns:
The term value.

getDatatypeIRI

public URI getDatatypeIRI()
Description copied from interface: IConcreteTerm
Returns the fully qualified identifier for the data type corresponding to this term. For instance, a terms representing a double data type should return the URI "http://www.w3.org/2001/XMLSchema#double".

Specified by:
getDatatypeIRI in interface IConcreteTerm
Returns:
The fully qualified identifier for the data type corresponding to this term.

isPositive

public boolean isPositive()
Description copied from interface: IDuration
Returns true if this is a positive duration, false otherwise. Also returns true if this is a duration of length 0.

Specified by:
isPositive in interface IDuration
Returns:
true if this is a positive duration, false otherwise.

toCanonicalString

public String toCanonicalString()
Description copied from interface: IConcreteTerm
Returns a canonical string representation of this term.

Specified by:
toCanonicalString in interface IConcreteTerm
Returns:
A canonical string representation of this term.