diff --git a/source/RecurringEvents-Engine/REOccurrenceRegistration.class.st b/source/RecurringEvents-Engine/REOccurrenceRegistration.class.st deleted file mode 100644 index 5bee334..0000000 --- a/source/RecurringEvents-Engine/REOccurrenceRegistration.class.st +++ /dev/null @@ -1,51 +0,0 @@ -Class { - #name : 'REOccurrenceRegistration', - #superclass : 'Object', - #instVars : [ - 'origin', - 'nextOccurrence' - ], - #category : 'RecurringEvents-Engine', - #package : 'RecurringEvents-Engine' -} - -{ #category : 'ston' } -REOccurrenceRegistration class >> fromStonString: aString [ - ^ STON fromString: aString -] - -{ #category : 'instance creation' } -REOccurrenceRegistration class >> origin: anOrigin nextOccurrence: aDateAndTime [ - ^ self new origin: anOrigin nextOccurrence: aDateAndTime -] - -{ #category : 'ston' } -REOccurrenceRegistration >> asStonString [ - ^ STON toString: self -] - -{ #category : 'accessing' } -REOccurrenceRegistration >> nextOccurrence [ - ^ nextOccurrence -] - -{ #category : 'accessing' } -REOccurrenceRegistration >> origin [ - ^ origin -] - -{ #category : 'accessing' } -REOccurrenceRegistration >> origin: anOrigin nextOccurrence: aDateAndTime [ - origin := anOrigin. - nextOccurrence := aDateAndTime -] - -{ #category : 'printing' } -REOccurrenceRegistration >> printOn: aStream [ - aStream - nextPutAll: (String with: $(). - origin printOn: aStream. - aStream nextPutAll: ' next='. - nextOccurrence printOn: aStream. - aStream nextPutAll: (String with: $)) -] diff --git a/source/RecurringEvents-Engine/RESchedule.class.st b/source/RecurringEvents-Engine/RESchedule.class.st index 4020bec..09e5908 100644 --- a/source/RecurringEvents-Engine/RESchedule.class.st +++ b/source/RecurringEvents-Engine/RESchedule.class.st @@ -3,8 +3,7 @@ Class { #superclass : 'Object', #instVars : [ 'itemsSemaphore', - 'activeItem', - 'origin' + 'activeItem' ], #category : 'RecurringEvents-Engine', #package : 'RecurringEvents-Engine' @@ -15,15 +14,6 @@ RESchedule >> addItem: item [ Transcript show: 'adding element: ' , item asString; cr. ] -{ #category : 'ston' } -RESchedule >> asOccurrenceRegistration [ - "The STON payload that crosses from this schedule-holder to the (local or remote) - scheduler: just the origin identity and the single next occurrence across all items - - never the items/temporal expressions themselves. Answers nil if nothing is scheduled." - self nextOccurrence ifNil: [ ^ nil ]. - ^ REOccurrenceRegistration origin: origin nextOccurrence: self nextOccurrence -] - { #category : 'initialization' } RESchedule >> initialize [ super initialize. @@ -88,16 +78,6 @@ RESchedule >> on: dateAndTime sendMessage: selector to: object [ selector: selector )) ] -{ #category : 'accessing' } -RESchedule >> origin [ - ^ origin -] - -{ #category : 'accessing' } -RESchedule >> origin: anObject [ - origin := anObject -] - { #category : 'enumerating' } RESchedule >> removeItem: item [ Transcript show: 'removing item: ' , item asString; cr. diff --git a/source/RecurringEvents-Tests/REOccurrenceRegistrationTest.class.st b/source/RecurringEvents-Tests/REOccurrenceRegistrationTest.class.st deleted file mode 100644 index bcae4de..0000000 --- a/source/RecurringEvents-Tests/REOccurrenceRegistrationTest.class.st +++ /dev/null @@ -1,37 +0,0 @@ -Class { - #name : 'REOccurrenceRegistrationTest', - #superclass : 'TestCase', - #category : 'RecurringEvents-Tests', - #package : 'RecurringEvents-Tests' -} - -{ #category : 'tests' } -REOccurrenceRegistrationTest >> testEmptyScheduleHasNoRegistration [ - | schedule | - schedule := REScheduleMemory new origin: 'db-99'. - self assert: schedule asOccurrenceRegistration isNil -] - -{ #category : 'tests' } -REOccurrenceRegistrationTest >> testScheduleProducesRegistrationForItsEarliestOccurrence [ - | schedule dur item | - schedule := REScheduleMemory new origin: 'db-42'. - dur := REDurationExpression new duration: (Duration days: 7). - dur instVarNamed: #start put: (DateAndTime year: 2026 month: 1 day: 1). - item := REScheduleItem new. - item instVarNamed: #temporalExpression put: dur. - item event: [ nil ]. - schedule addItem: item. - self assert: schedule asOccurrenceRegistration origin equals: 'db-42'. - self assert: schedule asOccurrenceRegistration nextOccurrence equals: (DateAndTime year: 2026 month: 1 day: 1) -] - -{ #category : 'tests' } -REOccurrenceRegistrationTest >> testStonRoundTrip [ - | reg stonStr backAgain | - reg := REOccurrenceRegistration origin: 'db-42' nextOccurrence: (DateAndTime year: 2026 month: 1 day: 1). - stonStr := reg asStonString. - backAgain := REOccurrenceRegistration fromStonString: stonStr. - self assert: backAgain origin equals: reg origin. - self assert: backAgain nextOccurrence equals: reg nextOccurrence -]