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

com.imsweb.algorithms.AbstractAlgorithm Maven / Gradle / Ivy

/*
 * Copyright (C) 2020 Information Management Services, Inc.
 */
package com.imsweb.algorithms;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class AbstractAlgorithm implements Algorithm {

    protected String _id;
    protected String _name;
    protected String _version;
    protected String _url;

    protected List> _params;

    protected List _inputFields;
    protected List _outputFields;

    protected Map> _unknownValues;

    public AbstractAlgorithm(String id, String name, String version) {
        if (id == null)
            throw new RuntimeException("ID is required");
        if (name == null)
            throw new RuntimeException("Name is required");
        if (version == null)
            throw new RuntimeException("Version is required (use N/A if your algorithm doesn't support a version)");

        _id = id;
        _name = name;
        _version = version;

        _params = new ArrayList<>();

        _inputFields = new ArrayList<>();
        _outputFields = new ArrayList<>();

        _unknownValues = new HashMap<>();
    }

    @Override
    public String getId() {
        return _id;
    }

    @Override
    public String getName() {
        return _name;
    }

    @Override
    public String getVersion() {
        return _version;
    }

    @Override
    public String getDocumentationUrl() {
        return _url;
    }

    @Override
    public List> getParameters() {
        return _params;
    }

    @Override
    public List getInputFields() {
        return _inputFields;
    }

    @Override
    public List getOutputFields() {
        return _outputFields;
    }

    @Override
    public Map> getUnknownValues() {
        return _unknownValues;
    }

    @Override
    public abstract AlgorithmOutput execute(AlgorithmInput input);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy