Skip to content

Commit

Permalink
Merge pull request #6 from mosckital/4-activity-diagram
Browse files Browse the repository at this point in the history
Added activity diagrams. (#4)
  • Loading branch information
mosckital committed Jun 10, 2020
2 parents ad135be + 853464c commit 028ce28
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 0 deletions.
38 changes: 38 additions & 0 deletions umls/activity_diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Activity Diagram

There are six main activities:

1. The lifecycle of the client
2. The lifecycle of the server
3. C3 Linearisation calculation
4. The CodeLens service
5. The Hover service
6. The Hover Method service

The details of the last three services can be found in the [Use Case Diagram](./use_case_diagram.md).

The following activity diagrams illustrate the details of the above six activities.

## Lifecycle of the client

![Activity diagram for the lifecycle of the client](./pics/activity_diagram/client_lifecycle.png)

## Lifecycle of the server

![Activity diagram for the lifecycle of the server](./pics/activity_diagram/server_lifecycle.png)

## C3 linearisation

![Activity diagram for C3 linearisation calculation](./pics/activity_diagram/c3_linearisation.png)

## CodeLens service

![Activity diagram for the CodeLens service](./pics/activity_diagram/codelens_service.png)

## Hover service

![Activity diagram for the Hover service](./pics/activity_diagram/hover_service.png)

## Hover Method service

![Activity diagram for the Hover Method service](./pics/activity_diagram/hover_method_service.png)
143 changes: 143 additions & 0 deletions umls/activity_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
@startuml client_lifecycle
start
: Load settings from workspace or user input;
: Construct ClientOptions;
: Construct ServerOptions;
: Embed the start of Language Server into the Server Options;
: Construct LanguageClient based on ClientOptions and ServerOptions;
: Push the constructed LanguageClient into <b>context.subscriptions</b>,
so that the client can be correctly disposed when no longer needed;
end
@enduml

@startuml server_lifecycle
start
partition onStartUp {
:create a connection for the server;
:create a text document manager;
:register the listeners for
the relevant state change
events on the connection;
note right
the state change listeners may include:
* onInitialize()
* onInitialized()
* onDidChangeConfiguration()
* onDidClose()
* onDidChangeContent()
* onDidChangeWatchedFiles()
* onCodeLens()
* onCodeLensResolve()
* onHover()
end note
:make the text document manager
listening to the connection;
:let the connection start listening;
}
while (wait for initialisation) is (not received)
endwhile (received)
partition onInitialize {
:extract the settings from the received parameters;
:construct the InitializeResult based on the settings;
note right
the result includes the supported
language features (CodeLens and
Hover in our case) and how the
text document will be synced
end note
:initialise the //jedi wrapper//, the //C3 linearisation node//
and the //calculation cache node//;
:send the InitializeResult back to client;
}
partition onInitialized {
:register listeners to some further state change events
according to the extracted settings;
}
end
@enduml

@startuml c3_linearisation
start
if (the target class is in cache?) is (no) then
:fetch direct parent classes
by using the //jedi// wapper;
while (a parent class has no C3 result?) is (yes)
:calculate C3 linearisation for this parent class
by recursively calling this process;
endwhile (no)
:compute the C3 linearisation of the targe class;
:store the result in cache;
else (yes)
:retrieve result from cache;
endif
:return result;
end
@enduml

@startuml codelens_service
start
if (is the received symbol a class?) is (yes) then
:calculate the MRO list
of the target class
via C3 Linearisation|
:construct results in CodeLens format;
else (no)
:set result to null;
endif
:return results;
end
@enduml

@startuml hover_service
start
if (is the received symbol a class?) then (yes)
:calculate the MRO list
of the target class
via C3 Linearisation|
:construct results in Hover format;
else (no)
if (is the received symbol an object?) then (yes)
if (can resolve the class of the object?) then (yes)
:calculate the MRO list
of the resolved class
via C3 Linearisation|
:construct results in Hover format;
else (no)
:set result to null;
endif
else (no)
:set result to null;
endif
endif
:return results;
end
@enduml

@startuml hover_method_service
start
if (is the received symbol a method?) then (yes)
if (is the method calling from a class?) then (yes)
:calculate the MRO list
of the calling class
via C3 Linearisation|
:construct results in Hover format;
else (no)
if (is the method calling from an object?) then (yes)
if (can resolve the class of the object?) then (yes)
:calculate the MRO list
of the resolved class
via C3 Linearisation|
:construct results in Hover format;
else (no)
:set result to null;
endif
else (no)
:set result to null;
endif
endif
else (no)
:set result to null;
endif
:return results;
end
@enduml
Binary file added umls/pics/activity_diagram/c3_linearisation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added umls/pics/activity_diagram/client_lifecycle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added umls/pics/activity_diagram/codelens_service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added umls/pics/activity_diagram/hover_service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added umls/pics/activity_diagram/server_lifecycle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 028ce28

Please sign in to comment.