Sha256: 2663ad0ac7db846dfeb88dddde48fcdb57be2c830928a1f3c713e5e00f3e13de
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
package org.embulk.input; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import com.google.common.base.Objects; import java.util.ArrayList; import java.util.List; public class ParamsConfig { private final List<QueryConfig> queries; @JsonCreator public ParamsConfig(List<QueryConfig> queries) { this.queries = queries; } @JsonValue public List<QueryConfig> getQueries() { return queries; } public List<ParamsConfig> expandQueries() { List<List<QueryConfig>> base = new ArrayList<>(queries.size()); for (QueryConfig p : queries) { base.add(p.expand()); } int productSize = 1; int baseSize = base.size(); for (int i = 0; i < baseSize; productSize *= base.get(i).size(), i++); List<ParamsConfig> expands = new ArrayList<>(productSize); for(int i = 0; i < productSize; i++) { int j = 1; List<QueryConfig> query = new ArrayList<>(); for(List<QueryConfig> list : base) { QueryConfig pc = list.get((i / j) % list.size()); query.add(pc); j *= list.size(); } expands.add(new ParamsConfig(query)); } return expands; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ParamsConfig)) { return false; } ParamsConfig other = (ParamsConfig) obj; return Objects.equal(queries, other.queries); } @Override public int hashCode() { return Objects.hashCode(queries); } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
embulk-input-http-0.0.5 | src/main/java/org/embulk/input/ParamsConfig.java |
embulk-input-http-0.0.4 | src/main/java/org/embulk/input/ParamsConfig.java |