JavaConstantPool.st
author cg
Thu, 07 Aug 1997 13:19:56 +0000
changeset 203 67af98594672
parent 171 4669a5e3d44a
child 206 2200b9091b9e
permissions -rw-r--r--
*** empty log message ***

Array subclass:#JavaConstantPool
	instanceVariableNames:'owner'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Reader-Support'
!


!JavaConstantPool methodsFor:'accessing'!

owner
    "return owner"

    ^ owner

    "Created: 28.6.1996 / 21:12:22 / cg"
!

owner:something
    "set owner"

    owner := something.

    "Created: 28.6.1996 / 21:12:22 / cg"
! !

!JavaConstantPool methodsFor:'printing & storing'!

displayString
    owner isNil ifTrue:[
        ^ '*** unowned ConstantPool'
    ].
    ^ 'ConstantPool of ' , owner fullName

    "Created: 28.6.1996 / 21:13:41 / cg"
    "Modified: 28.6.1996 / 21:20:26 / cg"
! !

!JavaConstantPool methodsFor:'queries'!

referesToMethodNamed:aJavaMethodName
    self do:[:constItem |
        (constItem isMemberOf:JavaMethod) ifTrue:[
            constItem name = aJavaMethodName ifTrue:[^ true].
        ] ifFalse:[
            (constItem isMemberOf:JavaMethodref) ifTrue:[
self halt.
                constItem name = aJavaMethodName ifTrue:[^ true].
            ].
            (constItem isMemberOf:JavaUnresolvedMethodrefConstant) ifTrue:[
                self halt.
            ]
        ]
    ].
    ^ false

    "Modified: 29.7.1997 / 17:38:35 / cg"
    "Created: 29.7.1997 / 17:39:41 / cg"
!

refersToMethod:aJavaMethod
    self do:[:constItem |
        (constItem == aJavaMethod) ifTrue:[^ true].
        (constItem isMemberOf:JavaMethodref) ifTrue:[
            self halt.
        ].
        (constItem isMemberOf:JavaUnresolvedMethodrefConstant) ifTrue:[
            self halt.
        ]
    ].
    ^ false

    "Modified: 29.7.1997 / 17:36:49 / cg"
    "Created: 29.7.1997 / 17:39:19 / cg"
!

refersToMethodNamed:aJavaMethodName
    self do:[:constItem |
        (constItem isMemberOf:JavaMethod) ifTrue:[
            constItem name = aJavaMethodName ifTrue:[^ true].
        ] ifFalse:[
            (constItem isMemberOf:JavaMethodref) ifTrue:[
                constItem name = aJavaMethodName ifTrue:[^ true].
            ].
            (constItem isMemberOf:JavaUnresolvedMethodrefConstant) ifTrue:[
                self halt.
            ]
        ]
    ].
    ^ false

    "Modified: 29.7.1997 / 17:38:35 / cg"
    "Created: 29.7.1997 / 17:39:24 / cg"
! !

!JavaConstantPool methodsFor:'special'!

updateClassRefsFrom:oldClass to:newClass
    self keysAndValuesDo:[:index :constItem |
        constItem == oldClass ifTrue:[
            self at:index put:newClass
        ] ifFalse:[
            constItem isNumber ifFalse:[
                constItem isString ifTrue:[
                    "/ nothing done ...
                ] ifFalse:[
                    (constItem isMemberOf:(Java java_lang_String)) ifTrue:[
                        "/ nothing done ...
                    ] ifFalse:[
                        constItem isJavaClass ifFalse:[
                            constItem updateClassRefsFrom:oldClass to:newClass
                        ]
                    ]
                ]
            ]
        ]
    ]

    "Modified: 7.8.1997 / 15:00:10 / cg"
! !

!JavaConstantPool class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaConstantPool.st,v 1.4 1997/08/07 13:19:09 cg Exp $'
! !