Commit 9a5dcbf3 authored by Bas Lijnse's avatar Bas Lijnse

Some more general refactoring.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@335 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent e75d4263
......@@ -32,7 +32,6 @@ mkParSubTask :: create a subtask with indicated task nr
iTaskId :: generate an id based on the task nr, important for garbage collection and family relation
deleteAllSubTasks :: collects all related tasks
*/
......@@ -40,7 +39,6 @@ mkTask :: !String !(Task a) -> Task a | iCreateAndPrint a
mkParSubTask :: !String !Int (Task a) -> (Task a) | iCreateAndPrint a // two shifts are needed
iTaskId :: !Int !TaskNr !String -> String
deleteAllSubTasks :: ![TaskNr] TSt -> TSt
// general iTask store, session store, page store, store but no form generation
......
......@@ -25,11 +25,7 @@ iTaskId userid tasknr postfix
| userid < 0 = "iLog_" <+++ (taskNrToString tasknr) <+++ "-" <+++ postfix
| otherwise = "iTask_" <+++ (taskNrToString tasknr) <+++ "-" <+++ postfix // MJP:info removed to allow dynamic realloc of users: <+++ "+" <+++ userid
deleteAllSubTasks :: ![TaskNr] TSt -> TSt
deleteAllSubTasks [] tst = tst
deleteAllSubTasks [tx:txs] tst=:{hst,userId}
# hst = deleteIData (iTaskId userId (tl tx) "") hst
= deleteAllSubTasks txs {tst & hst = hst}
// ******************************************************************************************************
// Task creation and printing
......
......@@ -79,6 +79,10 @@ import HSt
// The task monad
:: Task a = Task !(*TSt -> *(!a,!*TSt))
// a task with a label used for labeling buttons, pull down menu, and the like
:: LabeledTask a :== (!String,!Task a)
/**
* Creates an initial task state.
*
......@@ -100,7 +104,19 @@ mkTst :: !UserId !Lifespan !Lifespan !*HSt -> *TSt
* @return The value produced by the task
* @return The modified task state
*/
appTaskTSt :: !(Task a) !*TSt -> (!a,!*TSt)
appTaskTSt :: !(Task a) !*TSt -> (!a,!*TSt)
/**
* Deletes iData states for all subtasks of the given task number.
* This function can be used for ad-hoc garbage collection.
*
* @param The task number of the task which subtasks must be deleted
* @param The task state
*
* @return The task state
*/
deleteAllSubTasks :: ![TaskNr] TSt -> TSt
/**
* Utility function to increment the last segment a task number
......
......@@ -34,6 +34,14 @@ initialOptions location
appTaskTSt :: !(Task a) !*TSt -> (!a,!*TSt)
appTaskTSt (Task fn) tst = fn tst
deleteAllSubTasks :: ![TaskNr] TSt -> TSt
deleteAllSubTasks [] tst = tst
deleteAllSubTasks [tx:txs] tst=:{hst,userId}
# hst = deleteIData (iTaskId userId (tl tx) "") hst
= deleteAllSubTasks txs {tst & hst = hst}
incTaskNr :: !TaskNr -> TaskNr
incTaskNr [] = [0]
incTaskNr [i:is] = [i+1:is]
......
......@@ -22,9 +22,6 @@ derive write Void
//:: Task a // for the end user a Task can be regarded as an abstract data type
:: LabeledTask a :== (!TaskLabel,!Task a) // a Task with a label used for labeling buttons, pull down menu, and the like
:: TaskLabel :== String // a string is used to label tasks
:: Void = Void // for tasks returning non interesting results, won't show up in editors either
// ******************************************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment