JavaBuiltInClassPointerRef.st
author jv
Thu, 23 Sep 2010 13:52:13 +0000
changeset 748 da0840b7798c
parent 713 75e92ac63bf1
child 2108 ca8c4e7db2e8
permissions -rw-r--r--
Manufactured by SVN::ImportFromCVSTask to fix repository layout

"
 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.
"



"{ Package: 'stx:libjava' }"

JavaClassRef subclass:#JavaBuiltInClassPointerRef
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-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 == $Z ) ifTrue:[  "/ Boolean array
                ^ 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"
!

isJavaClassRef
    ^ false

    "Created: / 9.11.1999 / 17:16:55 / 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
    ^ '$Id$'
! !