UnboxedFloatArray.st
author Claus Gittinger <cg@exept.de>
Mon, 27 Jan 2020 13:47:24 +0100
changeset 25204 b12f8693fe6f
parent 25019 f40303739cfe
permissions -rw-r--r--
#BUGFIX by cg class: CharacterArray added: #asImmutableCollection #asImmutableString

"
 COPYRIGHT (c) 2019 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic' }"

"{ NameSpace: Smalltalk }"

AbstractNumberVector subclass:#UnboxedFloatArray
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Collections-Arrayed'
!

!UnboxedFloatArray class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2019 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    An abstract superclass for all unboxed float classes.
    In contrast to normal arrays (which store pointers to their elements),
    unboxedFloatArrays store the values in a dense & compact way. 
    Since the representation fits corresponding underlying C-language representations,
    these are also useful to pass bulk data to c primitive code.

    [see also:]
        ByteArray WordArray BooleanArray FloatArray DoubleArray Array
        IntegerArray LongIntegerArray SignedLongIntegerArray

    [author:]
        Claus Gittinger
"
! !

!UnboxedFloatArray class methodsFor:'queries'!

isAbstract
    "Return if this class is an abstract class.
     True is returned for UnboxedFloatArray here; false for subclasses.
     Abstract subclasses must redefine this again."

    ^ self == UnboxedFloatArray

    "Created: / 03-03-2019 / 00:21:15 / Claus Gittinger"
!

precision
    "answer the precision (the number of bits in the mantissa) of my elements (in bits)
     If my elments are IEEE floats, where only the fraction from the normalized mantissa is stored,
     there will be a hidden bit and the mantissa will be actually represented by 1 more binary digits
     (i.e. the number returned is 1 plus the actual number of bits stored)"

    self subclassResponsibility
! !

!UnboxedFloatArray methodsFor:'queries'!

defaultElement
    ^ 0.0

    "Created: / 03-03-2019 / 00:22:22 / Claus Gittinger"
!

isValidElement:anObject
    "return true, if I can hold this kind of object"

    ^ anObject isNumber
    "/ and:[ (anObject >= self class minVal)
    "/ and:[ (anObject <= self class maxVal) ]]

    "Created: / 03-03-2019 / 00:22:48 / Claus Gittinger"
! !

!UnboxedFloatArray methodsFor:'testing'!

isFloatArray
    "return true if the receiver has float elements.
     These are Float-, Double and HalfFloat arrays"

    ^ true

    "Created: / 03-03-2019 / 00:23:38 / Claus Gittinger"
! !

!UnboxedFloatArray class methodsFor:'documentation'!

version_CVS
    ^ '$Header$'
! !