Skip to content

Commit

Permalink
Implemented workflow template
Browse files Browse the repository at this point in the history
  • Loading branch information
arminzavada committed Oct 16, 2024
1 parent 630366a commit 105d4b0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 84 deletions.

This file was deleted.

56 changes: 55 additions & 1 deletion similarity/src/main/jinja/workflow.java.j2
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
// TODO: create Workflow template!
package hu.bme.mit.ase.shingler.similarity;

import hu.bme.mit.ase.shingler.workflow.impl.*;
import hu.bme.mit.ase.shingler.workflow.lib.*;

public class {{ name }}Workflow extends Workflow<Double> {

// Input pin declarations
{%- for in_pin in inPins %}
public final Pin<String> {{ in_pin.name }} = new Pin<>();
{%- endfor %}

// Parameter declarations
{%- for param in parameters %}
private final {{ param.type }} {{ param.name }};
{%- endfor %}

public {{ name }}Workflow({% for param in parameters %}{{ param.type }} {{ param.name }}{% if not loop.last %}, {% endif %}{% endfor %}) {
{%- for param in parameters %}
this.{{ param.name }} = {{ param.name }};
{%- endfor %}
}

@Override
protected void initialize() {
{%- for worker in workers %}
var {{ worker.name }} = new {{ worker.type }}Worker(
{%- if worker.arguments -%}
{%- for argument in worker.arguments -%}
{{ argument }}
{%- if not loop.last -%}, {% endif -%}
{%- endfor -%}
{%- endif -%}
);
{%- endfor %}
{% for worker in workers %}
addWorker({{ worker.name }});
{%- endfor %}

setOutputPin({{ outPin.worker }}.outputPin);
{% for in_pin in inPins %}
var input{{ in_pin.name | capitalize }} = new Channel<>({{ in_pin.name }}, {{ in_pin.worker }}.{{ in_pin.pin }}Pin);
{%- endfor %}
{% for in_pin in inPins %}
addChannel(input{{ in_pin.name | capitalize }});
{%- endfor %}
{% for channel in channels %}
var {{ channel.name }} = new Channel<>({{ channel.fromWorker }}.outputPin, {{ channel.toWorker }}.{{ channel.toPin }}Pin);
{%- endfor %}
{% for channel in channels %}
addChannel({{ channel.name }});
{%- endfor %}
}

}

0 comments on commit 105d4b0

Please sign in to comment.