Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.sigopt.model.Experiment Maven / Gradle / Ivy
package com.sigopt.model;
import com.sigopt.net.APIMethodCaller;
import com.sigopt.net.PaginatedAPIMethodCaller;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Experiment extends StructObject {
public Experiment() {
super();
}
public Experiment(String id) {
super();
this.set("id", id);
}
public String getId() {
return (String) this.get("id");
}
public String getType() {
return (String) this.get("type");
}
public String getName() {
return (String) this.get("name");
}
public List getParameters() {
return Utils.mergeIntoList(new ArrayList(), this.get("parameters"), Parameter.class);
}
public Metric getMetric() {
return Utils.mergeInto(new Metric(), this.get("metric"));
}
public Progress getProgress() {
return Utils.mergeInto(new Progress(), this.get("progress"));
}
public Metadata getMetadata() {
return Utils.mergeInto(new Metadata(), this.get("metadata"));
}
public String getClient() {
return (String) this.get("client");
}
public String getState() {
return (String) this.get("state");
}
public Integer getCreated() {
return Utils.asInteger(this.get("created"));
}
public Integer getObservationBudget() {
return Utils.asInteger(this.get("observation_budget"));
}
public Boolean getDevelopment() {
return (Boolean) this.get("development");
}
public static APIMethodCaller fetch() {
return new APIMethodCaller("get", "/experiments/:id", Experiment.class);
}
public static APIMethodCaller fetch(String id) {
return Experiment.fetch().addPathComponent("id", id);
}
public static PaginatedAPIMethodCaller list() {
return new PaginatedAPIMethodCaller("get", "/experiments", Experiment.class);
}
public static APIMethodCaller create() {
return new APIMethodCaller("post", "/experiments", Experiment.class);
}
public static APIMethodCaller create(Experiment e) {
return Experiment.create().data(e);
}
public static APIMethodCaller update() {
return new APIMethodCaller("put", "/experiments/:id", Experiment.class);
}
public static APIMethodCaller update(String id) {
return Experiment.update().addPathComponent("id", id);
}
public static APIMethodCaller update(String id, Experiment e) {
return Experiment.update(id).data(e);
}
public static APIMethodCaller delete() {
return new APIMethodCaller("delete", "/experiments/:id", VoidObject.class);
}
public static APIMethodCaller delete(String id) {
return Experiment.delete().addPathComponent("id", id);
}
public static class Subresource extends BoundObject {
String name;
Class klass;
public Subresource(String prefix, String name, Class klass) {
super(prefix);
this.name = name;
this.klass = klass;
}
public APIMethodCaller fetch() {
return new APIMethodCaller("get", this.prefix() + "/" + this.name + "/:id", klass);
}
public APIMethodCaller fetch(String id) {
return this.fetch().addParam("id", id);
}
public PaginatedAPIMethodCaller list() {
return new PaginatedAPIMethodCaller("get", this.prefix() + "/" + this.name, klass);
}
public APIMethodCaller create() {
return new APIMethodCaller("post", this.prefix() + "/" + this.name, klass);
}
public APIMethodCaller create(T o) {
return this.create().data(o);
}
public APIMethodCaller update() {
return new APIMethodCaller("put", this.prefix() + "/" + this.name + "/:id", klass);
}
public APIMethodCaller update(String id) {
return this.update().addPathComponent("id", id);
}
public APIMethodCaller update(String id, T o) {
return this.update(id).data(o);
}
public APIMethodCaller deleteList() {
return new APIMethodCaller("delete", this.prefix() + "/" + this.name, VoidObject.class);
}
public APIMethodCaller delete() {
return new APIMethodCaller("delete", this.prefix() + "/" + this.name + "/:id", VoidObject.class);
}
public APIMethodCaller delete(String id) {
return this.delete().addPathComponent("id", id);
}
}
public Subresource observations() {
return new Subresource("/experiments/" + this.getId(), "observations", Observation.class);
}
public Subresource suggestions() {
return new Subresource("/experiments/" + this.getId(), "suggestions", Suggestion.class);
}
public Subresource tokens() {
return new Subresource("/experiments/" + this.getId(), "tokens", Token.class);
}
public static class Builder {
Experiment e;
public Builder() {
this.e = new Experiment();
}
public Experiment build() {
return this.e;
}
public Builder created(int created) {
this.e.set("created", created);
return this;
}
public Builder parameters(List parameters) {
this.e.set("parameters", parameters);
return this;
}
public Builder metadata(Map metadata) {
this.e.set("metadata", metadata);
return this;
}
public Builder metric(Metric metric) {
this.e.set("metric", metric);
return this;
}
public Builder progress(Progress progress) {
this.e.set("progress", progress);
return this;
}
public Builder client(String client) {
this.e.set("client", client);
return this;
}
public Builder id(String id) {
this.e.set("id", id);
return this;
}
public Builder name(String name) {
this.e.set("name", name);
return this;
}
public Builder state(String state) {
this.e.set("state", state);
return this;
}
public Builder type(String type) {
this.e.set("type", type);
return this;
}
public Builder observationBudget(int budget) {
this.e.set("observation_budget", budget);
return this;
}
public Builder development(boolean development) {
this.e.set("development", development);
return this;
}
}
}