Skip to content

Commit

Permalink
refactoring (coding standards)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna-G committed Jun 17, 2024
1 parent a318921 commit 04bbba4
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/SqueakKara-Core/SKCloverleaf.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #SKCloverleaf,
#superclass : #SKGridObject,
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
Expand Down
2 changes: 1 addition & 1 deletion src/SqueakKara-Core/SKDirection.class.st
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Class {
#name : #SKDirection,
#superclass : #Object,
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
Expand Down
46 changes: 28 additions & 18 deletions src/SqueakKara-Core/SKEnvironment.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Class {
'executer',
'kara'
],
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
#category : #accessing,
#category : #commands,
#'squeak_changestamp' : 'KD 6/12/2024 13:28'
}
SKEnvironment >> close [
Expand All @@ -24,17 +24,19 @@ SKEnvironment >> close [

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:22'
#'squeak_changestamp' : 'JJG 6/17/2024 16:40'
}
SKEnvironment >> executer [

^ executer
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:22'
#'squeak_changestamp' : 'JJG 6/17/2024 16:40'
}
SKEnvironment >> executer: anObject [

executer := anObject
]

Expand All @@ -49,28 +51,30 @@ SKEnvironment >> executionSpeed: aSpeed [

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:22'
#'squeak_changestamp' : 'JJG 6/17/2024 16:40'
}
SKEnvironment >> grid [

^ grid
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:22'
#'squeak_changestamp' : 'JJG 6/17/2024 16:40'
}
SKEnvironment >> grid: anObject [

grid := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 18:36'
#category : #initialization,
#'squeak_changestamp' : 'JJG 6/17/2024 16:40'
}
SKEnvironment >> initialize [


self grid: (SKGrid newWithExtent: 7@7).
self grid: (SKGrid newWithExtent: 7 @ 7).
self kara: self grid challenge1.
self workspace: (SKWorkspace newWithKara: self kara).
self executer: (SKExecuter new).
Expand All @@ -79,22 +83,24 @@ SKEnvironment >> initialize [

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:28'
#'squeak_changestamp' : 'JJG 6/17/2024 16:41'
}
SKEnvironment >> kara [

^ kara
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:28'
#'squeak_changestamp' : 'JJG 6/17/2024 16:41'
}
SKEnvironment >> kara: anObject [

kara := anObject
]

{
#category : #accessing,
#category : #commands,
#'squeak_changestamp' : 'KD 6/12/2024 13:29'
}
SKEnvironment >> pause [
Expand All @@ -103,7 +109,7 @@ SKEnvironment >> pause [
]

{
#category : #accessing,
#category : #commands,
#'squeak_changestamp' : 'KD 6/12/2024 13:29'
}
SKEnvironment >> resume [
Expand All @@ -112,27 +118,31 @@ SKEnvironment >> resume [
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 12:08'
#category : #commands,
#'squeak_changestamp' : 'JJG 6/17/2024 16:41'
}
SKEnvironment >> run [

|code|

code := self workspace userCode.
self executer execute: code.
self executer execute: code
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:22'
#'squeak_changestamp' : 'JJG 6/17/2024 16:41'
}
SKEnvironment >> workspace [

^ workspace
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 11:22'
#'squeak_changestamp' : 'JJG 6/17/2024 16:41'
}
SKEnvironment >> workspace: anObject [

workspace := anObject
]
7 changes: 4 additions & 3 deletions src/SqueakKara-Core/SKExecuteContext.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Class {
'right',
'left'
],
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
Expand All @@ -20,7 +20,7 @@ SKExecuteContext class >> create: aKara [
]

{
#category : #'as yet unclassified',
#category : #initialization,
#'squeak_changestamp' : 'KD 6/12/2024 12:35'
}
SKExecuteContext >> initialize [
Expand All @@ -31,8 +31,9 @@ SKExecuteContext >> initialize [

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 12:26'
#'squeak_changestamp' : 'JJG 6/17/2024 16:40'
}
SKExecuteContext >> kara: anObject [

kara := anObject
]
64 changes: 32 additions & 32 deletions src/SqueakKara-Core/SKExecuter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,77 @@ Class {
'process',
'speed'
],
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
#category : #execution,
#'squeak_changestamp' : 'KD 6/12/2024 12:29'
#'squeak_changestamp' : 'JJG 6/17/2024 16:36'
}
SKExecuter >> codeContext [

^ (SKExecuteContext new kara: self kara).
^ (SKExecuteContext new kara: self kara)
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/5/2024 17:28'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> codeString [

^ codeString
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/5/2024 17:28'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> codeString: anObject [

codeString := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/5/2024 18:08'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> compiler [

^ compiler
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/5/2024 18:08'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> compiler: anObject [

compiler := anObject
]

{
#category : #execution,
#'squeak_changestamp' : 'KD 6/12/2024 18:24'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> execute: aCode [

self codeString: aCode.
"self suspendExecution. geht gerade nicht aber wär schon wenn der aktuelle Prozess beendet würde bevor ein neuer ausgeführt wird"
self process: [self executeBlock: aCode] fork.
self process: [self executeBlock: aCode] fork

]

{
#category : #execution,
#'squeak_changestamp' : 'KD 6/12/2024 12:32'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> executeBlock: aBlock [

^ compiler evaluate: aBlock for: (self codeContext).
^ compiler evaluate: aBlock for: (self codeContext)
]

{
#category : #'initialize-release',
#category : #initialization,
#'squeak_changestamp' : 'KD 6/12/2024 12:14'
}
SKExecuter >> initialize [
Expand All @@ -88,43 +92,47 @@ SKExecuter >> initialize [

{
#category : #accessing,
#'squeak_changestamp' : 'EB 6/11/2024 10:17'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> kara [

^ kara
]

{
#category : #accessing,
#'squeak_changestamp' : 'EB 6/11/2024 10:17'
#'squeak_changestamp' : 'JJG 6/17/2024 16:38'
}
SKExecuter >> kara: anObject [

kara := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/10/2024 08:41'
#'squeak_changestamp' : 'JJG 6/17/2024 16:38'
}
SKExecuter >> process [

^ process
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/10/2024 08:41'
#'squeak_changestamp' : 'JJG 6/17/2024 16:38'
}
SKExecuter >> process: anObject [

process := anObject
]

{
#category : #execution,
#'squeak_changestamp' : 'KD 6/12/2024 13:32'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> resumeExecution [

(self process isTerminated not) ifTrue: [self process resume].
(self process isTerminated not) ifTrue: [self process resume]
]

{
Expand All @@ -147,37 +155,29 @@ SKExecuter >> speed: aSpeed [

{
#category : #execution,
#'squeak_changestamp' : 'KD 6/12/2024 12:12'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> step [

self stepTime > 0
ifTrue: [(Delay forMilliseconds: self stepTime) wait.]
ifTrue: [(Delay forMilliseconds: self stepTime) wait]

]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/12/2024 12:15'
#'squeak_changestamp' : 'JJG 6/17/2024 16:38'
}
SKExecuter >> stepTime [

^ (1000 / self speed) floor.
]

{
#category : #accessing,
#'squeak_changestamp' : 'KD 6/10/2024 08:41'
}
SKExecuter >> stepTime: anObject [
stepTime := anObject
^ (1000 / self speed) floor
]

{
#category : #execution,
#'squeak_changestamp' : 'KD 6/12/2024 15:01'
#'squeak_changestamp' : 'JJG 6/17/2024 16:37'
}
SKExecuter >> suspendExecution [

((self process isTerminated not) and: (self process isSuspended not)) ifTrue: [process suspend].
((self process isTerminated not) and: (self process isSuspended not)) ifTrue: [process suspend]
]
2 changes: 1 addition & 1 deletion src/SqueakKara-Core/SKGrid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Class {
'gridCoordinator',
'scaleFactor'
],
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
Expand Down
2 changes: 1 addition & 1 deletion src/SqueakKara-Core/SKGridCoordinator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Class {
'grid',
'gridMatrix'
],
#category : #SqueakKara-Core
#category : #'SqueakKara-Core'
}

{
Expand Down
Loading

0 comments on commit 04bbba4

Please sign in to comment.