Skip to content

Commit

Permalink
Refactor: clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
nonodev96 committed Jan 24, 2022
1 parent a9c0142 commit 039c3f9
Show file tree
Hide file tree
Showing 84 changed files with 576 additions and 1,412 deletions.
37 changes: 37 additions & 0 deletions UML/THUMDER-core-Auth.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@startuml

skinparam linetype ortho

package Auth #DDDDDD {
class AuthService {
+isLogging$: Subject<boolean>
+userData: InterfaceUser
-subscriptions$: Subscription
-afs: AngularFirestore
-afAuth: AngularFireAuth
-ngZone: NgZone
-router: Router
-toast: ToastrService
-translate: TranslateService
-electronService: ElectronService
+ngOnInit(): void
+ngOnDestroy(): void
+getIsLoggingObservable(): Observable<boolean>
+SignIn(email: any, password: any): Promise<boolean>
+SignUp(email: any, password: any): Promise<void | UserCredential>
+SendVerificationMail(userCredential: UserCredential): Promise<void>
+ForgotPassword(passwordResetEmail: any): Promise<void>
+isLoggedIn: boolean
+GoogleAuth(): Promise<void>
+GithubAuth(): Promise<void>
+AuthLoginAnonymously(): Promise<void>
-AuthLogin(provider: any): Promise<void>
+SignOut(): Promise<void>
+AuthCheckLoginRedirect(): Promise<boolean>
+SetUserData(userCredential: UserCredential): any
-displayMessage(message: string): void
-displayError(error: firebase.FirebaseError): void
}
}

@enduml
52 changes: 25 additions & 27 deletions UML/THUMDER-core-Machine.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

skinparam linetype ortho

namespace Machine #DDDDDD {
package Machine #DDDDDD {
class PixiTHUMDER_Pipeline {
-InstStages_text: PIXI.Text
-IF_text: PIXI.Text
Expand All @@ -16,6 +16,7 @@ namespace Machine #DDDDDD {
-faddEX_count: any
-fmultEX_count: any
-fdivEX_count: any
+reset(faddEX_count: number, fmultEX_count: number, fdivEX_count: number): void
-initTexts(): void
-drawText(object: PIXI.Text, coords: CoordsType): void
-initArrows(): void
Expand All @@ -32,7 +33,6 @@ namespace Machine #DDDDDD {
+update_MEM_text(value: string): void
+update_WB_text(value: string): void
+draw(): PIXI.Container
+reset(faddEX_count: number, fmultEX_count: number, fdivEX_count: number): void
+toString(): string
}
class Position {
Expand All @@ -59,7 +59,6 @@ namespace Machine #DDDDDD {
+draw(): PIXI.Container
+existCell(row: number, col: number): boolean
-getCell(row: number, col: number): PIXI.Container
+debug(): { table: Map<string, PIXI.Container>; }
}
class PixiTHUMDER_CycleClockDiagram {
+realStep: number
Expand All @@ -78,13 +77,13 @@ namespace Machine #DDDDDD {
+borderLeftHeight: number
+reset(): void
-initTables(): void
-drawArrow(arrowDirection: TypeArrowDirection, color?: number): void
-drawBorders(): void
-drawSteps(displayStep?: number): void
-drawInstruction(textValue: string): void
+nextStep(pipeline: TypePipeline, step?: number): void
+addInstruction(text: string): void
+addArrow(instructionArrow: TypeArrowDirection): void
-drawArrow(arrowDirection: TypeArrowDirection, color?: number): void
-drawInstruction(textValue: string): void
-drawSteps(displayStep?: number): void
+moveLeft(): void
+moveRight(): void
+moveTop(): void
Expand Down Expand Up @@ -125,8 +124,8 @@ namespace Machine #DDDDDD {
+reset(): void
}
class ManagerMemory implements InterfaceMemory {
-_memorySizeBytes: number
-_memoryInt8Array: Uint8Array
+_memorySizeBytes: number
+_memoryInt8Array: Uint8Array
+processResponseMachineDirectives(directives: TypeDirectiveData[]): void
+processResponseMachineInstructions(instructions: TypeInstructionsData[]): void
+processMemoryToUpdateArray(response: TypeMemoryToUpdate[]): void
Expand All @@ -148,12 +147,12 @@ namespace Machine #DDDDDD {
-setMemory_stringBinary_ByIndex(index: number, binary_08_16_32_64: string): void
+getAllMemoryWord(): Int32[]
+getAllIndexByWord(): number[]
+reset(): void
+setSize(memorySize: number): void
+getAllMemory(): TypeMemory[]
+reset(newMemorySizeBytes: number): void
}
class ManagerBreakpoints implements InterfaceBreakpoints {
-breakpoints: TypeBreakpoints
+_breakpoints: TypeBreakpoints
+toggleBreakpoint(lineNumber: number): void
+getBreakpoint(lineNumber: number): boolean
+updateManager(breakpoints: TypeBreakpoints): void
Expand All @@ -163,7 +162,7 @@ namespace Machine #DDDDDD {
+reset(): void
}
class ManagerStatistics implements InterfaceDataStatistics {
-_data: TypeDataStatistics
+_data: TypeDataStatistics
+processResponse(response: Partial<TypeDataStatistics>): void
+getData(): TypeDataStatistics
+reset(): void
Expand All @@ -177,7 +176,7 @@ namespace Machine #DDDDDD {
+memory: ManagerMemory
+memorySize: any
+breakpointManager: ManagerBreakpoints
+code: UtilsDataStructures.THUMDER_Map<`0x${string}`, TypeInstructionsData>
+code: UtilsDataStructures.THUMDER_Map<TypeAddress, TypeInstructionsData>
+canSimulate: boolean
-statusMachineInStep: TypeSimulationStep
+isBreakpoint$: Subject<number>
Expand Down Expand Up @@ -230,15 +229,13 @@ namespace Machine #DDDDDD {
+updateRegisterInServer(registersToUpdate: TypeRegisterToUpdate[]): Promise<boolean>
+updateMemoryInServer(memoryToUpdate: TypeMemoryToUpdate[]): Promise<boolean>
+writeToLog(msg: string, level?: EnumLogLevel, params?: TypeLogger[]): void
-stringFormat(msg: string, params: TypeLogger[]): string
-shouldLog(level: EnumLogLevel): boolean
+getCode(address: `0x${string}`): TypeInstructionsData
+getCode(address: TypeAddress): TypeInstructionsData
+getAllStatusMachine(): TypeStatusMachine
+resetConnection(): void
-stringFormat(msg: string, params: TypeLogger[]): string
-shouldLog(level: EnumLogLevel): boolean
-toastMessage(key_title?: string, key_message?: string): Promise<void>
-processResponsePipeline(): void
}

interface InterfaceRegisters {
+PC: Int32
+IMAR: Int32
Expand All @@ -259,32 +256,33 @@ namespace Machine #DDDDDD {
+R: Int32[]
+F: Float32[]
+processRegisterToUpdateArray(response: TypeRegisterToUpdate[]): void
+reset(): void
}
interface InterfaceBreakpoints {
+breakpoints: TypeBreakpoints
+_breakpoints: TypeBreakpoints
+reset(): void
}
interface InterfaceMemory {
+memorySizeBytes: number
+memoryInt8Array: Uint8Array
+_memorySizeBytes: number
+_memoryInt8Array: Uint8Array
+processResponseMachineDirectives(directives: TypeDirectiveData[]): void
+processResponseMachineInstructions(instructions: TypeInstructionsData[]): void
+processMemoryToUpdateArray(response: TypeMemoryToUpdate[]): void
+reset()
+reset(newMemorySizeBytes: number): void
}
interface InterfaceDataStatistics {
+data: TypeDataStatistics
+_data: TypeDataStatistics
+processResponse(response: Partial<TypeDataStatistics>): void
+reset()
}
PixiTHUMDER_Table--*Position
PixiTHUMDER_Pipeline-->PixiTHUMDER_Table
MachineService-->PixiTHUMDER_Pipeline
MachineService-->PixiTHUMDER_CycleClockDiagram
' MachineService-->StorageService
MachineService-->ManagerRegisters
MachineService-->ManagerMemory
MachineService-->ManagerBreakpoints
MachineService-->ManagerStatistics
MachineService--right>ManagerRegisters
MachineService--right>ManagerMemory
MachineService--left>ManagerBreakpoints
MachineService--left>ManagerStatistics
}

@enduml
28 changes: 5 additions & 23 deletions UML/THUMDER-core-services.puml → UML/THUMDER-core-Services.puml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

skinparam linetype ortho


package Services #DDDDDD {
class ElectronService {
+ipcRenderer: Electron.IpcRenderer
Expand Down Expand Up @@ -72,9 +71,9 @@ package Services #DDDDDD {
-UID: string
-httpClient: HttpClient
-afs: AngularFirestore
+initialize(): Promise<number>
+generateDefaultFiles(): Promise<number>
+getInterfaceFileItems(): Observable<InterfaceFileItem[]>
+getAllFilesFromFirestore(): Observable<InterfaceFileItem[]>
+getFileItemsAsObservable(): Observable<InterfaceFileItem[]>
+addFileItem(interfaceFileItem: InterfaceFileItem): Promise<void>
+deleteFileItem(id: string): Promise<void>
+editFileItem(fileItem: InterfaceFileItem, $key: string): Promise<void>
Expand All @@ -101,27 +100,10 @@ package Services #DDDDDD {
-{static} handleErrors(err: any): void
}

class UtilityService {
}

FileSystemService --> FileSystemStorageService
ElectronService -[hidden]- FileSystemService
FileSystemStorageService -[hidden]- Globals
Globals -[hidden]- SocketProviderConnectService
SocketProviderConnectService -[hidden]- UtilityService
' ElectronService -[hidden]- FileSystemService
' FileSystemStorageService -[hidden]- Globals
' Globals -[hidden]- SocketProviderConnectService
}

package Storage #DDDDDD {
class StorageService {
-storageSub: Subject<string>
+watchStorage(): Observable<string>
+getItem(key: string): any
+setItem(key: string, data: any): void
+hasItem(key: string): boolean
+defaultDataInStorage(): void
}
}

Services -[hidden]down- Storage

@enduml
16 changes: 16 additions & 0 deletions UML/THUMDER-core-Storage.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml

skinparam linetype ortho

package Storage #DDDDDD {
class StorageService {
-storageSub: Subject<string>
+watchStorage(): Observable<string>
+getItem(key: string): any
+setItem(key: string, data: any): void
+hasItem(key: string): boolean
+defaultDataInStorage(): void
}
}

@enduml
Loading

0 comments on commit 039c3f9

Please sign in to comment.