|
|
@ -148,8 +148,17 @@ |
|
|
|
rawRecipes = []; |
|
|
|
}; |
|
|
|
|
|
|
|
return { |
|
|
|
apply: function(details) { |
|
|
|
// true = blocked, false = not blocked
|
|
|
|
var evaluateRuleParts = function(matrix, scope, parts) { |
|
|
|
if ( parts[0].endsWith(':') ) { |
|
|
|
return matrix.evaluateSwitchZ(parts[0].slice(0, -1), scope); |
|
|
|
} |
|
|
|
return matrix.evaluateCellZXY(scope, parts[1], parts[2]) === 1; |
|
|
|
}; |
|
|
|
|
|
|
|
var api = {}; |
|
|
|
|
|
|
|
api.apply = function(details) { |
|
|
|
let µm = µMatrix; |
|
|
|
let tMatrix = µm.tMatrix; |
|
|
|
let pMatrix = µm.pMatrix; |
|
|
@ -188,8 +197,9 @@ |
|
|
|
if ( mustPersist ) { |
|
|
|
µm.saveMatrix(); |
|
|
|
} |
|
|
|
}, |
|
|
|
fetch: function(srcHostname, desHostnames, callback) { |
|
|
|
}; |
|
|
|
|
|
|
|
api.fetch = function(srcHostname, desHostnames, callback) { |
|
|
|
fromPendingStrings(); |
|
|
|
let out = []; |
|
|
|
let fetched = new Set(); |
|
|
@ -212,35 +222,44 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
callback(out); |
|
|
|
}, |
|
|
|
commitStatuses: function(details) { |
|
|
|
let matrix = µMatrix.pMatrix; |
|
|
|
}; |
|
|
|
|
|
|
|
api.statuses = function(details) { |
|
|
|
let pMatrix = µMatrix.pMatrix, |
|
|
|
tMatrix = µMatrix.tMatrix; |
|
|
|
for ( let recipe of details.recipes ) { |
|
|
|
let ruleIter = new µMatrix.LineIterator(recipe.ruleset); |
|
|
|
while ( ruleIter.eot() === false ) { |
|
|
|
let parts = ruleIter.next().split(/\s+/); |
|
|
|
if ( |
|
|
|
matrix.evaluateCellZXY( |
|
|
|
details.scope, |
|
|
|
parts[1], |
|
|
|
parts[2] |
|
|
|
) === 1 |
|
|
|
recipe.mustCommit !== true && |
|
|
|
evaluateRuleParts(pMatrix, details.scope, parts) |
|
|
|
) { |
|
|
|
recipe.mustCommit = true; |
|
|
|
break; |
|
|
|
if ( recipe.mustImport ) { break; } |
|
|
|
} |
|
|
|
if ( |
|
|
|
recipe.mustImport !== true && |
|
|
|
evaluateRuleParts(tMatrix, details.scope, parts) |
|
|
|
) { |
|
|
|
recipe.mustImport = true; |
|
|
|
if ( recipe.mustCommit ) { break; } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return details; |
|
|
|
}, |
|
|
|
fromString: function(raw) { |
|
|
|
}; |
|
|
|
|
|
|
|
api.fromString = function(raw) { |
|
|
|
rawRecipes.push(raw); |
|
|
|
}, |
|
|
|
reset: function() { |
|
|
|
}; |
|
|
|
|
|
|
|
api.reset = function() { |
|
|
|
rawRecipes.length = 0; |
|
|
|
recipeBook.clear(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
return api; |
|
|
|
})(); |
|
|
|
|
|
|
|
/******************************************************************************/ |