Skip to content

Oplossing & Code

Bart edited this page Jun 13, 2024 · 9 revisions
  • Algemeen hoe we code schrijven -> object oriented
  • Code conventions

Classes & Methods

Class Explanation Methods
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, inherits from Node. Inherits all methods from Node. Additional methods specific to Person can be added here.
Post() extends Node() Represents a social media post in the network, inherits from Node. Inherits all methods from Node. Additional methods specific to Post can be added here.
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. switch(type)

Design rational

Clone this wiki locally