JavaBuiltInClassPointerRef.st
author cg
Mon, 07 Jun 1999 17:23:52 +0000
changeset 564 a21bc85208c8
parent 454 38f590639d65
child 601 7e45fca24adf
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1997 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.
"



JavaClassRef subclass:#JavaBuiltInClassPointerRef
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Reader-Support'
!

!JavaBuiltInClassPointerRef class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 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.
"


! !

!JavaBuiltInClassPointerRef methodsFor:'accessing'!

nameandType:aJavaNameandType
    nameandType := aJavaNameandType.

    nameandType = '[B' ifTrue:[    "/ byte[]
        class := ByteArray.
        ^ self
    ].
    nameandType = '[Z' ifTrue:[    "/ boolean[]
        class := ByteArray.
        ^ self
    ].
    nameandType = '[I' ifTrue:[     "/ int[]
        class := SignedIntegerArray.
        ^ self
    ].
    nameandType = '[J' ifTrue:[     "/ long[]
        class := Array.
        ^ self
    ].
    nameandType = '[S' ifTrue:[     "/ short[]
        class := SignedWordArray.
        ^ self
    ].
    nameandType = '[C' ifTrue:[     "/ char[]
        class := String.      "/ should be TwoByteString ...
        ^ self
    ].
    nameandType = '[F' ifTrue:[     "/ float[]
        class := FloatArray.
        ^ self
    ].
    nameandType = '[D' ifTrue:[     "/ double[]
        class := DoubleArray.
        ^ self
    ].
"/    nameandType = '[[D' ifTrue:[    "/ double[][]
"/        ref := JavaBuiltInClassPointerRef class:DoubleArray nameandType:fullName.
"/        constantPool at:constantPoolIndex put:ref.
"/        ^ ref
"/    ].
"/    nameandType = '[[I' ifTrue:[    "/ int[][]
"/        ref := JavaBuiltInClassPointerRef class:Array nameandType:fullName.
"/        constantPool at:constantPoolIndex put:ref.
"/        ^ ref
"/    ].
    self halt.

    "Modified: / 13.1.1998 / 00:08:04 / cg"
! !

!JavaBuiltInClassPointerRef methodsFor:'printing & storing'!

displayString
    ^ self class name , '(class:' , class name , ' ; name&type: ' , nameandType displayString , ')'


!

fullName
    ^ class name

    "Created: / 20.10.1998 / 23:02:48 / cg"
! !

!JavaBuiltInClassPointerRef methodsFor:'queries'!

arrayClass
    |tc|

    nameandType size >= 2 ifTrue:[
        (nameandType at:1) == $[ ifTrue:[
            tc := nameandType at:2.

            ( tc == $[ ) ifTrue:[
                ^ Array
            ].
            ( tc == $I ) ifTrue:[
                ^ SignedIntegerArray
            ].
            ( tc == $B ) ifTrue:[
                ^ ByteArray
            ].
            ( tc == $C ) ifTrue:[
                ^ String "/ soon: TwoByteString
            ].
            ( tc == $D ) ifTrue:[
                ^ DoubleArray 
            ].
            ( tc == $F ) ifTrue:[
                ^ FloatArray 
            ].
        ].
    ].

self halt.
    ^ self

    "Created: / 13.1.1998 / 00:02:39 / cg"
    "Modified: / 20.10.1998 / 15:05:13 / cg"
!

asClassPointerRef
    ^ self

    "Created: / 13.1.1998 / 00:01:02 / cg"
    "Modified: / 13.1.1998 / 00:10:00 / cg"
!

deref
    (nameandType startsWith:'[[') ifTrue:[
        ^ self class new nameandType:(nameandType copyFrom:2)
    ].
    self halt.

    "Created: / 13.1.1998 / 00:03:44 / cg"
    "Modified: / 13.1.1998 / 00:09:15 / cg"
!

isUnresolved
    ^ false

    "Created: 2.7.1996 / 17:17:39 / cg"
!

javaClass
    ^ class

    "Created: 2.7.1996 / 17:19:43 / cg"
!

javaClassForNew
    ^ self

    "Created: 2.7.1996 / 17:19:43 / cg"
! !

!JavaBuiltInClassPointerRef class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaBuiltInClassPointerRef.st,v 1.11 1999/06/07 17:23:52 cg Exp $'
! !