Class: ParseJson

ParseJson

new ParseJson()

Class responsible for collecting array of manoeuvre obejcts. This class presents means to parse a JSON file containing manoeuvre break downs, and also to perform and interative search through them using the user's inputs.
Source:

Methods

getManoeuvreArray() → {Array}

A getter function for retreiving the entire list of manoeuvres.
Source:
Returns:
manoeuvreArray Array of manoeuvre objects
Type
Array

init()

Initial function called on startup of page, sets the manoeuvre list into a global variable accessible throughout use of the site. This means instant access at any time, either using the ParseJson#getManoeuvreArray or ParseJson#parseManoeuvreInput methods.
Source:

parseManoeuvreInput() → {Array}

When called, parses user input from OLAN box, and searches through array of manoeuvres for OLAN-matching move. Repeats this for all the space seperated notations in the input.
Source:
Returns:
manoeuvreArray Array of manoeuvre objects
Type
Array

parseManoeuvresFromJSON()

Parses an external JSON file containing all the intstructions for each manoeuvre, and places this into an array of object, with each object containing the OLAN pre and post-fix, the name and a list of manoeuvrable instructions. Sets these objects to a global array.
Source:

parseManoeuvreVarients(varients, postfix, x) → {Integer}

Takes an array of manoeuvre varients, and adds an entire manoeuvre to the application. For each varient, a name, OALn input and list of instructions to draw the maneouvre is added.
Parameters:
Name Type Description
varients Array Varients of each manoeuvre.
postfix String The letter of the manoeuvre that follows from each varient.
x Integer The current number of maneouvres parsed from the JSON file.
Source:
Returns:
x The new number of manoeuvres in the application.
Type
Integer

parseSpacer(spacerInput)

Performs regex on the input of the user's input and looks for parameters to indicates the starting place of the next manoeuvre in the array.
Parameters:
Name Type Description
spacerInput String Entry data from the OLAN box.
Source:

parseVarientComponents(JsonComps)

Creates the array of instructions to construct each maneouvre, and returns this to the application manoeuvre array. Gets each of the individual instructions from the JSON, and then creates a new component object for each.
Parameters:
Name Type Description
JsonComps JSON JSON based component instructions.
Source: