Home Reference Source
public class | source

Validator

Constructor Summary

Public Constructor
public

constructor(set: *)

Member Summary

Public Members
public

Ex1: *

public

Ex2: *

public

Ex3: *

public

Ex4: *

public
public
public

session: *

public

set: *

Class parameters

public
public
public get

Getter for final valid set for exercise generator

public get

Getter for final valid size of the generated bookmarks

Method Summary

Public Methods
public

The function caches imports in local scope for later to be referenced as a string

public

enoughBookmarks(set: *): *

number of bookmarks >= requested number simply generate exercises Assumes the given set has valid minimal sizes for exercises

public

getBookmarks(totalSize: *): *

Ajax get request to the Zeeguu API to get new bookmarks

public

getValidBookMarks(args: *): *

public

isProperEx(exNum,: int, exSize,: int): *

Compares the minimum requirement for the given ex and the assigned amount

public

Number of bookmarks == 0 then show no bookmarks page Signals the generator to terminate, load no bookmark page

public

notEnoughBookmarks(bookmarkLength: *, set: *): Array

Number of bookmarks < requested number, generate exercises that fit

public

validateSet(totalSetLength: *, data: *): Array

Given the set and the bookmarks create a new set for generator Three possibilities: number of bookmarks == 0 then show no bookmarks page number of bookmarks < requested number then generate exercises that fit number of bookmarks >= requested number simply generate exercises

Public Constructors

public constructor(set: *) source

Params:

NameTypeAttributeDescription
set *

Public Members

public Ex1: * source

public Ex2: * source

public Ex3: * source

public Ex4: * source

public data: number source

public loadingAnimation: * source

public session: * source

public set: * source

Class parameters

public totalValidSize: number source

public validFinalSet: *[] source

public get validSet: * source

Getter for final valid set for exercise generator

public get validSize: * source

Getter for final valid size of the generated bookmarks

Public Methods

public cacheExerciseImports() source

The function caches imports in local scope for later to be referenced as a string

public enoughBookmarks(set: *): * source

number of bookmarks >= requested number simply generate exercises Assumes the given set has valid minimal sizes for exercises

Params:

NameTypeAttributeDescription
set *

Return:

*

public getBookmarks(totalSize: *): * source

Ajax get request to the Zeeguu API to get new bookmarks

Params:

NameTypeAttributeDescription
totalSize *

Return:

*

public getValidBookMarks(args: *): * source

Params:

NameTypeAttributeDescription
args *

is matrix of exercise name and number of bookmarks, example: [[1,3],[2,4]] 3 bookmarks for ex1 and 4 bookmarks for ex2

Return:

*

matrix of exercises similar to its input

public isProperEx(exNum,: int, exSize,: int): * source

Compares the minimum requirement for the given ex and the assigned amount

Params:

NameTypeAttributeDescription
exNum, int

the id of the ex

exSize, int

the amount the ex is generated

Return:

*

{boolean}, true if the minReq >= givenAmount, else false

Example:

this.isProperEx(1,2), Ex1 2 times

public noBookmarkPage(): Array source

Number of bookmarks == 0 then show no bookmarks page Signals the generator to terminate, load no bookmark page

Return:

Array

empty array

public notEnoughBookmarks(bookmarkLength: *, set: *): Array source

Number of bookmarks < requested number, generate exercises that fit

Params:

NameTypeAttributeDescription
bookmarkLength *
set *

Return:

Array

set TODO add testing

public validateSet(totalSetLength: *, data: *): Array source

Given the set and the bookmarks create a new set for generator Three possibilities: number of bookmarks == 0 then show no bookmarks page number of bookmarks < requested number then generate exercises that fit number of bookmarks >= requested number simply generate exercises

Params:

NameTypeAttributeDescription
totalSetLength *
data *

Return:

Array

set, the validated ex set