Skip to content

Commit

Permalink
Add check for multiple inputs into a self port
Browse files Browse the repository at this point in the history
  • Loading branch information
james-strauss-uwa committed Jul 2, 2024
1 parent 59e3fc0 commit 44ce930
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ export class Field {
errorsWarnings.warnings.push(issue);
}

//chack that the field has a known type
// check that the field has a known type
if (!Utils.validateType(field.getType())) {
const issue: Errors.Issue = Errors.ShowFix("Node " + node.getKey() + " (" + node.getName() + ") has a component parameter (" + field.getDisplayText() + ") whose type (" + field.getType() + ") is unknown", function(){Utils.showField(eagle, node.getId(),field)}, function(){Utils.fixFieldType(eagle, field)}, "Prepend existing type (" + field.getType() + ") with 'Object.'");
errorsWarnings.warnings.push(issue);
Expand All @@ -885,7 +885,7 @@ export class Field {
errorsWarnings.errors.push(issue);
}

//check that the field has a unique display text on the node
// check that the field has a unique display text on the node
for (let j = 0 ; j < node.getFields().length ; j++){
const field1 = node.getFields()[j];
if(field === field1){
Expand All @@ -903,6 +903,20 @@ export class Field {
}
}

// check that PythonObject's self port is input for only one edge
if (node.getCategory() === Category.PythonObject && field.getDisplayText() === Daliuge.FieldName.SELF){
let numSelfPortConnections: number = 0;
for (const edge of eagle.logicalGraph().getEdges()){
if (edge.getDestPortId() === field.getId()){
numSelfPortConnections += 1;
}
}

if (numSelfPortConnections > 1){
errorsWarnings.errors.push(Errors.Message("Port " + field.getDisplayText() + " on node " + node.getName() + " cannot have multiple inputs."));
}
}

// check that fields have parameter types that are suitable for this node
// skip the 'drop class' component parameter, those are always suitable for every node
if (field.getDisplayText() != Daliuge.FieldName.DROP_CLASS && field.getParameterType() != Daliuge.FieldType.ComponentParameter){
Expand Down

0 comments on commit 44ce930

Please sign in to comment.