Skip to content

Commit

Permalink
recategorize
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Dec 26, 2023
1 parent 14fe122 commit 2f7417f
Show file tree
Hide file tree
Showing 107 changed files with 1,511 additions and 1,326 deletions.
4 changes: 2 additions & 2 deletions src/SimpleRene-Model/ArrayedCollection.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ArrayedCollection }
Extension { #name : 'ArrayedCollection' }

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
ArrayedCollection >> simpleReneCopyWithAll: aCollection [
^ (self species new: self size + aCollection size)
replaceFrom: 1 to: self size with: self startingAt: 1;
Expand Down
4 changes: 2 additions & 2 deletions src/SimpleRene-Model/BlockClosure.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #BlockClosure }
Extension { #name : 'BlockClosure' }

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
BlockClosure >> simpleReneOptionFor: anObject ifPresent: aBlock [
aBlock value: (self cull: anObject)
]
8 changes: 4 additions & 4 deletions src/SimpleRene-Model/Class.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Class }
Extension { #name : 'Class' }

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Class >> label [
"Answer a human-readable name of the receiving class. This implementation tries to be smart and return a nice label, unfortunately for a lot of classes this doesn't work well so subclasses might want to override this method and return soemthing more meaningfull to end-users."

Expand All @@ -9,7 +9,7 @@ Class >> label [
^ self simpleReneLabel
]

{ #category : #'*SimpleRene-Model-configuration' }
{ #category : '*SimpleRene-Model-configuration' }
Class >> simpleReneDescriptionContainer [

"Return the default description container."
Expand All @@ -20,7 +20,7 @@ Class >> simpleReneDescriptionContainer [
yourself
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Class >> simpleReneLabel [
"Answer a human-readable name of the receiving class. This implementation tries to be smart and return a nice label, unfortunately for a lot of classes this doesn't work well so subclasses might want to override this method and return soemthing more meaningfull to end-users."

Expand Down
12 changes: 6 additions & 6 deletions src/SimpleRene-Model/Collection.extension.st
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
Extension { #name : #Collection }
Extension { #name : 'Collection' }

{ #category : #'*SimpleRene-Model-dynopt' }
{ #category : '*SimpleRene-Model-dynopt' }
Collection >> simpleReneAllOptionsFor: aDescription [
^ aDescription prepareOptions: self copy
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Collection >> simpleReneAsMultilineString [
^ String streamContents: [ :stream |
self
do: [ :each | stream nextPutAll: each ]
separatedBy: [ stream nextPut: Character cr ] ]
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Collection >> simpleReneCopyWithAll: aCollection [
^ self copy
addAll: aCollection;
yourself
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Collection >> simpleReneCopyWithoutFirstOccurrenceOf: anObject [
| done |
done := false.
Expand All @@ -30,7 +30,7 @@ Collection >> simpleReneCopyWithoutFirstOccurrenceOf: anObject [
and: [ done := true ] ] ]
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Collection >> simpleReneSelectMatching: aString [
^ self select: [ :e | e asString beginsWith: aString ]
]
4 changes: 2 additions & 2 deletions src/SimpleRene-Model/Dictionary.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Dictionary }
Extension { #name : 'Dictionary' }

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Dictionary >> simpleReneOptionFor: anObject ifPresent: aBlock [
self at: anObject ifPresent: aBlock

Expand Down
4 changes: 2 additions & 2 deletions src/SimpleRene-Model/Integer.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Integer }
Extension { #name : 'Integer' }

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Integer >> asSimpleReneFileSize [
"Return the receiver with the adequate file size identified."

Expand Down
10 changes: 6 additions & 4 deletions src/SimpleRene-Model/ManifestSimpleReneModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
I store metadata for this package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
"
Class {
#name : #ManifestSimpleReneModel,
#superclass : #PackageManifest,
#category : #'SimpleRene-Model-Manifest'
#name : 'ManifestSimpleReneModel',
#superclass : 'PackageManifest',
#category : 'SimpleRene-Model-Manifest',
#package : 'SimpleRene-Model',
#tag : 'Manifest'
}

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestSimpleReneModel class >> ruleRBBadMessageRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#Object #simpleReneLazyInstVarUsing: #false)) #'2019-03-23T09:33:42.523345-04:00') )
]
4 changes: 2 additions & 2 deletions src/SimpleRene-Model/NumberParser.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #NumberParser }
Extension { #name : 'NumberParser' }

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
NumberParser class >> isSimpleReneValidNumber: aStringOrStream [
| stream |
stream := aStringOrStream readStream.
Expand Down
34 changes: 17 additions & 17 deletions src/SimpleRene-Model/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Extension { #name : #Object }
Extension { #name : 'Object' }

{ #category : #'*SimpleRene-Model-accessing' }
{ #category : '*SimpleRene-Model-accessing' }
Object >> basicSimpleReneDescription [
^ SRPragmaBuilder for: self
]

{ #category : #'*SimpleRene-Model-model' }
{ #category : '*SimpleRene-Model-model' }
Object >> initializeSimpleRene [
"Initializes the receiving object with the default values of its description."

Expand All @@ -14,17 +14,17 @@ Object >> initializeSimpleRene [
ifFalse: [ self simpleReneWrite: each default using: each ] ]
]

{ #category : #'*SimpleRene-Model-testing' }
{ #category : '*SimpleRene-Model-testing' }
Object >> isSimpleReneDescription [
^ false
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> isSimpleReneSameAs: rhs [
^ self isSimpleReneSameAs: rhs using: [ self simpleReneDescription ]
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> isSimpleReneSameAs: rhs using: valuableDescription [
"Use #isSameAs: unless you need to cache the description for efficiency.
CAUTION: this may not work if the description depends on the instance e.g. uses `self` in a block
Expand All @@ -42,19 +42,19 @@ Object >> isSimpleReneSameAs: rhs using: valuableDescription [
"Motivation: We cache the description because profiling on a large dataset (120,000 records) showed about 66% of processing time was spent (re)building it"
]

{ #category : #'*SimpleRene-Model-builder' }
{ #category : '*SimpleRene-Model-builder' }
Object >> simpleReneActions [
^ (SRActionPragmaBuilder for: self) children
]

{ #category : #'*SimpleRene-Model-builder' }
{ #category : '*SimpleRene-Model-builder' }
Object >> simpleReneDescription [

^ self basicSimpleReneDescription

]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneDescriptionContainer [

"Return the default description container."
Expand All @@ -65,20 +65,20 @@ Object >> simpleReneDescriptionContainer [
yourself
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneHash [
^ self simpleReneHashUsing: [ self simpleReneDescription ]
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneHashUsing: valuabledescription [
"See isSameAs:using: comments"
^ valuabledescription value children
inject: 0 hash
into: [ :hash :desc | hash bitXor: (desc read: self) hash ]
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneLazyInstVarUsing: description [
"Return the current value of a field as specified by its description. See #lazilyInitializeFrom:for: comment for more info.
- NB: Only works with a selector accessor with matching inst var name e.g. (readSelector = instVarName = #myField). It could be extended to other cases if the need arises."
Expand All @@ -88,14 +88,14 @@ Object >> simpleReneLazyInstVarUsing: description [
^ description lazilyInitializeFrom: currentValue for: self.
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneMementoClass [
"Return a class to be used to remember or cache the receiver, namely a memento object."

^ SRCheckedMemento
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneReadUsing: aDescription [
"This hook is needed so that e.g. mementos and adaptive models can implement their own behavior. All other entry points e.g. MADescription>>#read: should come through here"

Expand All @@ -104,18 +104,18 @@ Object >> simpleReneReadUsing: aDescription [
^ result ifNil: [ aDescription undefinedValue ]
]

{ #category : #'*SimpleRene-Model-description' }
{ #category : '*SimpleRene-Model-description' }
Object class >> simpleReneTemplate [
"Allow subclasses to have a prototype instance for creating a Magritte description (especially reference description)."
^self new
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneValidate [
^ self simpleReneDescription validate: self
]

{ #category : #'*SimpleRene-Model' }
{ #category : '*SimpleRene-Model' }
Object >> simpleReneWrite: anObject using: aDescription [
"This hook is needed so that e.g. mementos and adaptive models can implement their own behavior. All other entry points e.g. MADescription>>#read: should come through here"

Expand Down
28 changes: 15 additions & 13 deletions src/SimpleRene-Model/SRAccessor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,67 @@
I am the abstract superclass to all accessor strategies. Accessors are used to implement different ways of accessing (reading and writing) data from instances using a common protocol: data can be uniformly read and written using ==#readFrom:== respectively ==#write:to:==.
"
Class {
#name : #SRAccessor,
#superclass : #SRObject,
#category : #'SimpleRene-Model-Accessor'
#name : 'SRAccessor',
#superclass : 'SRObject',
#category : 'SimpleRene-Model-Accessor',
#package : 'SimpleRene-Model',
#tag : 'Accessor'
}

{ #category : #converting }
{ #category : 'converting' }
SRAccessor >> asSimpleReneAccessor [
^ self
]

{ #category : #testing }
{ #category : 'testing' }
SRAccessor >> canRead: aModel [
"Test if ==aModel== can be read."

^ false
]

{ #category : #testing }
{ #category : 'testing' }
SRAccessor >> canWrite: aModel [
"Test if ==aModel== can be written."

^ false
]

{ #category : #accessing }
{ #category : 'accessing' }
SRAccessor >> defaultLabelFor: aDescription [
^ aDescription class defaultLabel
]

{ #category : #testing }
{ #category : 'testing' }
SRAccessor >> handlesSelector: aSelector [
^ false

]

{ #category : #accessing }
{ #category : 'accessing' }
SRAccessor >> name [
^ nil
]

{ #category : #printing }
{ #category : 'printing' }
SRAccessor >> printOn: aStream [
self storeOn: aStream
]

{ #category : #model }
{ #category : 'model' }
SRAccessor >> read: aModel [
"Read from ==aModel== using the access-strategy of the receiver."

^ nil
]

{ #category : #printing }
{ #category : 'printing' }
SRAccessor >> storeOn: aStream [
self class storeOn: aStream.
aStream nextPutAll: ' new'
]

{ #category : #model }
{ #category : 'model' }
SRAccessor >> write: anObject to: aModel [
"Write ==anObject== to ==aModel== using the access-strategy of the receiver."
]
Loading

0 comments on commit 2f7417f

Please sign in to comment.