From fc733248e53df69f9357388143d918356309e5f2 Mon Sep 17 00:00:00 2001 From: Martin Dias Date: Thu, 24 Oct 2024 00:29:57 -0300 Subject: [PATCH] Remove id from BlSpace, BlTask and BlParallelUniverse Also, remove BlUniqueIdGenerator as it is unreferenced now. Fixes #639 --- src/Bloc/BlParallelUniverse.class.st | 12 +---------- src/Bloc/BlSpace.class.st | 26 ---------------------- src/Bloc/BlTask.class.st | 31 ++++++--------------------- src/Bloc/BlUniqueIdGenerator.class.st | 27 ----------------------- 4 files changed, 8 insertions(+), 88 deletions(-) delete mode 100644 src/Bloc/BlUniqueIdGenerator.class.st diff --git a/src/Bloc/BlParallelUniverse.class.st b/src/Bloc/BlParallelUniverse.class.st index 5ac02cffc..2f79036fd 100644 --- a/src/Bloc/BlParallelUniverse.class.st +++ b/src/Bloc/BlParallelUniverse.class.st @@ -5,16 +5,13 @@ I am a parallel Universe. There can exist multiple parallel universes Class { #name : #BlParallelUniverse, #superclass : #Object, - #classTraits : 'TBlEventTarget classTrait', #instVars : [ - 'id', 'deferredActions', 'postponedActions', 'hostClass', 'spaceManager' ], #classVars : [ - 'UniqueIdGenerator', 'Universes', 'UniversesMutex' ], @@ -53,9 +50,9 @@ BlParallelUniverse class >> forHost: aHostClass [ { #category : #'class initialization' } BlParallelUniverse class >> initialize [ + Universes := #(). UniversesMutex := Mutex new. - UniqueIdGenerator := BlUniqueIdGenerator new. SessionManager default registerGuiClassNamed: self name ] @@ -220,18 +217,11 @@ BlParallelUniverse >> hostClass: aHostClass [ hostClass := aHostClass ] -{ #category : #accessing } -BlParallelUniverse >> id [ - - ^ id -] - { #category : #initialization } BlParallelUniverse >> initialize [ super initialize. - id := UniqueIdGenerator generateUniqueId. spaceManager := BlSpaceManager new. hostClass := BlHeadlessHost. deferredActions := WaitfreeQueue new. diff --git a/src/Bloc/BlSpace.class.st b/src/Bloc/BlSpace.class.st index 546da74d3..c15e5d1d0 100644 --- a/src/Bloc/BlSpace.class.st +++ b/src/Bloc/BlSpace.class.st @@ -22,7 +22,6 @@ Class { #traits : 'TBlEventTarget + TBlSpaceProperties + TBlDebug', #classTraits : 'TBlEventTarget classTrait + TBlSpaceProperties classTrait + TBlDebug classTrait', #instVars : [ - 'id', 'host', 'hostSpace', 'extent', @@ -56,9 +55,6 @@ Class { 'userData', 'previousVisibleStatus' ], - #classVars : [ - 'UniqueIdGenerator' - ], #category : #'Bloc-Space' } @@ -83,11 +79,6 @@ BlSpace class >> extractRoots: aSetOfElements [ ^ roots ] -{ #category : #'class initialization' } -BlSpace class >> initialize [ - UniqueIdGenerator := BlUniqueIdGenerator new -] - { #category : #'debug - simulation' } BlSpace class >> locationInside: anElement [ "Return a random space location outside of element bounds" @@ -511,14 +502,6 @@ BlSpace class >> simulateTextInput: aString on: aBlElement [ on: aBlElement ] -{ #category : #'class initialization' } -BlSpace class >> spaceWithId: aSpaceId do: aBlock [ - ^ self allSubInstances - detect: [ :eachSpace | eachSpace id = aSpaceId ] - ifFound: aBlock - ifNone: [ nil ] -] - { #category : #accessing } BlSpace >> asReference [ @@ -1184,20 +1167,11 @@ BlSpace >> icon: aStencil [ self fireEvent: (BlSpaceIconChangedEvent new iconStencil: aStencil) ] -{ #category : #accessing } -BlSpace >> id [ - - - ^ id -] - { #category : #initialization } BlSpace >> initialize [ super initialize. - id := UniqueIdGenerator generateUniqueId. - host := BlHost pickHost. pulseRequested := true. session := Smalltalk session. diff --git a/src/Bloc/BlTask.class.st b/src/Bloc/BlTask.class.st index 844911b07..ccaeb0594 100644 --- a/src/Bloc/BlTask.class.st +++ b/src/Bloc/BlTask.class.st @@ -22,34 +22,17 @@ Class { #traits : 'TBlDebug', #classTraits : 'TBlDebug classTrait', #instVars : [ - 'id', 'state' ], - #classVars : [ - 'UniqueIdGenerator' - ], #category : #'Bloc-Space - Tasks' } -{ #category : #'class initialization' } -BlTask class >> initialize [ - UniqueIdGenerator := BlUniqueIdGenerator new -] - -{ #category : #accessing } -BlTask >> id [ - "Return a unique id of this task" - - - ^ id -] - { #category : #initialization } BlTask >> initialize [ + super initialize. - - id := UniqueIdGenerator generateUniqueId. - state := #new. + + state := #new ] { #category : #'private - state' } @@ -61,7 +44,7 @@ BlTask >> isComplete [ { #category : #'private - state' } BlTask >> isExecuting [ - ^ state = #executing + ^ state == #executing ] { #category : #'private - state' } @@ -122,19 +105,19 @@ BlTask >> setExecuting [ { #category : #'private - state' } BlTask >> setNew [ - state := #new. + state := #new ] { #category : #'private - state' } BlTask >> setPendingExecution [ - state := #pendingExecution. + state := #pendingExecution ] { #category : #'private - state' } BlTask >> setQueued [ - state := #queued. + state := #queued ] { #category : #'api - running' } diff --git a/src/Bloc/BlUniqueIdGenerator.class.st b/src/Bloc/BlUniqueIdGenerator.class.st deleted file mode 100644 index 09cf5c39f..000000000 --- a/src/Bloc/BlUniqueIdGenerator.class.st +++ /dev/null @@ -1,27 +0,0 @@ -Class { - #name : #BlUniqueIdGenerator, - #superclass : #Object, - #instVars : [ - 'mutex', - 'nextUniqueId' - ], - #category : #'Bloc-Space - Support' -} - -{ #category : #accessing } -BlUniqueIdGenerator >> generateUniqueId [ - ^ mutex critical: [ - | uniqueId | - - uniqueId := nextUniqueId. - nextUniqueId := nextUniqueId + 1. - uniqueId ] -] - -{ #category : #initialization } -BlUniqueIdGenerator >> initialize [ - super initialize. - - mutex := Mutex new. - nextUniqueId := 0 -]