All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lumiomedical.flow.node.SimpleNode Maven / Gradle / Ivy

Go to download

A library providing an opinionated way of structuring data processing programs such as ETLs

The newest version!
package com.lumiomedical.flow.node;

import java.util.Collections;
import java.util.List;

/**
 * @author Pierre Lecerf ([email protected])
 * Created on 2020/03/02
 */
public abstract class SimpleNode extends AbstractNode
{
    private final T actor;
    Node upstream;

    /**
     *
     * @param actor
     */
    public SimpleNode(T actor)
    {
        super();
        this.actor = actor;
    }

    /**
     *
     * @return
     */
    public T getActor()
    {
        return this.actor;
    }

    /**
     *
     * @param other
     */
    protected void bind(SimpleNode other)
    {
        if (other.upstream != null)
            throw new RuntimeException(
                "You are attempting an illegal binding: the other node already has an upstream binding towards "
                    + other.upstream.getClass() + "#" + other.upstream.getUid()
            );
        this.downstream.add(other);
        other.upstream = this;
        other.after(this);
    }

    /**
     *
     * @return
     */
    public Node getSimpleUpstream()
    {
        return this.upstream;
    }

    @Override
    public List getUpstream()
    {
        if (this.upstream == null)
            return Collections.emptyList();
        return Collections.singletonList(this.upstream);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy