MethodChange.st
author Claus Gittinger <cg@exept.de>
Tue, 07 Dec 1999 16:36:18 +0100
changeset 852 1acd7d3ed3fc
parent 850 5efe4b98c509
child 896 035d5613a20c
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1993 by Claus Gittinger
	       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.
"

ClassChange subclass:#MethodChange
	instanceVariableNames:'selector methodCategory privacy'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Changes'
!

!MethodChange class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1993 by Claus Gittinger
	       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
"
    instances represent method-changes (as done in the browser). 
    They are typically held in a ChangeSet.

    [author:]
        Claus Gittinger
"
! !

!MethodChange class methodsFor:'instance creation'!

class:cls selector:sel source:src category:cat
    ^ self basicNew class:cls selector:sel source:src category:cat
! !

!MethodChange methodsFor:'accessing'!

changeMethod
    |cls|

    cls := self changeClass.
    cls isNil ifTrue:[^ nil].
    ^ cls compiledMethodAt:selector 

    "Created: / 7.2.1998 / 19:47:53 / cg"
!

changeSelector
    ^ selector

    "Created: / 6.2.1998 / 13:29:25 / cg"
!

class:cls selector:sel source:src category:cat
    className := cls name.
    selector := sel.
    source := src.
    methodCategory := cat
!

className:clsName selector:sel source:src category:cat
    className := clsName.
    selector := sel.
    source := src.
    methodCategory := cat

    "Created: / 16.2.1998 / 12:29:49 / cg"
!

className:clsName selector:sel source:src category:cat privacy:priv
    className := clsName.
    selector := sel.
    source := src.
    methodCategory := cat.
    privacy := priv.

    "Created: / 16.2.1998 / 12:29:49 / cg"
    "Modified: / 16.2.1998 / 14:28:12 / cg"
!

methodCategory
    ^ methodCategory

    "Created: / 7.2.1998 / 19:47:53 / cg"
!

selector
    ^ selector

    "Created: / 6.2.1998 / 13:29:25 / cg"
! !

!MethodChange methodsFor:'applying'!

apply
    "apply the change"

    |class|

    class := Smalltalk classNamed:className.
    class compile:source classified:methodCategory logged:true.


! !

!MethodChange methodsFor:'comparing'!

isForSameAs:changeB
    "return true, if the given change represents a change for the same
     thingy as the receiver (i.e. same method, same definition etc.)."

    "/ I am a methodChange - B must be as well.
    changeB isMethodChange ifFalse:[^ false].   

    className ~= changeB className ifTrue:[^ false].
    selector ~= changeB selector ifTrue:[^ false].

    ^ true




!

sameAs:changeB
    "return true, if the given change represents the same change as the receiver."

    (self isForSameAs:changeB) ifFalse:[^ false].   
    ^ self sameSourceAs:changeB




! !

!MethodChange methodsFor:'printing'!

printOn:aStream
    "append a user printed representation of the receiver to aStream.
     The format is suitable for a human - not meant to be read back."

    aStream nextPutAll:className; 
                 space; 
            nextPutAll:selector 
!

printWithoutClassOn:aStream
    (className endsWith:' class') ifTrue:[
        aStream nextPutAll:'class '
    ].
    aStream nextPutAll:selector 
! !

!MethodChange methodsFor:'queries'!

isMethodChange
    ^ true

    "Created: / 7.2.1998 / 19:26:59 / cg"
! !

!MethodChange class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.23 1999-12-07 15:36:02 cg Exp $'
! !