identifier
stringlengths
0
89
parameters
stringlengths
0
399
return_statement
stringlengths
0
982
docstring
stringlengths
10
3.04k
docstring_summary
stringlengths
0
3.04k
function
stringlengths
13
25.8k
function_tokens
sequence
start_point
sequence
end_point
sequence
argument_list
null
language
stringclasses
3 values
docstring_language
stringclasses
4 values
docstring_language_predictions
stringclasses
4 values
is_langid_reliable
stringclasses
2 values
is_langid_extra_reliable
bool
1 class
type
stringclasses
9 values
CreateDevices
()
null
################################################ Step 2 - Deviceobjekte anlegen, Trigger erzeugen und Datenpunktrefresh initieren
################################################ Step 2 - Deviceobjekte anlegen, Trigger erzeugen und Datenpunktrefresh initieren
async function CreateDevices() { if (logging) log("Reaching CreateDevices "); let z = 0; for (let x in AllDevicesRaw) { for (let y in DefineDevice) { if (AllDevicesRaw[x].model == DefineDevice[y].model) { log("Now creating device for " + AllDevicesRaw[x].model + " / " + AllDevicesRaw[x].did + " / " + AllDevicesRaw[x].localip + " / " + AllDevicesRaw[x].token + " / " + refresh); device[z] = mihome.device({ id: AllDevicesRaw[x].did, // required, device id model: AllDevicesRaw[x].model, // required, device model "zhimi.airpurifier.mb3" address: AllDevicesRaw[x].localip, // miio-device option, local ip address token: AllDevicesRaw[x].token, // miio-device option, device token 4ff8a96292d0451c5148142a0a851e4f refresh: refresh // miio-device option, device properties refresh interval in ms }); device[z].model = AllDevicesRaw[x].model; device[z].setter = DefineDevice[y].setter; device[z].olddata = {}; device[z].definition = DefineDevice[y]; log("Created device " + JSON.stringify(device[z]) + " now fetching data"); await device[z].init(); // connect to device and poll for properties log("Init Device# " + z + " - device=" + JSON.stringify(device[z].model)); z++; }; }; }; for (let i in device) { log("Setting trigger #" + i + " for " + device[i].model); device[i].on('properties', (data) => { device[i].data = data; if (JSON.stringify(device[i].data) !== JSON.stringify(device[i].olddata)) {//Nur refreshen bei Datenänderung RefreshDps(i); }; device[i].olddata = device[i].data; }); }; onStop(function () { //Bei Scriptende alle Devices löschen for (let x in device) { device[x].destroy(); }; unsubscribe('properties'); }, 10); }
[ "async", "function", "CreateDevices", "(", ")", "{", "if", "(", "logging", ")", "log", "(", "\"Reaching CreateDevices \"", ")", ";", "let", "z", "=", "0", ";", "for", "(", "let", "x", "in", "AllDevicesRaw", ")", "{", "for", "(", "let", "y", "in", "DefineDevice", ")", "{", "if", "(", "AllDevicesRaw", "[", "x", "]", ".", "model", "==", "DefineDevice", "[", "y", "]", ".", "model", ")", "{", "log", "(", "\"Now creating device for \"", "+", "AllDevicesRaw", "[", "x", "]", ".", "model", "+", "\" / \"", "+", "AllDevicesRaw", "[", "x", "]", ".", "did", "+", "\" / \"", "+", "AllDevicesRaw", "[", "x", "]", ".", "localip", "+", "\" / \"", "+", "AllDevicesRaw", "[", "x", "]", ".", "token", "+", "\" / \"", "+", "refresh", ")", ";", "device", "[", "z", "]", "=", "mihome", ".", "device", "(", "{", "id", ":", "AllDevicesRaw", "[", "x", "]", ".", "did", ",", "// required, device id", "model", ":", "AllDevicesRaw", "[", "x", "]", ".", "model", ",", "// required, device model \"zhimi.airpurifier.mb3\"", "address", ":", "AllDevicesRaw", "[", "x", "]", ".", "localip", ",", "// miio-device option, local ip address", "token", ":", "AllDevicesRaw", "[", "x", "]", ".", "token", ",", "// miio-device option, device token 4ff8a96292d0451c5148142a0a851e4f", "refresh", ":", "refresh", "// miio-device option, device properties refresh interval in ms", "}", ")", ";", "device", "[", "z", "]", ".", "model", "=", "AllDevicesRaw", "[", "x", "]", ".", "model", ";", "device", "[", "z", "]", ".", "setter", "=", "DefineDevice", "[", "y", "]", ".", "setter", ";", "device", "[", "z", "]", ".", "olddata", "=", "{", "}", ";", "device", "[", "z", "]", ".", "definition", "=", "DefineDevice", "[", "y", "]", ";", "log", "(", "\"Created device \"", "+", "JSON", ".", "stringify", "(", "device", "[", "z", "]", ")", "+", "\" now fetching data\"", ")", ";", "await", "device", "[", "z", "]", ".", "init", "(", ")", ";", "// connect to device and poll for properties", "log", "(", "\"Init Device# \"", "+", "z", "+", "\" - device=\"", "+", "JSON", ".", "stringify", "(", "device", "[", "z", "]", ".", "model", ")", ")", ";", "z", "++", ";", "}", ";", "}", ";", "}", ";", "for", "(", "let", "i", "in", "device", ")", "{", "log", "(", "\"Setting trigger #\"", "+", "i", "+", "\" for \"", "+", "device", "[", "i", "]", ".", "model", ")", ";", "device", "[", "i", "]", ".", "on", "(", "'properties'", ",", "(", "data", ")", "=>", "{", "device", "[", "i", "]", ".", "data", "=", "data", ";", "if", "(", "JSON", ".", "stringify", "(", "device", "[", "i", "]", ".", "data", ")", "!==", "JSON", ".", "stringify", "(", "device", "[", "i", "]", ".", "olddata", ")", ")", "{", "//Nur refreshen bei Datenänderung", "RefreshDps", "(", "i", ")", ";", "}", ";", "device", "[", "i", "]", ".", "olddata", "=", "device", "[", "i", "]", ".", "data", ";", "}", ")", ";", "}", ";", "onStop", "(", "function", "(", ")", "{", "//Bei Scriptende alle Devices löschen", "for", "(", "let", "x", "in", "device", ")", "{", "device", "[", "x", "]", ".", "destroy", "(", ")", ";", "}", ";", "unsubscribe", "(", "'properties'", ")", ";", "}", ",", "10", ")", ";", "}" ]
[ 242, 0 ]
[ 290, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
onUsersListClick
(event)
null
Bei einem Klick auf eines der User li soll mit einem neuen fetch die Detailinformation zu dem User geholt werden. 1 -> 'user/1.json' Detailinformationen im div#user-detail
Bei einem Klick auf eines der User li soll mit einem neuen fetch die Detailinformation zu dem User geholt werden. 1 -> 'user/1.json' Detailinformationen im div#user-detail
function onUsersListClick(event) { if (event.target.dataset.userId !== undefined) { const id = event.target.dataset.userId; fetch(`json/${id}.json`) .then(function (response) { if (response.ok) { const detail = document.querySelector('#user-detail'); detail.classList.remove('warning'); return response.json(); } else { throw new Error( `Fehler beim Holen von Detailinformation (Statuscode: ${response.status} ${response.statusText})` ); } }) .then(function (user) { document.querySelector( '#user-detail' ).textContent = `Der User mit der ID ${user.id} heißt ${user.name}, ist ${user.age} Jahre alt und hat die Haarfarbe ${user.hairColor}.`; }) .catch(function (error) { const detail = document.querySelector('#user-detail'); detail.textContent = error.message; detail.classList.add('warning'); }); } }
[ "function", "onUsersListClick", "(", "event", ")", "{", "if", "(", "event", ".", "target", ".", "dataset", ".", "userId", "!==", "undefined", ")", "{", "const", "id", "=", "event", ".", "target", ".", "dataset", ".", "userId", ";", "fetch", "(", "`", "${", "id", "}", "`", ")", ".", "then", "(", "function", "(", "response", ")", "{", "if", "(", "response", ".", "ok", ")", "{", "const", "detail", "=", "document", ".", "querySelector", "(", "'#user-detail'", ")", ";", "detail", ".", "classList", ".", "remove", "(", "'warning'", ")", ";", "return", "response", ".", "json", "(", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "`", "${", "response", ".", "status", "}", "${", "response", ".", "statusText", "}", "`", ")", ";", "}", "}", ")", ".", "then", "(", "function", "(", "user", ")", "{", "document", ".", "querySelector", "(", "'#user-detail'", ")", ".", "textContent", "=", "`", "${", "user", ".", "id", "}", "{u", "ser.", "n", "ame}", ",", "{u", "ser.", "a", "ge}", " ", "{u", "ser.", "h", "airColor}", ".", ";", "\r", "}", ")", ".", "catch", "(", "function", "(", "error", ")", "{", "const", "detail", "=", "document", ".", "querySelector", "(", "'#user-detail'", ")", ";", "detail", ".", "textContent", "=", "error", ".", "message", ";", "detail", ".", "classList", ".", "add", "(", "'warning'", ")", ";", "}", ")", ";", "}", "}" ]
[ 39, 0 ]
[ 66, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
( limit, upper )
null
getDateLimit Set the min or max date based on `upper` being truthy or falsey.
getDateLimit Set the min or max date based on `upper` being truthy or falsey.
function( limit, upper ) { // If it's the upper limit if ( upper ) { // Set the max date DATE_MAX = createBoundaryDate( limit, upper ) // If focused month is more than max date set it to max date if ( MONTH_FOCUSED.TIME > DATE_MAX.TIME ) { MONTH_FOCUSED = DATE_MAX } } // Otherwise it's the lower limit else { // So set the min date DATE_MIN = createBoundaryDate( limit ) // If focused month is less than min date set it to min date if ( MONTH_FOCUSED.TIME < DATE_MIN.TIME ) { MONTH_FOCUSED = DATE_MIN } } // Render a new calendar calendarRender() return P }
[ "function", "(", "limit", ",", "upper", ")", "{", "// If it's the upper limit", "if", "(", "upper", ")", "{", "// Set the max date", "DATE_MAX", "=", "createBoundaryDate", "(", "limit", ",", "upper", ")", "// If focused month is more than max date set it to max date", "if", "(", "MONTH_FOCUSED", ".", "TIME", ">", "DATE_MAX", ".", "TIME", ")", "{", "MONTH_FOCUSED", "=", "DATE_MAX", "}", "}", "// Otherwise it's the lower limit", "else", "{", "// So set the min date", "DATE_MIN", "=", "createBoundaryDate", "(", "limit", ")", "// If focused month is less than min date set it to min date", "if", "(", "MONTH_FOCUSED", ".", "TIME", "<", "DATE_MIN", ".", "TIME", ")", "{", "MONTH_FOCUSED", "=", "DATE_MIN", "}", "}", "// Render a new calendar", "calendarRender", "(", ")", "return", "P", "}" ]
[ 332, 34 ]
[ 362, 21 ]
null
javascript
de
['de', 'de', 'de']
False
true
pair
captainsLogPlugin
(babel)
null
Ich habe etwas experimentiert. Die Pointe: Der Weg ist immer über das Definitions
Ich habe etwas experimentiert. Die Pointe: Der Weg ist immer über das Definitions
function captainsLogPlugin(babel) { const { types: t } = babel; return { name: 'captains-log', visitor: { VariableDeclaration(path) { console.log(path.node.declarations[0].id.name); const varName = path.node.declarations[0].id.name; path.insertAfter( t.callExpression(t.identifier('console'), [ t.identifier('log'), ]) ); }, }, }; }
[ "function", "captainsLogPlugin", "(", "babel", ")", "{", "const", "{", "types", ":", "t", "}", "=", "babel", ";", "return", "{", "name", ":", "'captains-log'", ",", "visitor", ":", "{", "VariableDeclaration", "(", "path", ")", "{", "console", ".", "log", "(", "path", ".", "node", ".", "declarations", "[", "0", "]", ".", "id", ".", "name", ")", ";", "const", "varName", "=", "path", ".", "node", ".", "declarations", "[", "0", "]", ".", "id", ".", "name", ";", "path", ".", "insertAfter", "(", "t", ".", "callExpression", "(", "t", ".", "identifier", "(", "'console'", ")", ",", "[", "t", ".", "identifier", "(", "'log'", ")", ",", "]", ")", ")", ";", "}", ",", "}", ",", "}", ";", "}" ]
[ 2, 0 ]
[ 18, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
print
(messages)
null
/* Mehrere Nachrichten drucken
/* Mehrere Nachrichten drucken
function print(messages) { messages.forEach((message) => { console.log(message); }); }
[ "function", "print", "(", "messages", ")", "{", "messages", ".", "forEach", "(", "(", "message", ")", "=>", "{", "console", ".", "log", "(", "message", ")", ";", "}", ")", ";", "}" ]
[ 38, 0 ]
[ 42, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
addTestdaten
()
null
Testdaten in das Anzeigeformular einfügen
Testdaten in das Anzeigeformular einfügen
function addTestdaten() { $('#Address_firstname').val('Klaus') $('#Address_lastname').val('Mergen') $('#Address_street1').val('Andeler Weg 1a') $('#Address_postcode').val('54470') $('#Address_city').val('Bernkastel-Kues') }
[ "function", "addTestdaten", "(", ")", "{", "$", "(", "'#Address_firstname'", ")", ".", "val", "(", "'Klaus'", ")", "$", "(", "'#Address_lastname'", ")", ".", "val", "(", "'Mergen'", ")", "$", "(", "'#Address_street1'", ")", ".", "val", "(", "'Andeler Weg 1a'", ")", "$", "(", "'#Address_postcode'", ")", ".", "val", "(", "'54470'", ")", "$", "(", "'#Address_city'", ")", ".", "val", "(", "'Bernkastel-Kues'", ")", "}" ]
[ 2, 4 ]
[ 8, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
text_animation
()
null
Wilkommen zum Cyber-RPG
Wilkommen zum Cyber-RPG
async function text_animation(){ var text = ['W', 'Wi', 'Wil', 'Wilk', 'Wilko', 'Wikom', 'Wilkomm', 'Wilkomme', 'Wilkommen', 'Wilkommen ', 'Wilkommen z', 'Wilkommen zu', 'Wilkommen zum', 'Wilkommen zum C', 'Wilkommen zum Cyb', 'Wilkommen zum Cybe','Wilkommen zum Cyber','Wilkommen zum Cyber-','Wilkommen zum Cyber-R','Wilkommen zum Cyber-RP','Wilkommen zum Cyber-RPG']; element_hmain.innerHTML = ""; for (let i=0; i < 21; i++){ element_hmain.innerHTML = text[i]; await sleep(100); } }
[ "async", "function", "text_animation", "(", ")", "{", "var", "text", "=", "[", "'W'", ",", "'Wi'", ",", "'Wil'", ",", "'Wilk'", ",", "'Wilko'", ",", "'Wikom'", ",", "'Wilkomm'", ",", "'Wilkomme'", ",", "'Wilkommen'", ",", "'Wilkommen '", ",", "'Wilkommen z'", ",", "'Wilkommen zu'", ",", "'Wilkommen zum'", ",", "'Wilkommen zum C'", ",", "'Wilkommen zum Cyb'", ",", "'Wilkommen zum Cybe'", ",", "'Wilkommen zum Cyber'", ",", "'Wilkommen zum Cyber-'", ",", "'Wilkommen zum Cyber-R'", ",", "'Wilkommen zum Cyber-RP'", ",", "'Wilkommen zum Cyber-RPG'", "]", ";", "element_hmain", ".", "innerHTML", "=", "\"\"", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "21", ";", "i", "++", ")", "{", "element_hmain", ".", "innerHTML", "=", "text", "[", "i", "]", ";", "await", "sleep", "(", "100", ")", ";", "}", "}" ]
[ 9, 0 ]
[ 16, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
getNavBarHeight
()
null
So lautete die Funktion ursprünglich /* function scrollNav(x) { var shiftWindow = function() { scrollBy(0, x) }; if (location.hash) shiftWindow(); window.addEventListener("hashchange", shiftWindow); }
So lautete die Funktion ursprünglich /* function scrollNav(x) { var shiftWindow = function() { scrollBy(0, x) }; if (location.hash) shiftWindow(); window.addEventListener("hashchange", shiftWindow); }
function getNavBarHeight() { var x = document.getElementsByTagName('nav')[0].offsetHeight; return(-x); }
[ "function", "getNavBarHeight", "(", ")", "{", "var", "x", "=", "document", ".", "getElementsByTagName", "(", "'nav'", ")", "[", "0", "]", ".", "offsetHeight", ";", "return", "(", "-", "x", ")", ";", "}" ]
[ 112, 0 ]
[ 115, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
sum
()
null
Erstmal ohne Parameter definieren
Erstmal ohne Parameter definieren
function sum(); { console.log(x + y); }
[ "function", "sum", "(", ")", ";", "{", "console", ".", "log", "(", "x", "+", "y", ")", ";", "}" ]
[ 84, 0 ]
[ 86, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
sumSquaresOfEvens
(arr)
null
/* Letzte Übung vom Übungsslide in Chapter 14
/* Letzte Übung vom Übungsslide in Chapter 14
function sumSquaresOfEvens(arr) { let sum = 0; for (let item of arr) { if (isEven(item)) { sum += square(item); } } console.log(sum); // Alternative 1 console.log( arr.reduce((acc, item) => { if (isEven(item)) { acc += square(item); } return acc; }, 0) ); // Alternative 2 console.log(arr.filter(isEven).map(square).reduce(sum)); }
[ "function", "sumSquaresOfEvens", "(", "arr", ")", "{", "let", "sum", "=", "0", ";", "for", "(", "let", "item", "of", "arr", ")", "{", "if", "(", "isEven", "(", "item", ")", ")", "{", "sum", "+=", "square", "(", "item", ")", ";", "}", "}", "console", ".", "log", "(", "sum", ")", ";", "// Alternative 1", "console", ".", "log", "(", "arr", ".", "reduce", "(", "(", "acc", ",", "item", ")", "=>", "{", "if", "(", "isEven", "(", "item", ")", ")", "{", "acc", "+=", "square", "(", "item", ")", ";", "}", "return", "acc", ";", "}", ",", "0", ")", ")", ";", "// Alternative 2", "console", ".", "log", "(", "arr", ".", "filter", "(", "isEven", ")", ".", "map", "(", "square", ")", ".", "reduce", "(", "sum", ")", ")", ";", "}" ]
[ 105, 0 ]
[ 127, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
login
(username, password)
null
Beispiel für return
Beispiel für return
function login(username, password) { return true }
[ "function", "login", "(", "username", ",", "password", ")", "{", "return", "true", "}" ]
[ 234, 0 ]
[ 236, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
(pk)
null
Diffie-Hellmann function @param {elGamal.publicKey} pk The Public Key to do Diffie-Hellmann with @return {bitArray} diffie-hellmann result for this key combination.
Diffie-Hellmann function
function(pk) { return sjcl.hash.sha256.hash(pk._point.mult(this._exponent).toBits()); }
[ "function", "(", "pk", ")", "{", "return", "sjcl", ".", "hash", ".", "sha256", ".", "hash", "(", "pk", ".", "_point", ".", "mult", "(", "this", ".", "_exponent", ")", ".", "toBits", "(", ")", ")", ";", "}" ]
[ 526, 6 ]
[ 528, 3 ]
null
javascript
de
['de', 'de', 'de']
False
true
pair
generateIdAndCopyFiles
(req)
null
note :: Der Funktionsumfang von `generateIdAndCopyFiles` sollte durch mantra abgedeckt sein. Die Übernahme von Kali :: zielt also primär auf die Funktion `language.testProject()`. Generates a new Id creating the folder where to store the files, and then stores the source files as well as the test files. @param req.body.files: source files req.body.testFiles: test files @returns {Promise (id)}
note :: Der Funktionsumfang von `generateIdAndCopyFiles` sollte durch mantra abgedeckt sein. Die Übernahme von Kali :: zielt also primär auf die Funktion `language.testProject()`. Generates a new Id creating the folder where to store the files, and then stores the source files as well as the test files.
function generateIdAndCopyFiles(req) { return new Promise(function (resolve, reject) { var path = req.body.path; var files = req.body.files; var testFiles = req.body.testFiles; mantraUtilCtrl.generateId(path, function (id) { //console.log('Generated ID ' + id); if (id != undefined) { var dstPath = mantraConfig.mantraPath + id + '/'; mantraUtilCtrl.copyFiles(files, dstPath) .then(function () { mantraUtilCtrl.copyFiles(testFiles, dstPath) .then(function () { resolve(id); }); }); } }); }); }
[ "function", "generateIdAndCopyFiles", "(", "req", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "path", "=", "req", ".", "body", ".", "path", ";", "var", "files", "=", "req", ".", "body", ".", "files", ";", "var", "testFiles", "=", "req", ".", "body", ".", "testFiles", ";", "mantraUtilCtrl", ".", "generateId", "(", "path", ",", "function", "(", "id", ")", "{", "//console.log('Generated ID ' + id);", "if", "(", "id", "!=", "undefined", ")", "{", "var", "dstPath", "=", "mantraConfig", ".", "mantraPath", "+", "id", "+", "'/'", ";", "mantraUtilCtrl", ".", "copyFiles", "(", "files", ",", "dstPath", ")", ".", "then", "(", "function", "(", ")", "{", "mantraUtilCtrl", ".", "copyFiles", "(", "testFiles", ",", "dstPath", ")", ".", "then", "(", "function", "(", ")", "{", "resolve", "(", "id", ")", ";", "}", ")", ";", "}", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}" ]
[ 70, 0 ]
[ 89, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
()
null
Daterangepicker
Daterangepicker
function(){ if($(".daterange").length > 0) $(".daterange").daterangepicker({format: 'YYYY-MM-DD',startDate: '2013-01-01',endDate: '2013-12-31'}); }
[ "function", "(", ")", "{", "if", "(", "$", "(", "\".daterange\"", ")", ".", "length", ">", "0", ")", "$", "(", "\".daterange\"", ")", ".", "daterangepicker", "(", "{", "format", ":", "'YYYY-MM-DD'", ",", "startDate", ":", "'2013-01-01'", ",", "endDate", ":", "'2013-12-31'", "}", ")", ";", "}" ]
[ 25, 32 ]
[ 28, 9 ]
null
javascript
de
['de', 'de', 'de']
False
true
variable_declarator
anyOutgoingFlowOfType
(element, type)
null
Prüft ob schon ein Alternative oder ParallelFlow existiert
Prüft ob schon ein Alternative oder ParallelFlow existiert
function anyOutgoingFlowOfType(element, type) { for (const flow of element.outgoing) { if (flow.type === type) { return false; } } return true; }
[ "function", "anyOutgoingFlowOfType", "(", "element", ",", "type", ")", "{", "for", "(", "const", "flow", "of", "element", ".", "outgoing", ")", "{", "if", "(", "flow", ".", "type", "===", "type", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
[ 117, 2 ]
[ 124, 3 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
()
null
/* --- Mitteltöner --- /* Was passiert nach Button click
/* --- Mitteltöner --- /* Was passiert nach Button click
function() { document.getElementById('mt-1').classList.remove("dont-show"); document.getElementById('mt-2').classList.add("dont-show"); document.getElementById('mt-2').classList.remove("show"); document.getElementById('mt-1').classList.add("show"); }
[ "function", "(", ")", "{", "document", ".", "getElementById", "(", "'mt-1'", ")", ".", "classList", ".", "remove", "(", "\"dont-show\"", ")", ";", "document", ".", "getElementById", "(", "'mt-2'", ")", ".", "classList", ".", "add", "(", "\"dont-show\"", ")", ";", "document", ".", "getElementById", "(", "'mt-2'", ")", ".", "classList", ".", "remove", "(", "\"show\"", ")", ";", "document", ".", "getElementById", "(", "'mt-1'", ")", ".", "classList", ".", "add", "(", "\"show\"", ")", ";", "}" ]
[ 23, 18 ]
[ 28, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
variable_declarator
update_fsvfsr
(gremium)
null
updatet das zu wählende Gremium
updatet das zu wählende Gremium
function update_fsvfsr(gremium) { var gremium = "Fachschaftsrat" var derdesfsvfsr = "des" var diederfsvfsr = "der" var diedenfsvfsr = "den" var zurzumfsvfsr = "zum" var zahl_sitze = 7; if ($( "#anzwahlberechtigte" ).val() > 500) { zahl_sitze = 11; gremium = "Fachschaftsvertretung" derdesfsvfsr = "der" diederfsvfsr = "die" diedenfsvfsr = "die" zurzumfsvfsr = "zur" if($( "#anzwahlberechtigte" ).val() > 2000) zahl_sitze = 19 else if($( "#anzwahlberechtigte" ).val() > 1000) zahl_sitze = 15 } if ($( "#fsvsatzung" ).is(":checked")) { gremium = "Fachschaftsvertretung" derdesfsvfsr = "der" diederfsvfsr = "die" diedenfsvfsr = "die" zurzumfsvfsr = "zur" } for (const element of document.getElementsByClassName('fsvfsr')){ element.innerHTML = gremium } for (const element of document.getElementsByClassName('derdesfsvfsr')){ element.innerHTML = derdesfsvfsr } for (const element of document.getElementsByClassName('diederfsvfsr')){ element.innerHTML = diederfsvfsr } for (const element of document.getElementsByClassName('diedenfsvfsr')){ element.innerHTML = diedenfsvfsr } for (const element of document.getElementsByClassName('zurzumfsvfsr')){ element.innerHTML = zurzumfsvfsr } for (const element of document.getElementsByClassName('zahl_sitze')){ element.innerHTML = zahl_sitze } document.getElementById("zahl_sitze").value = zahl_sitze }
[ "function", "update_fsvfsr", "(", "gremium", ")", "{", "var", "gremium", "=", "\"Fachschaftsrat\"", "var", "derdesfsvfsr", "=", "\"des\"", "var", "diederfsvfsr", "=", "\"der\"", "var", "diedenfsvfsr", "=", "\"den\"", "var", "zurzumfsvfsr", "=", "\"zum\"", "var", "zahl_sitze", "=", "7", ";", "if", "(", "$", "(", "\"#anzwahlberechtigte\"", ")", ".", "val", "(", ")", ">", "500", ")", "{", "zahl_sitze", "=", "11", ";", "gremium", "=", "\"Fachschaftsvertretung\"", "derdesfsvfsr", "=", "\"der\"", "diederfsvfsr", "=", "\"die\"", "diedenfsvfsr", "=", "\"die\"", "zurzumfsvfsr", "=", "\"zur\"", "if", "(", "$", "(", "\"#anzwahlberechtigte\"", ")", ".", "val", "(", ")", ">", "2000", ")", "zahl_sitze", "=", "19", "else", "if", "(", "$", "(", "\"#anzwahlberechtigte\"", ")", ".", "val", "(", ")", ">", "1000", ")", "zahl_sitze", "=", "15", "}", "if", "(", "$", "(", "\"#fsvsatzung\"", ")", ".", "is", "(", "\":checked\"", ")", ")", "{", "gremium", "=", "\"Fachschaftsvertretung\"", "derdesfsvfsr", "=", "\"der\"", "diederfsvfsr", "=", "\"die\"", "diedenfsvfsr", "=", "\"die\"", "zurzumfsvfsr", "=", "\"zur\"", "}", "for", "(", "const", "element", "of", "document", ".", "getElementsByClassName", "(", "'fsvfsr'", ")", ")", "{", "element", ".", "innerHTML", "=", "gremium", "}", "for", "(", "const", "element", "of", "document", ".", "getElementsByClassName", "(", "'derdesfsvfsr'", ")", ")", "{", "element", ".", "innerHTML", "=", "derdesfsvfsr", "}", "for", "(", "const", "element", "of", "document", ".", "getElementsByClassName", "(", "'diederfsvfsr'", ")", ")", "{", "element", ".", "innerHTML", "=", "diederfsvfsr", "}", "for", "(", "const", "element", "of", "document", ".", "getElementsByClassName", "(", "'diedenfsvfsr'", ")", ")", "{", "element", ".", "innerHTML", "=", "diedenfsvfsr", "}", "for", "(", "const", "element", "of", "document", ".", "getElementsByClassName", "(", "'zurzumfsvfsr'", ")", ")", "{", "element", ".", "innerHTML", "=", "zurzumfsvfsr", "}", "for", "(", "const", "element", "of", "document", ".", "getElementsByClassName", "(", "'zahl_sitze'", ")", ")", "{", "element", ".", "innerHTML", "=", "zahl_sitze", "}", "document", ".", "getElementById", "(", "\"zahl_sitze\"", ")", ".", "value", "=", "zahl_sitze", "}" ]
[ 38, 0 ]
[ 90, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
toggleMenu
(forceClose = false)
null
Ich brauche absichtlich kein classlist.toggle, damit ich bei einem Click auf die Links das Menu automatisch schliessen kann. Ausserdem $= (ends with), da im PHP-Skript noch die Url vorher ist.
Ich brauche absichtlich kein classlist.toggle, damit ich bei einem Click auf die Links das Menu automatisch schliessen kann. Ausserdem $= (ends with), da im PHP-Skript noch die Url vorher ist.
function toggleMenu(forceClose = false) { if (forceClose || menuOpened) { document.querySelector("a[href$=\"#home\"").classList.add("w3-hide-small"); document.querySelector("a[href$=\"#information\"").classList.add("w3-hide-small"); document.querySelector("a[href$=\"#draw\"").classList.add("w3-hide-small"); document.querySelector("a[href$=\"#submit\"").classList.add("w3-hide-small"); document.querySelector("a[href$=\"#posts\"").classList.add("w3-hide-small"); menuOpened = false; } else { document.querySelector("a[href$=\"#home\"").classList.remove("w3-hide-small"); document.querySelector("a[href$=\"#information\"").classList.remove("w3-hide-small"); document.querySelector("a[href$=\"#draw\"").classList.remove("w3-hide-small"); document.querySelector("a[href$=\"#submit\"").classList.remove("w3-hide-small"); document.querySelector("a[href$=\"#posts\"").classList.remove("w3-hide-small"); menuOpened = true; } }
[ "function", "toggleMenu", "(", "forceClose", "=", "false", ")", "{", "if", "(", "forceClose", "||", "menuOpened", ")", "{", "document", ".", "querySelector", "(", "\"a[href$=\\\"#home\\\"\"", ")", ".", "classList", ".", "add", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#information\\\"\"", ")", ".", "classList", ".", "add", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#draw\\\"\"", ")", ".", "classList", ".", "add", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#submit\\\"\"", ")", ".", "classList", ".", "add", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#posts\\\"\"", ")", ".", "classList", ".", "add", "(", "\"w3-hide-small\"", ")", ";", "menuOpened", "=", "false", ";", "}", "else", "{", "document", ".", "querySelector", "(", "\"a[href$=\\\"#home\\\"\"", ")", ".", "classList", ".", "remove", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#information\\\"\"", ")", ".", "classList", ".", "remove", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#draw\\\"\"", ")", ".", "classList", ".", "remove", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#submit\\\"\"", ")", ".", "classList", ".", "remove", "(", "\"w3-hide-small\"", ")", ";", "document", ".", "querySelector", "(", "\"a[href$=\\\"#posts\\\"\"", ")", ".", "classList", ".", "remove", "(", "\"w3-hide-small\"", ")", ";", "menuOpened", "=", "true", ";", "}", "}" ]
[ 42, 0 ]
[ 59, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
User
(name, age)
null
return this; } Alternative, die genau gleich ist
return this; } Alternative, die genau gleich ist
function User(name, age) { this.name = name; this.age = age; this.speak = () => console.log('Hi, my name is', this.name, '!'); }
[ "function", "User", "(", "name", ",", "age", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "age", "=", "age", ";", "this", ".", "speak", "=", "(", ")", "=>", "console", ".", "log", "(", "'Hi, my name is'", ",", "this", ".", "name", ",", "'!'", ")", ";", "}" ]
[ 34, 0 ]
[ 38, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
technicalResourcesAvailable
(source, technicalResources)
null
TODO: Gleiches für TechnicalResources
TODO: Gleiches für TechnicalResources
function technicalResourcesAvailable(source, technicalResources) { if (technicalResources.length == 0) { return false; }; if (source.businessObject.isAssignedTo.length == 0) { return true; }; let freeTechnicalResources = filter(technicalResources, function (tR) { return tR.isAssignedTo.id != source.id; }); if (freeTechnicalResources.length > 0) { return true; } return false; }
[ "function", "technicalResourcesAvailable", "(", "source", ",", "technicalResources", ")", "{", "if", "(", "technicalResources", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", ";", "if", "(", "source", ".", "businessObject", ".", "isAssignedTo", ".", "length", "==", "0", ")", "{", "return", "true", ";", "}", ";", "let", "freeTechnicalResources", "=", "filter", "(", "technicalResources", ",", "function", "(", "tR", ")", "{", "return", "tR", ".", "isAssignedTo", ".", "id", "!=", "source", ".", "id", ";", "}", ")", ";", "if", "(", "freeTechnicalResources", ".", "length", ">", "0", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
[ 154, 2 ]
[ 169, 3 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
convertArray
(array)
null
----Gibt den Array mit korrekter Checksumme zurueck
----Gibt den Array mit korrekter Checksumme zurueck
function convertArray(array) { const tmpArr = array.slice(); let tmpChk = 0; for (let i = 0; i < array.length - 1; i++) { tmpChk += array[i]; } tmpChk = tmpChk & 0xff; tmpArr[tmpArr.length - 1] = tmpChk; return tmpArr; }
[ "function", "convertArray", "(", "array", ")", "{", "const", "tmpArr", "=", "array", ".", "slice", "(", ")", ";", "let", "tmpChk", "=", "0", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "array", ".", "length", "-", "1", ";", "i", "++", ")", "{", "tmpChk", "+=", "array", "[", "i", "]", ";", "}", "tmpChk", "=", "tmpChk", "&", "0xff", ";", "tmpArr", "[", "tmpArr", ".", "length", "-", "1", "]", "=", "tmpChk", ";", "return", "tmpArr", ";", "}" ]
[ 119, 0 ]
[ 129, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
extractCurrencyValue
(str)
null
/* Erster Versuch
/* Erster Versuch
function extractCurrencyValue(str) { return +str.slice(1); // Funktioniert nicht für ITL1936.27 }
[ "function", "extractCurrencyValue", "(", "str", ")", "{", "return", "+", "str", ".", "slice", "(", "1", ")", ";", "// Funktioniert nicht für ITL1936.27", "}" ]
[ 6, 0 ]
[ 8, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
parseJSHINT
(full_match, left, center, right, eol)
null
/* jshint esversion: 6,-W097, -W040, node: true, expr: true, undef: true
/* jshint esversion: 6,-W097, -W040, node: true, expr: true, undef: true
function parseJSHINT(full_match, left, center, right, eol){ if(/\/\/gulp\.keep\.line/.test(right)) return left+center+right+eol; const out= [left, center, right].map(item=> /\/\*[^\*]*\*\//g.test(item) ? "" : item).join("");//?? || /gulp_place/g.test(item) return out ? out+eol : out; }
[ "function", "parseJSHINT", "(", "full_match", ",", "left", ",", "center", ",", "right", ",", "eol", ")", "{", "if", "(", "/", "\\/\\/gulp\\.keep\\.line", "/", ".", "test", "(", "right", ")", ")", "return", "left", "+", "center", "+", "right", "+", "eol", ";", "const", "out", "=", "[", "left", ",", "center", ",", "right", "]", ".", "map", "(", "item", "=>", "/", "\\/\\*[^\\*]*\\*\\/", "/", "g", ".", "test", "(", "item", ")", "?", "\"\"", ":", "item", ")", ".", "join", "(", "\"\"", ")", ";", "//?? || /gulp_place/g.test(item)", "return", "out", "?", "out", "+", "eol", ":", "out", ";", "}" ]
[ 1, 0 ]
[ 5, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
getFirtEven
()
null
/* Nächste Übung vom Übungsslide in Chapter 14 - Erste gerade Zahl oder undefined ausgeben
/* Nächste Übung vom Übungsslide in Chapter 14 - Erste gerade Zahl oder undefined ausgeben
function getFirtEven() { console.log(arr.find(isEven)); }
[ "function", "getFirtEven", "(", ")", "{", "console", ".", "log", "(", "arr", ".", "find", "(", "isEven", ")", ")", ";", "}" ]
[ 78, 0 ]
[ 80, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
(hash, rs, fakeLegacyVersion)
null
Diffie-Hellmann function @param {bitArray} hash hash to verify. @param {bitArray} rs signature bitArray. @param {boolean} fakeLegacyVersion use old legacy version
Diffie-Hellmann function
function(hash, rs, fakeLegacyVersion) { if (sjcl.bitArray.bitLength(hash) > this._curveBitLength) { hash = sjcl.bitArray.clamp(hash, this._curveBitLength); } var w = sjcl.bitArray, R = this._curve.r, l = this._curveBitLength, r = sjcl.bn.fromBits(w.bitSlice(rs,0,l)), ss = sjcl.bn.fromBits(w.bitSlice(rs,l,2*l)), s = fakeLegacyVersion ? ss : ss.inverseMod(R), hG = sjcl.bn.fromBits(hash).mul(s).mod(R), hA = r.mul(s).mod(R), r2 = this._curve.G.mult2(hG, hA, this._point).x; if (r.equals(0) || ss.equals(0) || r.greaterEquals(R) || ss.greaterEquals(R) || !r2.equals(r)) { if (fakeLegacyVersion === undefined) { return this.verify(hash, rs, true); } else { throw (new sjcl.exception.corrupt("signature didn't check out")); } } return true; }
[ "function", "(", "hash", ",", "rs", ",", "fakeLegacyVersion", ")", "{", "if", "(", "sjcl", ".", "bitArray", ".", "bitLength", "(", "hash", ")", ">", "this", ".", "_curveBitLength", ")", "{", "hash", "=", "sjcl", ".", "bitArray", ".", "clamp", "(", "hash", ",", "this", ".", "_curveBitLength", ")", ";", "}", "var", "w", "=", "sjcl", ".", "bitArray", ",", "R", "=", "this", ".", "_curve", ".", "r", ",", "l", "=", "this", ".", "_curveBitLength", ",", "r", "=", "sjcl", ".", "bn", ".", "fromBits", "(", "w", ".", "bitSlice", "(", "rs", ",", "0", ",", "l", ")", ")", ",", "ss", "=", "sjcl", ".", "bn", ".", "fromBits", "(", "w", ".", "bitSlice", "(", "rs", ",", "l", ",", "2", "*", "l", ")", ")", ",", "s", "=", "fakeLegacyVersion", "?", "ss", ":", "ss", ".", "inverseMod", "(", "R", ")", ",", "hG", "=", "sjcl", ".", "bn", ".", "fromBits", "(", "hash", ")", ".", "mul", "(", "s", ")", ".", "mod", "(", "R", ")", ",", "hA", "=", "r", ".", "mul", "(", "s", ")", ".", "mod", "(", "R", ")", ",", "r2", "=", "this", ".", "_curve", ".", "G", ".", "mult2", "(", "hG", ",", "hA", ",", "this", ".", "_point", ")", ".", "x", ";", "if", "(", "r", ".", "equals", "(", "0", ")", "||", "ss", ".", "equals", "(", "0", ")", "||", "r", ".", "greaterEquals", "(", "R", ")", "||", "ss", ".", "greaterEquals", "(", "R", ")", "||", "!", "r2", ".", "equals", "(", "r", ")", ")", "{", "if", "(", "fakeLegacyVersion", "===", "undefined", ")", "{", "return", "this", ".", "verify", "(", "hash", ",", "rs", ",", "true", ")", ";", "}", "else", "{", "throw", "(", "new", "sjcl", ".", "exception", ".", "corrupt", "(", "\"signature didn't check out\"", ")", ")", ";", "}", "}", "return", "true", ";", "}" ]
[ 570, 10 ]
[ 591, 3 ]
null
javascript
de
['de', 'de', 'de']
False
true
pair
SocketIOEmitter
(n)
null
/* sckt emitter
/* sckt emitter
function SocketIOEmitter(n){ RED.nodes.createNode(this, n); this.name = n.name; /* this.eventName = n.eventname;*/ this.socketId = null; var node = this; node.on('input', function(msg){ node.socketId = msg.payload.socketId; node.eventName = msg.payload.eventName; node.message = msg.payload.message; if(msg.payload.message != null){ sockets[node.socketId].emit(node.eventName, node.message || '' ); }else if(msg.payload.eventName == null){ node.status({fill:'red',shape:'ring',text:'event null'}); }else if(msg.payload.message == null){ node.status({fill:'red',shape:'ring',text:'message null'}); } }); }
[ "function", "SocketIOEmitter", "(", "n", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "n", ")", ";", "this", ".", "name", "=", "n", ".", "name", ";", "/* this.eventName = n.eventname;*/", "this", ".", "socketId", "=", "null", ";", "var", "node", "=", "this", ";", "node", ".", "on", "(", "'input'", ",", "function", "(", "msg", ")", "{", "node", ".", "socketId", "=", "msg", ".", "payload", ".", "socketId", ";", "node", ".", "eventName", "=", "msg", ".", "payload", ".", "eventName", ";", "node", ".", "message", "=", "msg", ".", "payload", ".", "message", ";", "if", "(", "msg", ".", "payload", ".", "message", "!=", "null", ")", "{", "sockets", "[", "node", ".", "socketId", "]", ".", "emit", "(", "node", ".", "eventName", ",", "node", ".", "message", "||", "''", ")", ";", "}", "else", "if", "(", "msg", ".", "payload", ".", "eventName", "==", "null", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'red'", ",", "shape", ":", "'ring'", ",", "text", ":", "'event null'", "}", ")", ";", "}", "else", "if", "(", "msg", ".", "payload", ".", "message", "==", "null", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'red'", ",", "shape", ":", "'ring'", ",", "text", ":", "'message null'", "}", ")", ";", "}", "}", ")", ";", "}" ]
[ 99, 4 ]
[ 119, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
deleteWatchlist
(accountId, watchlistId)
null
createWatchlist() Delete watchlist for a specific account. @instance @memberof TDAmeritrade @param {string} accountId The account id @param {string} watchlistId The watchlist id @returns {Promise<any>} Success @example await td.deleteWatchlist('45678', '98754')
createWatchlist() Delete watchlist for a specific account.
function deleteWatchlist(accountId, watchlistId) { return this.axios.delete(`/accounts/${accountId}/watchlists/${watchlistId}`) }
[ "function", "deleteWatchlist", "(", "accountId", ",", "watchlistId", ")", "{", "return", "this", ".", "axios", ".", "delete", "(", "`", "${", "accountId", "}", "${", "watchlistId", "}", "`", ")", "}" ]
[ 42, 0 ]
[ 44, 1 ]
null
javascript
de
['de', 'de', 'de']
False
true
program
draw
()
null
/* TODO: alpha, beta Auswahl aus Stabilitätsdiagramm
/* TODO: alpha, beta Auswahl aus Stabilitätsdiagramm
function draw() { for (var i=0; i<50; i++) calc(); if(alt3) { for (var x=0; x<N; x++) { for (var y=0; y<N; y++) { set(x, y, color(220./360., re_now[x][y]*re_now[x][y]+im_now[x][y]*im_now[x][y], 1.0)); } } } else { for (var x=0; x<N; x++) { for (var y=0; y<N; y++) { set(x, y, color(220./360., 0.5*(re_now[x][y]+1.0), 1.0)); } } } if(pseudo_3d) { text("3d", 5, 15); } updatePixels(); if(mouseIsPressed && mouseButton!=CENTER && !alt2) { var x0 = max(0, int(mouseX - 50)); var y0 = max(0, int(mouseY - 50)); var x1 = min(N, int(mouseX + 50)); var y1 = min(N, int(mouseY + 50)); var mult=1; if(alt) { mult=-1; } for (var x=x0; x < x1; x++) { for (var y=y0; y < y1; y++) { re_now[x][y] = 2*(float(x-x0)/(x1-x0) - 0.5)*mult; im_now[x][y] = 2*(float(y-y0)/(y1-y0) - 0.5); } } } }
[ "function", "draw", "(", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "50", ";", "i", "++", ")", "calc", "(", ")", ";", "if", "(", "alt3", ")", "{", "for", "(", "var", "x", "=", "0", ";", "x", "<", "N", ";", "x", "++", ")", "{", "for", "(", "var", "y", "=", "0", ";", "y", "<", "N", ";", "y", "++", ")", "{", "set", "(", "x", ",", "y", ",", "color", "(", "220.", "/", "360.", ",", "re_now", "[", "x", "]", "[", "y", "]", "*", "re_now", "[", "x", "]", "[", "y", "]", "+", "im_now", "[", "x", "]", "[", "y", "]", "*", "im_now", "[", "x", "]", "[", "y", "]", ",", "1.0", ")", ")", ";", "}", "}", "}", "else", "{", "for", "(", "var", "x", "=", "0", ";", "x", "<", "N", ";", "x", "++", ")", "{", "for", "(", "var", "y", "=", "0", ";", "y", "<", "N", ";", "y", "++", ")", "{", "set", "(", "x", ",", "y", ",", "color", "(", "220.", "/", "360.", ",", "0.5", "*", "(", "re_now", "[", "x", "]", "[", "y", "]", "+", "1.0", ")", ",", "1.0", ")", ")", ";", "}", "}", "}", "if", "(", "pseudo_3d", ")", "{", "text", "(", "\"3d\"", ",", "5", ",", "15", ")", ";", "}", "updatePixels", "(", ")", ";", "if", "(", "mouseIsPressed", "&&", "mouseButton", "!=", "CENTER", "&&", "!", "alt2", ")", "{", "var", "x0", "=", "max", "(", "0", ",", "int", "(", "mouseX", "-", "50", ")", ")", ";", "var", "y0", "=", "max", "(", "0", ",", "int", "(", "mouseY", "-", "50", ")", ")", ";", "var", "x1", "=", "min", "(", "N", ",", "int", "(", "mouseX", "+", "50", ")", ")", ";", "var", "y1", "=", "min", "(", "N", ",", "int", "(", "mouseY", "+", "50", ")", ")", ";", "var", "mult", "=", "1", ";", "if", "(", "alt", ")", "{", "mult", "=", "-", "1", ";", "}", "for", "(", "var", "x", "=", "x0", ";", "x", "<", "x1", ";", "x", "++", ")", "{", "for", "(", "var", "y", "=", "y0", ";", "y", "<", "y1", ";", "y", "++", ")", "{", "re_now", "[", "x", "]", "[", "y", "]", "=", "2", "*", "(", "float", "(", "x", "-", "x0", ")", "/", "(", "x1", "-", "x0", ")", "-", "0.5", ")", "*", "mult", ";", "im_now", "[", "x", "]", "[", "y", "]", "=", "2", "*", "(", "float", "(", "y", "-", "y0", ")", "/", "(", "y1", "-", "y0", ")", "-", "0.5", ")", ";", "}", "}", "}", "}" ]
[ 118, 0 ]
[ 150, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
sum
(x, y)
null
wenn einer der Werte nicht gegeben wird
wenn einer der Werte nicht gegeben wird
function sum(x, y) { // man könnte auch schreiben sum(x = 0, y) wenn man nur schauen will, ob x undefined ist. Bedeutet ich will in der function ein x und wenn es undefined ist, macht es 0. if (x === undefined || x = 0 || x = '') { x = 0; } if (y === undefined || y = 0 || y = '') { y = 0; } console.log(x + y); }
[ "function", "sum", "(", "x", ",", "y", ")", "{", "// man könnte auch schreiben sum(x = 0, y) wenn man nur schauen will, ob x undefined ist. Bedeutet ich will in der function ein x und wenn es undefined ist, macht es 0.", "if", "(", "x", "===", "undefined", "||", "x", "=", "0", "||", "x", "=", "''", ")", "{", "x", "=", "0", ";", "}", "if", "(", "y", "===", "undefined", "||", "y", "=", "0", "||", "y", "=", "''", ")", "{", "y", "=", "0", ";", "}", "console", ".", "log", "(", "x", "+", "y", ")", ";", "}" ]
[ 121, 0 ]
[ 131, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
cutPrice
(preis)
null
Dezimalstellen des Preises ermitteln
Dezimalstellen des Preises ermitteln
function cutPrice(preis) { preis = parseFloat(preis); let temp = preis * 100; // 100facher Preis jetzt mit einer Nachkommastelle const temp2 = preis * 1000; // 1000facher Preis ohne Nachkommastelle temp = Math.floor(temp); // Nachkommastelle (.x) wird abgeschnitten temp = temp / 100; // es bleiben zwei Nachkommastellen let price_short = temp.toFixed(2); // Preis mit 2 Nachkommastellen ausgeben (abgeschnitten) let price_3rd_digit = Math.ceil(temp2 - (temp * 1000)); // Dritte Nachommastelle einzeln ermitteln return { priceshort: price_short, // als String wg. Nullen zB 1.10 statt 1.1 price3rd: parseInt(price_3rd_digit, 10), price: preis }; }
[ "function", "cutPrice", "(", "preis", ")", "{", "preis", "=", "parseFloat", "(", "preis", ")", ";", "let", "temp", "=", "preis", "*", "100", ";", "// 100facher Preis jetzt mit einer Nachkommastelle", "const", "temp2", "=", "preis", "*", "1000", ";", "// 1000facher Preis ohne Nachkommastelle", "temp", "=", "Math", ".", "floor", "(", "temp", ")", ";", "// Nachkommastelle (.x) wird abgeschnitten", "temp", "=", "temp", "/", "100", ";", "// es bleiben zwei Nachkommastellen", "let", "price_short", "=", "temp", ".", "toFixed", "(", "2", ")", ";", "// Preis mit 2 Nachkommastellen ausgeben (abgeschnitten)", "let", "price_3rd_digit", "=", "Math", ".", "ceil", "(", "temp2", "-", "(", "temp", "*", "1000", ")", ")", ";", "// Dritte Nachommastelle einzeln ermitteln", "return", "{", "priceshort", ":", "price_short", ",", "// als String wg. Nullen zB 1.10 statt 1.1", "price3rd", ":", "parseInt", "(", "price_3rd_digit", ",", "10", ")", ",", "price", ":", "preis", "}", ";", "}" ]
[ 88, 0 ]
[ 101, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
checkIfStateIsNew
(state, decomposedProcess)
null
Prüfen ob ProcessOperator auf übergeordneten Prozess mit einem neuen State verbunden wurde / returned false, wenn neu
Prüfen ob ProcessOperator auf übergeordneten Prozess mit einem neuen State verbunden wurde / returned false, wenn neu
function checkIfStateIsNew(state, decomposedProcess) { return some(decomposedProcess.businessObject.consistsOfStates, function (c) { return c.id === state.id; }) }
[ "function", "checkIfStateIsNew", "(", "state", ",", "decomposedProcess", ")", "{", "return", "some", "(", "decomposedProcess", ".", "businessObject", ".", "consistsOfStates", ",", "function", "(", "c", ")", "{", "return", "c", ".", "id", "===", "state", ".", "id", ";", "}", ")", "}" ]
[ 299, 0 ]
[ 303, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
onEnqueueButtonClick
()
null
Eingabe holen aus dem Element #enqueue-value Aufruf der enqueue-Funktion mit der Eingabe
Eingabe holen aus dem Element #enqueue-value Aufruf der enqueue-Funktion mit der Eingabe
function onEnqueueButtonClick() { const inputValue = document.querySelector('#input-value').value; if (!inputValue) document.querySelector('#action-value').value = 'error: empty value'; else { enqueue(inputValue); document.querySelector('#action-value').value = 'enqueue ' + inputValue; document.querySelector('#queue-list').value = queue; } }
[ "function", "onEnqueueButtonClick", "(", ")", "{", "const", "inputValue", "=", "document", ".", "querySelector", "(", "'#input-value'", ")", ".", "value", ";", "if", "(", "!", "inputValue", ")", "document", ".", "querySelector", "(", "'#action-value'", ")", ".", "value", "=", "'error: empty value'", ";", "else", "{", "enqueue", "(", "inputValue", ")", ";", "document", ".", "querySelector", "(", "'#action-value'", ")", ".", "value", "=", "'enqueue '", "+", "inputValue", ";", "document", ".", "querySelector", "(", "'#queue-list'", ")", ".", "value", "=", "queue", ";", "}", "}" ]
[ 17, 0 ]
[ 27, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
multiplyNumeric
(obj)
null
Bedingte Multiplikation mit 2 - Websitelösung
Bedingte Multiplikation mit 2 - Websitelösung
function multiplyNumeric(obj) { for (let key in obj) { if (typeof obj[key] === 'number') { obj[key] = obj[key] * 2; } } return obj; }
[ "function", "multiplyNumeric", "(", "obj", ")", "{", "for", "(", "let", "key", "in", "obj", ")", "{", "if", "(", "typeof", "obj", "[", "key", "]", "===", "'number'", ")", "{", "obj", "[", "key", "]", "=", "obj", "[", "key", "]", "*", "2", ";", "}", "}", "return", "obj", ";", "}" ]
[ 43, 0 ]
[ 50, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
allEven
(arr)
null
/* Nächste Übung vom Übungsslide in Chapter 14 - Prüfen, ob alle Zahlen gerade sind
/* Nächste Übung vom Übungsslide in Chapter 14 - Prüfen, ob alle Zahlen gerade sind
function allEven(arr) { console.log(arr.every(isEven)); }
[ "function", "allEven", "(", "arr", ")", "{", "console", ".", "log", "(", "arr", ".", "every", "(", "isEven", ")", ")", ";", "}" ]
[ 59, 0 ]
[ 61, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
SocketIOListener
(n)
null
/* sckt listener
/* sckt listener
function SocketIOListener(n){ RED.nodes.createNode(this, n); this.name = n.name; this.eventName = n.eventname; this.socketId = null; var node = this; node.on('input', function(msg){ node.socketId = msg.payload.socketId; node.eventName = msg.payload.eventName; if(msg.payload.status == 'connected'){ node.status({fill:'green',shape:'dot',text:'listening'}); if( !sockets[node.socketId].hasListeners(node.eventName) ){ sockets[node.socketId].on(node.eventName, function(data){ node.send( {payload:data} ); }); } }else{ node.status({fill:'red',shape:'ring',text:'disconnected'}); if( sockets[node.socketId].hasListeners(node.eventName) ){ sockets[node.socketId].removeListener(node.eventName, function(){}); } } }); node.on('close', function(done) { if( sockets[node.socketId].hasListeners(node.eventName) ){ sockets[node.socketId].removeListener(node.eventName, function(){ node.status({}); done(); }); }else{ node.status({}); done(); } }); }
[ "function", "SocketIOListener", "(", "n", ")", "{", "RED", ".", "nodes", ".", "createNode", "(", "this", ",", "n", ")", ";", "this", ".", "name", "=", "n", ".", "name", ";", "this", ".", "eventName", "=", "n", ".", "eventname", ";", "this", ".", "socketId", "=", "null", ";", "var", "node", "=", "this", ";", "node", ".", "on", "(", "'input'", ",", "function", "(", "msg", ")", "{", "node", ".", "socketId", "=", "msg", ".", "payload", ".", "socketId", ";", "node", ".", "eventName", "=", "msg", ".", "payload", ".", "eventName", ";", "if", "(", "msg", ".", "payload", ".", "status", "==", "'connected'", ")", "{", "node", ".", "status", "(", "{", "fill", ":", "'green'", ",", "shape", ":", "'dot'", ",", "text", ":", "'listening'", "}", ")", ";", "if", "(", "!", "sockets", "[", "node", ".", "socketId", "]", ".", "hasListeners", "(", "node", ".", "eventName", ")", ")", "{", "sockets", "[", "node", ".", "socketId", "]", ".", "on", "(", "node", ".", "eventName", ",", "function", "(", "data", ")", "{", "node", ".", "send", "(", "{", "payload", ":", "data", "}", ")", ";", "}", ")", ";", "}", "}", "else", "{", "node", ".", "status", "(", "{", "fill", ":", "'red'", ",", "shape", ":", "'ring'", ",", "text", ":", "'disconnected'", "}", ")", ";", "if", "(", "sockets", "[", "node", ".", "socketId", "]", ".", "hasListeners", "(", "node", ".", "eventName", ")", ")", "{", "sockets", "[", "node", ".", "socketId", "]", ".", "removeListener", "(", "node", ".", "eventName", ",", "function", "(", ")", "{", "}", ")", ";", "}", "}", "}", ")", ";", "node", ".", "on", "(", "'close'", ",", "function", "(", "done", ")", "{", "if", "(", "sockets", "[", "node", ".", "socketId", "]", ".", "hasListeners", "(", "node", ".", "eventName", ")", ")", "{", "sockets", "[", "node", ".", "socketId", "]", ".", "removeListener", "(", "node", ".", "eventName", ",", "function", "(", ")", "{", "node", ".", "status", "(", "{", "}", ")", ";", "done", "(", ")", ";", "}", ")", ";", "}", "else", "{", "node", ".", "status", "(", "{", "}", ")", ";", "done", "(", ")", ";", "}", "}", ")", ";", "}" ]
[ 56, 4 ]
[ 95, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
(response)
null
Neuen anlegen und im Coookie und im Storage setzten.
Neuen anlegen und im Coookie und im Storage setzten.
function(response) { if (t.handleError(response) == false) { if (response.collection && response.collection.key) { key = response.collection.key; // Im Cookie setzten. $.cookie(t.cookie_name, key, { expires: 30, path: "/" }); // Key setzten. t.setKey(key); } else { // Bei Fehler Key entfernen. t.setKey(null); } } // Alle zuvor Items der gespeicherten Seiten löschen. t.setSavedPagesItems(null); // Callback aufrufen wenn fertig. if (doneCallback) { doneCallback(key); } }
[ "function", "(", "response", ")", "{", "if", "(", "t", ".", "handleError", "(", "response", ")", "==", "false", ")", "{", "if", "(", "response", ".", "collection", "&&", "response", ".", "collection", ".", "key", ")", "{", "key", "=", "response", ".", "collection", ".", "key", ";", "// Im Cookie setzten.", "$", ".", "cookie", "(", "t", ".", "cookie_name", ",", "key", ",", "{", "expires", ":", "30", ",", "path", ":", "\"/\"", "}", ")", ";", "// Key setzten.", "t", ".", "setKey", "(", "key", ")", ";", "}", "else", "{", "// Bei Fehler Key entfernen.", "t", ".", "setKey", "(", "null", ")", ";", "}", "}", "// Alle zuvor Items der gespeicherten Seiten löschen.", "t", ".", "setSavedPagesItems", "(", "null", ")", ";", "// Callback aufrufen wenn fertig.", "if", "(", "doneCallback", ")", "{", "doneCallback", "(", "key", ")", ";", "}", "}" ]
[ 551, 20 ]
[ 580, 6 ]
null
javascript
de
['de', 'de', 'de']
True
true
variable_declarator
reloadAjaxListeners
()
null
listener wieder anhaengen fuer TREE tag wird von htmlcontent benutzt
listener wieder anhaengen fuer TREE tag wird von htmlcontent benutzt
function reloadAjaxListeners(){ for (i=0; i < this.ajaxListeners.length; i++){ if ( isFunction(this.ajaxListeners[i].reload) ) { this.ajaxListeners[i].reload(); } } }
[ "function", "reloadAjaxListeners", "(", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "ajaxListeners", ".", "length", ";", "i", "++", ")", "{", "if", "(", "isFunction", "(", "this", ".", "ajaxListeners", "[", "i", "]", ".", "reload", ")", ")", "{", "this", ".", "ajaxListeners", "[", "i", "]", ".", "reload", "(", ")", ";", "}", "}", "}" ]
[ 218, 0 ]
[ 224, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
init
()
null
/* Mit der Initialisierung von Dobbertin: state[0] = 0x12ac2375; state[1] = 0x3b341042; state[2] = 0x5f62b97c; state[3] = 0x4ba763ed; gibt es eine Kollision: begin 644 Message1 M7MH=JO6_>MG!X?!51$)W,CXV!A"=(!AR71,<X`Y-IIT9^Z&8L$2N'Y*Y:R.; 39GIK9>TF$W()/MEHR%C4:G1R:Q"= ` end begin 644 Message2 M7MH=JO6_>MG!X?!51$)W,CXV!A"=(!AR71,<X`Y-IIT9^Z&8L$2N'Y*Y:R.; 39GIK9>TF$W()/MEHREC4:G1R:Q"= ` end
/* Mit der Initialisierung von Dobbertin: state[0] = 0x12ac2375; state[1] = 0x3b341042; state[2] = 0x5f62b97c; state[3] = 0x4ba763ed; gibt es eine Kollision:
function init() { count[0]=count[1] = 0; state[0] = 0x67452301; state[1] = 0xefcdab89; state[2] = 0x98badcfe; state[3] = 0x10325476; for (i = 0; i < digestBits.length; i++) digestBits[i] = 0; }
[ "function", "init", "(", ")", "{", "count", "[", "0", "]", "=", "count", "[", "1", "]", "=", "0", ";", "state", "[", "0", "]", "=", "0x67452301", ";", "state", "[", "1", "]", "=", "0xefcdab89", ";", "state", "[", "2", "]", "=", "0x98badcfe", ";", "state", "[", "3", "]", "=", "0x10325476", ";", "for", "(", "i", "=", "0", ";", "i", "<", "digestBits", ".", "length", ";", "i", "++", ")", "digestBits", "[", "i", "]", "=", "0", ";", "}" ]
[ 310, 4 ]
[ 318, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
generateTitel
(titel="none",datum="",kommentare="")
null
Erstelle die Titelbox mit dem übergebenen Titel, Datum und anzahl der Kommentare eingetragen
Erstelle die Titelbox mit dem übergebenen Titel, Datum und anzahl der Kommentare eingetragen
function generateTitel(titel="none",datum="",kommentare=""){ return "<div class=\"d-flex fadentitel\"><div class=\"p-2 col-9 text-truncate\">"+titel+"</div><div class=\"p-2 text-nowrap\">"+dateparse(datum)+"</div></div>"; }
[ "function", "generateTitel", "(", "titel", "=", "\"none\"", ",", "datum", "=", "\"\"", ",", "kommentare", "=", "\"\"", ")", "{", "return", "\"<div class=\\\"d-flex fadentitel\\\"><div class=\\\"p-2 col-9 text-truncate\\\">\"", "+", "titel", "+", "\"</div><div class=\\\"p-2 text-nowrap\\\">\"", "+", "dateparse", "(", "datum", ")", "+", "\"</div></div>\"", ";", "}" ]
[ 4, 0 ]
[ 6, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
(hash, paranoia, fakeLegacyVersion, fixedKForTesting)
null
Diffie-Hellmann function @param {bitArray} hash hash to sign. @param {int} paranoia paranoia for random number generation @param {boolean} fakeLegacyVersion use old legacy version
Diffie-Hellmann function
function(hash, paranoia, fakeLegacyVersion, fixedKForTesting) { if (sjcl.bitArray.bitLength(hash) > this._curveBitLength) { hash = sjcl.bitArray.clamp(hash, this._curveBitLength); } var R = this._curve.r, l = R.bitLength(), k = fixedKForTesting || sjcl.bn.random(R.sub(1), paranoia).add(1), r = this._curve.G.mult(k).x.mod(R), ss = sjcl.bn.fromBits(hash).add(r.mul(this._exponent)), s = fakeLegacyVersion ? ss.inverseMod(R).mul(k).mod(R) : ss.mul(k.inverseMod(R)).mod(R); return sjcl.bitArray.concat(r.toBits(l), s.toBits(l)); }
[ "function", "(", "hash", ",", "paranoia", ",", "fakeLegacyVersion", ",", "fixedKForTesting", ")", "{", "if", "(", "sjcl", ".", "bitArray", ".", "bitLength", "(", "hash", ")", ">", "this", ".", "_curveBitLength", ")", "{", "hash", "=", "sjcl", ".", "bitArray", ".", "clamp", "(", "hash", ",", "this", ".", "_curveBitLength", ")", ";", "}", "var", "R", "=", "this", ".", "_curve", ".", "r", ",", "l", "=", "R", ".", "bitLength", "(", ")", ",", "k", "=", "fixedKForTesting", "||", "sjcl", ".", "bn", ".", "random", "(", "R", ".", "sub", "(", "1", ")", ",", "paranoia", ")", ".", "add", "(", "1", ")", ",", "r", "=", "this", ".", "_curve", ".", "G", ".", "mult", "(", "k", ")", ".", "x", ".", "mod", "(", "R", ")", ",", "ss", "=", "sjcl", ".", "bn", ".", "fromBits", "(", "hash", ")", ".", "add", "(", "r", ".", "mul", "(", "this", ".", "_exponent", ")", ")", ",", "s", "=", "fakeLegacyVersion", "?", "ss", ".", "inverseMod", "(", "R", ")", ".", "mul", "(", "k", ")", ".", "mod", "(", "R", ")", ":", "ss", ".", "mul", "(", "k", ".", "inverseMod", "(", "R", ")", ")", ".", "mod", "(", "R", ")", ";", "return", "sjcl", ".", "bitArray", ".", "concat", "(", "r", ".", "toBits", "(", "l", ")", ",", "s", ".", "toBits", "(", "l", ")", ")", ";", "}" ]
[ 613, 8 ]
[ 625, 3 ]
null
javascript
de
['de', 'de', 'de']
False
true
pair
switchToOriginal
()
null
Umschalten zwischen bibliographierten Daten und Transkription
Umschalten zwischen bibliographierten Daten und Transkription
function switchToOriginal() { var x = document.getElementsByClassName("titleBib"); var y = document.getElementsByClassName("titleCat"); var a = document.getElementsByClassName("authorList"); var p = document.getElementsByClassName("published"); var v = document.getElementsByClassName("volumes"); var c = document.getElementsByClassName("titleOriginal-single"); var countA = a.length; for (i = 0; i < countA; i++) { a[i].style.display='none'; } var countP = p.length; for (i = 0; i < countP; i++) { p[i].style.display='none'; } var countV = v.length; for (i = 0; i < countV; i++) { v[i].style.display='none'; } var count = x.length; for (i = 0; i < count; i++) { x[i].style.display='none'; y[i].style.display='inline'; } var countC = c.length; for (i = 0; i < countC; i++) { c[i].style.display='none'; } z = document.getElementById("switchLink"); z.innerHTML = "<a href='javascript:switchToBibl()'>Bibliographierte Daten anzeigen</a>"; }
[ "function", "switchToOriginal", "(", ")", "{", "var", "x", "=", "document", ".", "getElementsByClassName", "(", "\"titleBib\"", ")", ";", "var", "y", "=", "document", ".", "getElementsByClassName", "(", "\"titleCat\"", ")", ";", "var", "a", "=", "document", ".", "getElementsByClassName", "(", "\"authorList\"", ")", ";", "var", "p", "=", "document", ".", "getElementsByClassName", "(", "\"published\"", ")", ";", "var", "v", "=", "document", ".", "getElementsByClassName", "(", "\"volumes\"", ")", ";", "var", "c", "=", "document", ".", "getElementsByClassName", "(", "\"titleOriginal-single\"", ")", ";", "var", "countA", "=", "a", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "countA", ";", "i", "++", ")", "{", "a", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "var", "countP", "=", "p", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "countP", ";", "i", "++", ")", "{", "p", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "var", "countV", "=", "v", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "countV", ";", "i", "++", ")", "{", "v", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "var", "count", "=", "x", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "x", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "y", "[", "i", "]", ".", "style", ".", "display", "=", "'inline'", ";", "}", "var", "countC", "=", "c", ".", "length", ";", "for", "(", "i", "=", "0", ";", "i", "<", "countC", ";", "i", "++", ")", "{", "c", "[", "i", "]", ".", "style", ".", "display", "=", "'none'", ";", "}", "z", "=", "document", ".", "getElementById", "(", "\"switchLink\"", ")", ";", "z", ".", "innerHTML", "=", "\"<a href='javascript:switchToBibl()'>Bibliographierte Daten anzeigen</a>\"", ";", "}" ]
[ 21, 0 ]
[ 51, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program
Resample
(img, width, height, onresample)
null
(C) WebReflection Mit Style License
(C) WebReflection Mit Style License
function Resample(img, width, height, onresample) { var load = typeof img == "string", i = load || img; if (load) { i = new Image; // with propers callbacks i.onload = onload; i.onerror = onerror; } i._onresample = onresample; i._width = width; i._height = height; load ? (i.src = img) : onload.call(img); }
[ "function", "Resample", "(", "img", ",", "width", ",", "height", ",", "onresample", ")", "{", "var", "load", "=", "typeof", "img", "==", "\"string\"", ",", "i", "=", "load", "||", "img", ";", "if", "(", "load", ")", "{", "i", "=", "new", "Image", ";", "// with propers callbacks", "i", ".", "onload", "=", "onload", ";", "i", ".", "onerror", "=", "onerror", ";", "}", "i", ".", "_onresample", "=", "onresample", ";", "i", ".", "_width", "=", "width", ";", "i", ".", "_height", "=", "height", ";", "load", "?", "(", "i", ".", "src", "=", "img", ")", ":", "onload", ".", "call", "(", "img", ")", ";", "}" ]
[ 4, 4 ]
[ 21, 5 ]
null
javascript
de
['de', 'de', 'de']
True
true
statement_block
cleanUpDependenciesOfFlow
(flow, stateShape)
null
Hilfsfunktion, löscht alle untergeordneten Abhängigkeiten wenn ein Flow von einem übergeordneten Prozess gelöscht wird
Hilfsfunktion, löscht alle untergeordneten Abhängigkeiten wenn ein Flow von einem übergeordneten Prozess gelöscht wird
function cleanUpDependenciesOfFlow(flow, stateShape) { let state; let processOperator; if (is(flow.sourceRef, 'fpb:State')) { state = flow.sourceRef; processOperator = flow.targetRef; } else { state = flow.targetRef; processOperator = flow.sourceRef; }; // Der verbundene ProcessOperator wurde bereits dekomponiert let decomposedProcess = processOperatorShape.businessObject.decomposedView; let decomposedProcessSystemLimit = getElementsFromElementsContainer(decomposedProcess.businessObject.elementsContainer, 'fpb:SystemLimit')[0]; // Löschen des States und dessen Connections aus dem dekomponierten Prozess let stateInDecomposedProcess = getElementById(decomposedProcessSystemLimit.businessObject.elementsContainer, stateShape.id); stateInDecomposedProcess.outgoing.forEach(function (flow) { collectionRemove(decomposedProcessSystemLimit.businessObject.elementsContainer, flow); collectionRemove(flow.businessObject.targetRef.incoming, flow.businessObject); }); stateInDecomposedProcess.incoming.forEach(function (flow) { collectionRemove(decomposedProcessSystemLimit.businessObject.elementsContainer, flow); }); collectionRemove(decomposedProcessSystemLimit.businessObject.elementsContainer, stateInDecomposedProcess); collectionRemove(decomposedProcess.businessObject.consistsOfStates, stateInDecomposedProcess.businessObject); }
[ "function", "cleanUpDependenciesOfFlow", "(", "flow", ",", "stateShape", ")", "{", "let", "state", ";", "let", "processOperator", ";", "if", "(", "is", "(", "flow", ".", "sourceRef", ",", "'fpb:State'", ")", ")", "{", "state", "=", "flow", ".", "sourceRef", ";", "processOperator", "=", "flow", ".", "targetRef", ";", "}", "else", "{", "state", "=", "flow", ".", "targetRef", ";", "processOperator", "=", "flow", ".", "sourceRef", ";", "}", ";", "// Der verbundene ProcessOperator wurde bereits dekomponiert", "let", "decomposedProcess", "=", "processOperatorShape", ".", "businessObject", ".", "decomposedView", ";", "let", "decomposedProcessSystemLimit", "=", "getElementsFromElementsContainer", "(", "decomposedProcess", ".", "businessObject", ".", "elementsContainer", ",", "'fpb:SystemLimit'", ")", "[", "0", "]", ";", "// Löschen des States und dessen Connections aus dem dekomponierten Prozess", "let", "stateInDecomposedProcess", "=", "getElementById", "(", "decomposedProcessSystemLimit", ".", "businessObject", ".", "elementsContainer", ",", "stateShape", ".", "id", ")", ";", "stateInDecomposedProcess", ".", "outgoing", ".", "forEach", "(", "function", "(", "flow", ")", "{", "collectionRemove", "(", "decomposedProcessSystemLimit", ".", "businessObject", ".", "elementsContainer", ",", "flow", ")", ";", "collectionRemove", "(", "flow", ".", "businessObject", ".", "targetRef", ".", "incoming", ",", "flow", ".", "businessObject", ")", ";", "}", ")", ";", "stateInDecomposedProcess", ".", "incoming", ".", "forEach", "(", "function", "(", "flow", ")", "{", "collectionRemove", "(", "decomposedProcessSystemLimit", ".", "businessObject", ".", "elementsContainer", ",", "flow", ")", ";", "}", ")", ";", "collectionRemove", "(", "decomposedProcessSystemLimit", ".", "businessObject", ".", "elementsContainer", ",", "stateInDecomposedProcess", ")", ";", "collectionRemove", "(", "decomposedProcess", ".", "businessObject", ".", "consistsOfStates", ",", "stateInDecomposedProcess", ".", "businessObject", ")", ";", "}" ]
[ 777, 0 ]
[ 807, 1 ]
null
javascript
de
['de', 'de', 'de']
True
true
program