CharacterArray.st
changeset 17511 da227974be48
parent 17509 f5e1bb810210
child 17517 7a7bd8c467c7
equal deleted inserted replaced
17510:a56a2f138fc2 17511:da227974be48
  7085 
  7085 
  7086 isNameSpaceSelector
  7086 isNameSpaceSelector
  7087     "Answer true if the receiver contains chars which form a nameSpace selector name.
  7087     "Answer true if the receiver contains chars which form a nameSpace selector name.
  7088      These are of the form ':<ns>::<sel>', where ns is the NameSpace and sel is the regular selector.
  7088      These are of the form ':<ns>::<sel>', where ns is the NameSpace and sel is the regular selector.
  7089      For example, the #+ selector as seen by the Foo namespace would be actually #':Foo::+'.
  7089      For example, the #+ selector as seen by the Foo namespace would be actually #':Foo::+'.
       
  7090      This special format (a symbol starting with a colon) was chosen, because almost every other selector
       
  7091      is legal, and this can be checked quickly by just looking at the first character.    
  7090      You cannot easily change this algorithm here, as it is also known by the VM's lookup function."
  7092      You cannot easily change this algorithm here, as it is also known by the VM's lookup function."
  7091 
  7093 
  7092     |i|
  7094     |i|
  7093 
  7095 
  7094     (self at:1) == $: ifFalse:[^ false].
  7096     (self at:1) == $: ifFalse:[^ false].
       
  7097 
  7095     i := self indexOf:$: startingAt:2.
  7098     i := self indexOf:$: startingAt:2.
  7096     i == 0 ifTrue:[^ false].
  7099     i == 0 ifTrue:[^ false].
  7097     self size <= (i+1) ifTrue:[^ false].
  7100     self size <= (i+1) ifTrue:[^ false].
  7098     (self at:i+1) == $: ifFalse:[^ false].
  7101     (self at:i+1) == $: ifFalse:[^ false].
  7099     (self at:i+2) == $: ifTrue:[^ false].
  7102     (self at:i+2) == $: ifTrue:[^ false].
  7280 ! !
  7283 ! !
  7281 
  7284 
  7282 !CharacterArray class methodsFor:'documentation'!
  7285 !CharacterArray class methodsFor:'documentation'!
  7283 
  7286 
  7284 version
  7287 version
  7285     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.573 2015-02-18 20:30:21 cg Exp $'
  7288     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.574 2015-02-19 10:20:11 cg Exp $'
  7286 !
  7289 !
  7287 
  7290 
  7288 version_CVS
  7291 version_CVS
  7289     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.573 2015-02-18 20:30:21 cg Exp $'
  7292     ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.574 2015-02-19 10:20:11 cg Exp $'
  7290 ! !
  7293 ! !
  7291 
  7294 
  7292 
  7295 
  7293 CharacterArray initialize!
  7296 CharacterArray initialize!