forked from responsibleIT/Social-Network-Simulation
-
Notifications
You must be signed in to change notification settings - Fork 1
Oplossing & Code
Joppe Koops edited this page Jun 20, 2024
·
9 revisions
- Algemeen hoe we code schrijven -> object oriented
- Code conventions
| Class | Explanation | Methods |
|---|---|---|
App() |
Initializes and manages the main application logic. |
calculatePostPopularity(numOfReaders), calculatePersonPopularity(numOfFriends, numOfInfoRefs), resizeCanvas(), findAllConnectedComponents(), resizeNodes(nodes), drawRandom(label, count, userData), spawnNode(evt), setEventListeners(node), getMousePosOnCanvas(canvas, e, scroll), showNodeDataContainer(nodeData), getNodesWithReaders(nodes), showMobile(nodeData), updateFriendsList(nodeData, node), addFriendToFriendList(friendsUl, friend, nodeData), updateAddFriendsList(nodeData), addFriendToAddFriendList(friendsUl, friend, nodeData), updateFeedList(nodeData), addPostToFeedList(feedUl, item, nodeData), updateLikedList(nodeData), deleteButtonLikes.click, addPostToLikedList(likedUl, item, nodeData), checkInfoLinkRefs(nodeId), showPreLink(from), selectNode(node), deselectNode(), calculateAdjustedClosenessCentrality(), bfsShortestPath(graph, startNode), stepAllNodes(), framelooper(), navigateToPage(pageId)
|
Node() |
Represents a node in the network. |
draw(context), switch(state), linkHandler(node), friendsHandler(friendNode), itemHandler(item)
|
Person() extends Node()
|
Represents a person in the network. |
readSocialMediaPost(nodes, links), forwardSocialMediaPost(links), receiveSocialMediaPost(sender, post, relationshipScore, links), calculateScore(myScore, post), manageRelationships(links), addFriendThroughContent(links), moveNode(links), moveLinks(links), findLink(node, links), step(nodes, links), spawnForwardButtons(links, filteredEdges), removeForwardButtons(), addFriend(node, links, score), removeFriend(node, links), addItemLink(item, from, links, score), removeItemLink(item, links), addInfoLink(from, to, links, score), removeInfoLink(from, to, links)
|
Post() extends Node()
|
Represents a social media post in the network. | |
Edge() |
Represents an edge (connection) between two nodes. |
drawLink(startPoint, endPoint), calcAngle(pointA, pointB)
|
UserData() |
Handles user data and post data, fetching both fake and real data from APIs. |
fetchUserData(url), get(key), getPosts(userId), fetchPostData(postId), fetchRealPostData(postId), xmlToJson(xml), filter(criteria), reduce(callback, initialValue)
|
WebData() |
Manages web-related data like battery status and time updates. |
updateBatteryStatus(status), getBatteryStatus(), updateTime()
|
FileHandler() |
Handles importing and exporting of network data. |
mapToArray(map), export(nodes), import(nodes, links)
|
Cursor() |
Manages cursor state and appearance. | |
Onboarding() |
Handles the onboarding process for new users. |
-
📄 Debrief
-
🧑🎨 Design
-
🧑💻 Solution & Code
- 🎛️ App (main file)
- 🤖 Simulation
- 🔵 Node
- 🙋 Person
- 📰 Post
- 〰️ Edge
↖️ Cursor- 💽 userData
- 📊 WebData
- 📂 Import & Export (FileHandler)
- Onboarding