xquery/XQuery__DoubleToIntegerCast.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 02 Jul 2018 08:46:01 +0200
changeset 305 bad21c4f64bf
parent 296 ea3dbc023c80
permissions -rw-r--r--
Tagged Smalltalk/X 8.0.0

"{ Package: 'stx:goodies/xmlsuite/xquery' }"

"{ NameSpace: XQuery }"

AnyAtomicTypeToAnyAtomicTypeCast subclass:#DoubleToIntegerCast
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'XQuery-TypeCasting'
!


!DoubleToIntegerCast methodsFor:'casting'!

cast
    | value |
    "If ST is xs:decimal, xs:float or xs:double, then TV is SV with the fractional part discarded 
        and the value converted to xs:integer. 
        Thus, casting 3.1456 returns 3 and -17.89 returns -17. Casting 3.124E1 returns 31."



    value := atomicValue nodeId truncated.
    ^ AtomicItem withValue: value asType: anotherType typeName.

    "Created: / 17-11-2009 / 16:46:08 / Jan Kurs <kursj1@fel.cvut.cz>"
    "Modified: / 17-11-2009 / 18:10:52 / Jan Kurs <kursj1@fel.cvut.cz>"
! !

!DoubleToIntegerCast class methodsFor:'documentation'!

version_SVN
    ^ '$Id$'
! !