Package org.eclipse.wst.xml.xpath2.processor.internal.types


org.eclipse.wst.xml.xpath2.processor.internal.types
Class XSDuration



public class XSDuration
extends org.eclipse.wst.xml.xpath2.processor.internal.types.CtrType
A representation of the xs:duration data type. Other duration implementations should inherit from this implementation.


Field Summary

protected int_days
    
protected int_hours
    
protected int_minutes
    
protected int_month
    
protected boolean_negative
    
protected double_seconds
    
protected int_year
    

Constructor Summary

XSDuration(int years , int months , int days , int hours , int minutes , double seconds , boolean negative)
XSDuration(double secs)
XSDuration()

Method Summary

public java.lang.Objectclone()
    
public org.eclipse.wst.xml.xpath2.api.ResultSequenceconstructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)
     Creates a new ResultSequence consisting of the extractable time duration from the supplied ResultSequence
public intdays()
     Retrieves the number of days within the duration of time stored
public booleaneq(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext)
     Equality comparison between this and the supplied duration of time.
public java.lang.ObjectgetNativeValue()
    
public java.lang.StringgetStringValue()
     Retrieves a String representation of the duration stored
public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinitiongetTypeDefinition()
    
public booleangt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)
     Comparison between this and the supplied duration of time.
public inthours()
     Retrieves the number of hours (max 24) within the duration of time stored
protected booleanisCastable(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType aat)
    
public booleanlt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)
     Comparison between this and the supplied duration of time.
public intminutes()
     Retrieves the number of minutes (max 60) within the duration of time stored
public intmonth()
     Retrieves the number of months within the duration of time stored
public booleannegative()
     Retrieves whether this duration represents a backward passage through time
public static org.eclipse.wst.xml.xpath2.processor.internal.types.XSDurationparseDTDuration(java.lang.String str)
     Creates a new XSDayTimeDuration by parsing the supplied String represented duration of time
public doubleseconds()
     Retrieves the number of seconds (max 60) within the duration of time stored
public java.lang.Stringstring_type()
    
public doubletime_value()
    
public java.lang.Stringtype_name()
    
public doublevalue()
     Retrieves the duration of time stored as the number of seconds within it
public intyear()
     Retrieves the number of years within the duration of time stored

Field Detail

_days

protected int _days


_hours

protected int _hours


_minutes

protected int _minutes


_month

protected int _month


_negative

protected boolean _negative


_seconds

protected double _seconds


_year

protected int _year


Constructor Detail

XSDuration

public XSDuration(int years , int months , int days , int hours , int minutes , double seconds , boolean negative)

Initializes to the supplied parameters. If more than 24 hours is supplied, the number of days is adjusted accordingly. The same occurs for minutes and seconds


XSDuration

public XSDuration(double secs)

Initialises to the given number of seconds


XSDuration

public XSDuration()

Initialises to a duration of no time (0days, 0hours, 0minutes, 0seconds)


Methods Detail

clone

public java.lang.Object clone()

Returns

java.lang.Object

Throws:

java.lang.CloneNotSupportedException


constructor

public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg)

Creates a new ResultSequence consisting of the extractable time duration from the supplied ResultSequence

Parameters

arg - The ResultSequence from which to extract

Returns

org.eclipse.wst.xml.xpath2.api.ResultSequence - New ResultSequence consisting of the time duration extracted

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


days

public int days()

Retrieves the number of days within the duration of time stored

Returns

int - Number of days within the duration of time stored


eq

public boolean eq(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext)

Equality comparison between this and the supplied duration of time.

Parameters

arg - The duration of time to compare with

dynamicContext

Returns

boolean - True if they both represent the duration of time. False otherwise

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


getNativeValue

public java.lang.Object getNativeValue()

Returns

java.lang.Object


getStringValue

public java.lang.String getStringValue()

Retrieves a String representation of the duration stored

Returns

java.lang.String - String representation of the duration stored


getTypeDefinition

public org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition getTypeDefinition()

Returns

org.eclipse.wst.xml.xpath2.api.typesystem.TypeDefinition


gt

public boolean gt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)

Comparison between this and the supplied duration of time.

Parameters

arg - The duration of time to compare with

context

Returns

boolean - True if the supplied time represents a smaller duration than that stored. False otherwise

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


hours

public int hours()

Retrieves the number of hours (max 24) within the duration of time stored

Returns

int - Number of hours within the duration of time stored


isCastable

protected boolean isCastable(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType aat)

Parameters

aat

Returns

boolean


lt

public boolean lt(org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType arg , org.eclipse.wst.xml.xpath2.api.DynamicContext context)

Comparison between this and the supplied duration of time.

Parameters

arg - The duration of time to compare with

context

Returns

boolean - True if the supplied time represents a larger duration than that stored. False otherwise

Throws:

org.eclipse.wst.xml.xpath2.processor.DynamicError


minutes

public int minutes()

Retrieves the number of minutes (max 60) within the duration of time stored

Returns

int - Number of minutes within the duration of time stored


month

public int month()

Retrieves the number of months within the duration of time stored

Returns

int - Number of months within the duration of time stored


negative

public boolean negative()

Retrieves whether this duration represents a backward passage through time

Returns

boolean - True if this duration represents a backward passage through time. False otherwise


parseDTDuration

public org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration parseDTDuration(java.lang.String str)

Creates a new XSDayTimeDuration by parsing the supplied String represented duration of time

Parameters

str - String represented duration of time

Returns

org.eclipse.wst.xml.xpath2.processor.internal.types.XSDuration - New XSDayTimeDuration representing the duration of time supplied


seconds

public double seconds()

Retrieves the number of seconds (max 60) within the duration of time stored

Returns

double - Number of seconds within the duration of time stored


string_type

public java.lang.String string_type()

Returns

java.lang.String


time_value

public double time_value()

Returns

double


type_name

public java.lang.String type_name()

Returns

java.lang.String


value

public double value()

Retrieves the duration of time stored as the number of seconds within it

Returns

double - Number of seconds making up this duration of time


year

public int year()

Retrieves the number of years within the duration of time stored

Returns

int - Number of years within the duration of time stored