SmallSense__SmalltalkLintAnnotation.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 18 Sep 2013 00:58:49 +0100
changeset 89 8ff5fb2b27bf
parent 86 3b615594edf6
child 127 98c615301608
permissions -rw-r--r--
Improvement in (Smalltalk)EditSupport. After some electric text is inserted, BackSpace will delete the inserted text instead of just last character.

"
 COPYRIGHT (c) 2006 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: 'jv:smallsense' }"

"{ NameSpace: SmallSense }"

Object subclass:#SmalltalkLintAnnotation
	instanceVariableNames:'startPosition endPosition line rule'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Smalltalk-Lint'
!

!SmalltalkLintAnnotation class methodsFor:'documentation'!

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

!SmalltalkLintAnnotation class methodsFor:'instance creation'!

from: start to: end rule: rule

    ^self new
        startPosition: start;
        endPosition: end;
        rule: rule;
        yourself.

    "Created: / 30-01-2012 / 15:23:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SmalltalkLintAnnotation methodsFor:'accessing'!

endPosition
    ^ endPosition
!

endPosition:anInteger
    endPosition := anInteger.
!

line
    ^ line
!

line:anInteger
    line := anInteger.
!

rule
    ^ rule
!

rule:anRBLintRule
    self assert: anRBLintRule isComposite not.
    rule := anRBLintRule.

    "Modified: / 30-01-2012 / 15:22:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

startPosition
    ^ startPosition
!

startPosition:anInteger
    startPosition := anInteger.
! !

!SmalltalkLintAnnotation methodsFor:'comparing'!

< anObject

    anObject isNumber ifTrue:[^startPosition < anObject].
    anObject class == self class ifFalse:[^false].

    ^endPosition < anObject startPosition

    "Created: / 14-02-2010 / 13:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

<= aMagnitude
    "return true, if the argument is greater or equal than the receiver"

    ^ (aMagnitude < self) not
!

= anObject

    anObject class == self class ifFalse:[^false].

    ^startPosition == (anObject startPosition) and:
        [endPosition == (anObject endPosition) and:
            [rule = anObject rule]]

    "Created: / 14-02-2010 / 13:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

> aMagnitude
    "return true, if the argument is less than the receiver"

    ^ aMagnitude < self
!

>= aMagnitude
    "return true, if the argument is less or equal than the receiver"

    ^ (self < aMagnitude) not
! !