Open Execution AND Close Execution objects implemented

This commit is contained in:
Luis Fernando Molina committed 2019-07-16 19:36:16 +02:00
1 parent 4ab1dfefd7
commit 02c471c44b
11 files changed
+285 -7

No files matched your search

@@ -82,6 +82,16 @@ function newAttachDetach () {
completeDetachment(node, rootNodes)
return
}
case 'Open Execution': {
node.payload.parentNode.openExecution = undefined
completeDetachment(node, rootNodes)
return
}
case 'Close Execution': {
node.payload.parentNode.closeExecution = undefined
completeDetachment(node, rootNodes)
return
}
case 'Stop': {
node.payload.parentNode.stopLoss = undefined
completeDetachment(node, rootNodes)
@@ -224,6 +234,20 @@ function newAttachDetach () {
completeAttachment(node, rootNodes)
}
break
case 'Open Execution': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.openExecution = node
completeAttachment(node, rootNodes)
}
break
case 'Close Execution': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
node.payload.parentNode.closeExecution = node
completeAttachment(node, rootNodes)
}
break
case 'Trigger On Event': {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
@@ -41,6 +41,12 @@ function newNodeChildren () {
case 'Initial Definition': {
return countChildrenInitialDefinition(parentNode, childNode)
}
case 'Open Execution': {
return countChildrenOpenExecution(parentNode, childNode)
}
case 'Close Execution': {
return countChildrenCloseExecution(parentNode, childNode)
}
case 'Next Phase Event': {
return countChildrenEvent(parentNode, childNode)
}
@@ -291,6 +297,22 @@ function newNodeChildren () {
return response
}
function countChildrenOpenExecution (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenCloseExecution (parentNode, childNode) {
let response = {
childrenCount: 0,
childIndex: undefined
}
return response
}
function countChildrenEvent (parentNode, childNode) {
let response = {
childrenCount: 0,
@@ -12,6 +12,8 @@ function newNodeDeleter () {
deletePositionSize: deletePositionSize,
deletePositionRate: deletePositionRate,
deleteInitialDefinition: deleteInitialDefinition,
deleteOpenExecution: deleteOpenExecution,
deleteCloseExecution: deleteCloseExecution,
deleteEvent: deleteEvent,
deleteManagedItem: deleteManagedItem,
deletePhase: deletePhase,
@@ -76,6 +78,14 @@ function newNodeDeleter () {
deleteInitialDefinition(rootNode, rootNodes)
break
}
case 'Open Execution': {
deleteOpenExecution(rootNode, rootNodes)
break
}
case 'Close Execution': {
deleteCloseExecution(rootNode, rootNodes)
break
}
case 'Event': {
deleteEvent(rootNode, rootNodes)
break
@@ -232,6 +242,11 @@ function newNodeDeleter () {
if (node.initialDefinition !== undefined) {
deleteInitialDefinition(node.initialDefinition, rootNodes)
}
if (node.openExecution !== undefined) {
deleteOpenExecution(node.openExecution, rootNodes)
}
destroyPart(node)
cleanNode(node)
}
@@ -260,6 +275,9 @@ function newNodeDeleter () {
} else {
completeDeletion(node, rootNodes)
}
if (node.closeExecution !== undefined) {
deleteCloseExecution(node.closeExecution, rootNodes)
}
destroyPart(node)
cleanNode(node)
}
@@ -315,6 +333,28 @@ function newNodeDeleter () {
cleanNode(node)
}
function deleteOpenExecution (node, rootNodes) {
let payload = node.payload
if (payload.parentNode !== undefined) {
payload.parentNode.openExecution = undefined
} else {
completeDeletion(node, rootNodes)
}
destroyPart(node)
cleanNode(node)
}
function deleteCloseExecution (node, rootNodes) {
let payload = node.payload
if (payload.parentNode !== undefined) {
payload.parentNode.closeExecution = undefined
} else {
completeDeletion(node, rootNodes)
}
destroyPart(node)
cleanNode(node)
}
function deleteEvent (node, rootNodes) {
let payload = node.payload
if (payload.parentNode !== undefined) {
@@ -8,6 +8,8 @@ function newPartsFromNodes () {
addMissingEvents: addMissingEvents,
addMissingItems: addMissingItems,
addInitialDefinition: addInitialDefinition,
addOpenExecution: addOpenExecution,
addCloseExecution: addCloseExecution,
addPhase: addPhase,
addFormula: addFormula,
addNextPhaseEvent: addNextPhaseEvent,
@@ -102,6 +104,16 @@ function newPartsFromNodes () {
}
return
}
case 'Open Execution':
{
createPart('Open Execution', node.name, node, parentNode, chainParent, 'Open Execution')
return
}
case 'Close Execution':
{
createPart('Close Execution', node.name, node, parentNode, chainParent, 'Close Execution')
return
}
case 'Initial Definition': {
createPart('Initial Definition', node.name, node, parentNode, chainParent, 'Initial Definition')
@@ -498,6 +510,20 @@ function newPartsFromNodes () {
}
}
function addOpenExecution (node) {
if (node.openExecution === undefined) {
node.openExecution = {}
createPart('Open Execution', '', node.openExecution, node, node)
}
}
function addCloseExecution (node) {
if (node.closeExecution === undefined) {
node.closeExecution = {}
createPart('Open Execution', '', node.closeExecution, node, node)
}
}
function addFormula (node) {
if (node.formula === undefined) {
node.formula = {
@@ -637,4 +663,3 @@ function newPartsFromNodes () {
canvas.floatingSpace.strategyPartConstructor.createStrategyPart(payload)
}
}
@@ -157,6 +157,22 @@ function newProtocolNode () {
}
return object
}
case 'Open Execution': {
let object = {
type: node.type,
subType: node.subType,
name: node.name
}
return object
}
case 'Close Execution': {
let object = {
type: node.type,
subType: node.subType,
name: node.name
}
return object
}
case 'Position Size': {
let object = {
type: node.type,
@@ -183,6 +183,26 @@ function newStringifyNode () {
}
return object
}
case 'Open Execution': {
let object = {
id: node.id,
type: node.type,
subType: node.subType,
name: node.name,
savedPayload: getSavedPayload(node)
}
return object
}
case 'Close Execution': {
let object = {
id: node.id,
type: node.type,
subType: node.subType,
name: node.name,
savedPayload: getSavedPayload(node)
}
return object
}
case 'Position Size': {
let object = {
id: node.id,