Object subclass: #Simulator instanceVariableNames: 'tasks mem args cmds n lines rws' classVariableNames: 'singleton' poolDictionaries: '' category: nil ! Simulator comment: 'I am a representation of a virtual memory simulator' ! !Simulator class methodsFor: 'instance creation'! new | r | r := super new. r init. "Bind the new simulator into the singleton" singleton := r. ^r ! ! !Simulator class methodsFor: 'singleton access'! checkSingleton singleton ifNil: [ ^self error: 'Singleton not initialized' ]. ! start: pid self checkSingleton. ^singleton start pid. ! terminate: pid self checkSingleton. ^singleton terminate pid. ! memory self checkSingleton. ^singleton memory. ! tasks self checkSingleton. ^singleton tasks. ! args self checkSingleton. ^singleton args. ! ! !Simulator class methodsFor: 'debugging'! debug: aString (self args verbose) ifTrue: [ aString displayNl ]. ! ! !Simulator class methodsFor: 'simulation'! run self new. singleton run. ! !