From a201a33aa434130b4a8b19941c6e4f330f8b0807 Mon Sep 17 00:00:00 2001 From: Mirco Nasuti <mirco.nasuti@chuv.ch> Date: Fri, 17 Jun 2016 12:15:51 +0200 Subject: [PATCH] add algorithm related models --- .../mip/model/algorithm/AlgoConstraint.java | 54 +++++++++ .../mip/model/algorithm/AlgoParameter.java | 74 ++++++++++++ .../hbp/mip/model/algorithm/Algorithm.java | 108 ++++++++++++++++++ .../org/hbp/mip/model/algorithm/Catalog.java | 28 +++++ .../hbp/mip/model/algorithm/ConstrMinMax.java | 37 ++++++ .../mip/model/algorithm/ConstrVariable.java | 44 +++++++ .../mip/model/algorithm/ParamConstraint.java | 34 ++++++ 7 files changed, 379 insertions(+) create mode 100644 src/main/java/org/hbp/mip/model/algorithm/AlgoConstraint.java create mode 100644 src/main/java/org/hbp/mip/model/algorithm/AlgoParameter.java create mode 100644 src/main/java/org/hbp/mip/model/algorithm/Algorithm.java create mode 100644 src/main/java/org/hbp/mip/model/algorithm/Catalog.java create mode 100644 src/main/java/org/hbp/mip/model/algorithm/ConstrMinMax.java create mode 100644 src/main/java/org/hbp/mip/model/algorithm/ConstrVariable.java create mode 100644 src/main/java/org/hbp/mip/model/algorithm/ParamConstraint.java diff --git a/src/main/java/org/hbp/mip/model/algorithm/AlgoConstraint.java b/src/main/java/org/hbp/mip/model/algorithm/AlgoConstraint.java new file mode 100644 index 000000000..af90d4291 --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/AlgoConstraint.java @@ -0,0 +1,54 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AlgoConstraint { + + private ConstrVariable variable; + + private ConstrMinMax groupings; + + private ConstrMinMax covariables; + + private Boolean mixed; + + + public ConstrVariable getVariable() { + return variable; + } + + public void setVariable(ConstrVariable variable) { + this.variable = variable; + } + + public ConstrMinMax getGroupings() { + return groupings; + } + + public void setGroupings(ConstrMinMax groupings) { + this.groupings = groupings; + } + + public ConstrMinMax getCovariables() { + return covariables; + } + + public void setCovariables(ConstrMinMax covariables) { + this.covariables = covariables; + } + + public Boolean getMixed() { + return mixed; + } + + public void setMixed(Boolean mixed) { + this.mixed = mixed; + } +} diff --git a/src/main/java/org/hbp/mip/model/algorithm/AlgoParameter.java b/src/main/java/org/hbp/mip/model/algorithm/AlgoParameter.java new file mode 100644 index 000000000..2b23d14fd --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/AlgoParameter.java @@ -0,0 +1,74 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AlgoParameter { + + private String code; + + private String label; + + private Integer defaultValue; + + private String type; + + private ParamConstraint constraints; + + private String description; + + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public Integer getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Integer defaultValue) { + this.defaultValue = defaultValue; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ParamConstraint getConstraints() { + return constraints; + } + + public void setConstraints(ParamConstraint constraints) { + this.constraints = constraints; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/src/main/java/org/hbp/mip/model/algorithm/Algorithm.java b/src/main/java/org/hbp/mip/model/algorithm/Algorithm.java new file mode 100644 index 000000000..2b2897c08 --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/Algorithm.java @@ -0,0 +1,108 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; + +import java.util.List; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Algorithm { + + private String code; + + private String label; + + private List type; + + private String environment; + + private String description; + + private List<AlgoParameter> parameters; + + @JsonProperty("docker_image") + private String dockerImage; + + private AlgoConstraint constraints; + + private Boolean disable; + + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public List getType() { + return type; + } + + public void setType(List type) { + this.type = type; + } + + public String getEnvironment() { + return environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List<AlgoParameter> getParameters() { + return parameters; + } + + public void setParameters(List<AlgoParameter> parameters) { + this.parameters = parameters; + } + + public String getDockerImage() { + return dockerImage; + } + + public void setDockerImage(String dockerImage) { + this.dockerImage = dockerImage; + } + + public AlgoConstraint getConstraints() { + return constraints; + } + + public void setConstraints(AlgoConstraint constraints) { + this.constraints = constraints; + } + + public Boolean getDisable() { + return disable; + } + + public void setDisable(Boolean disable) { + this.disable = disable; + } +} diff --git a/src/main/java/org/hbp/mip/model/algorithm/Catalog.java b/src/main/java/org/hbp/mip/model/algorithm/Catalog.java new file mode 100644 index 000000000..c2c8c451f --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/Catalog.java @@ -0,0 +1,28 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; + +import java.util.List; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Catalog { + + private List<Algorithm> algorithms; + + private List<Algorithm> validations; + + + public List<Algorithm> getAlgorithms() { + return algorithms; + } + + public void setAlgorithms(List<Algorithm> algorithms) { + this.algorithms = algorithms; + } +} diff --git a/src/main/java/org/hbp/mip/model/algorithm/ConstrMinMax.java b/src/main/java/org/hbp/mip/model/algorithm/ConstrMinMax.java new file mode 100644 index 000000000..6532175bb --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/ConstrMinMax.java @@ -0,0 +1,37 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ConstrMinMax { + + @JsonProperty("min_count") + private Integer minCount; + + @JsonProperty("max_count") + private Integer maxCount; + + + public Integer getMinCount() { + return minCount; + } + + public void setMinCount(Integer minCount) { + this.minCount = minCount; + } + + public Integer getMaxCount() { + return maxCount; + } + + public void setMaxCount(Integer maxCount) { + this.maxCount = maxCount; + } +} diff --git a/src/main/java/org/hbp/mip/model/algorithm/ConstrVariable.java b/src/main/java/org/hbp/mip/model/algorithm/ConstrVariable.java new file mode 100644 index 000000000..21a35158f --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/ConstrVariable.java @@ -0,0 +1,44 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ConstrVariable { + + private Boolean real; + + private Boolean binomial; + + private Boolean polynomial; + + + public Boolean getReal() { + return real; + } + + public void setReal(Boolean real) { + this.real = real; + } + + public Boolean getBinomial() { + return binomial; + } + + public void setBinomial(Boolean binomial) { + this.binomial = binomial; + } + + public Boolean getPolynomial() { + return polynomial; + } + + public void setPolynomial(Boolean polynomial) { + this.polynomial = polynomial; + } +} diff --git a/src/main/java/org/hbp/mip/model/algorithm/ParamConstraint.java b/src/main/java/org/hbp/mip/model/algorithm/ParamConstraint.java new file mode 100644 index 000000000..0cc94d30a --- /dev/null +++ b/src/main/java/org/hbp/mip/model/algorithm/ParamConstraint.java @@ -0,0 +1,34 @@ +package org.hbp.mip.model.algorithm; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; + +/** + * Created by mirco on 17.06.16. + */ + +@ApiModel +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ParamConstraint { + + private Integer min; + + private Integer max; + + + public Integer getMin() { + return min; + } + + public void setMin(Integer min) { + this.min = min; + } + + public Integer getMax() { + return max; + } + + public void setMax(Integer max) { + this.max = max; + } +} -- GitLab