Skip to content
Snippets Groups Projects
Commit 229c0dae authored by peters's avatar peters
Browse files

Task comments

Class Task fully commented ... little mistake fixed in init()
parent a41c2df8
No related branches found
No related tags found
No related merge requests found
...@@ -6,51 +6,87 @@ ...@@ -6,51 +6,87 @@
// //
import Foundation import Foundation
/**
Internal representation of a task at a station.
*/
class Task { class Task {
/// name of the task
private var name : String = "" private var name : String = ""
/// description of the task
private var description : String = "" private var description : String = ""
/// true, if tasked has been solved; otherwise false. Initialized as not solved.
private var solved : Bool = false private var solved : Bool = false
/// true, if this is the final task on a station; otherwise false. Initialized as false. If final task then the task should not be reachable until the other station's task has been solved.
private var isFinal : Bool = false private var isFinal : Bool = false
/**
Constructor
Sets name to standard NO_TASKNAME
Sets description to standard NO_DESCRIPTION
Sets solved to false
*/
init() { init() {
self.name = "NO_TASKNAME" self.name = "NO_TASKNAME"
self.name = "NO_DESCRIPTION" self.description = "NO_DESCRIPTION"
self.solved = false self.solved = false
} }
/**
Set a new name.
- Parameter name: new name for the task
*/
public func setName (name : String) { public func setName (name : String) {
if name.count > 0 { if name.count > 0 {
self.name = name self.name = name
} }
} }
/**
Returns the actual value of the name.
- Returns: name of the task
*/
public func getName() -> String { public func getName() -> String {
return self.name return self.name
} }
/**
Set a new description.
- Parameter description: the new description for the task.
*/
public func setDescription (description : String) { public func setDescription (description : String) {
if description.count > 0 { if description.count > 0 {
self.description = description self.description = description
} }
} }
/**
Returns the description of the task.
- Returns: description of the task
*/
public func getDescription() -> String { public func getDescription() -> String {
return self.description return self.description
} }
/**
Sets the new value for the task as has been solved (true) or not (false).
- Parameter solved: true, if task has been solved; false otherwise.
*/
public func setSolved (solved : Bool) { public func setSolved (solved : Bool) {
self.solved = solved self.solved = solved
} }
/**
Returns, if the task has been solved already.
- Returns: True, if task has been solved; false otherwise.
*/
public func isSolved () -> Bool { public func isSolved () -> Bool {
return self.solved return self.solved
} }
/**
Sets the task to be the final one (true) or not (false).
- Parameter isFinal: true, if this is the final task; false otherwise.
*/
public func setFinal (isFinal : Bool) { public func setFinal (isFinal : Bool) {
self.isFinal = isFinal self.isFinal = isFinal
} }
/**
Returns, if this is the final task of the station. (isFinal already reserved by Swift, so other function name was needed).
- Returns: true, if final task; false otherwise.
*/
public func getIsFinal () -> Bool { public func getIsFinal () -> Bool {
return self.isFinal return self.isFinal
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment