|
| 1 | +/* |
| 2 | +* Copyright 2017 Basis Technology Corp. |
| 3 | +* |
| 4 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +* you may not use this file except in compliance with the License. |
| 6 | +* You may obtain a copy of the License at |
| 7 | +* |
| 8 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +* |
| 10 | +* Unless required by applicable law or agreed to in writing, software |
| 11 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +* See the License for the specific language governing permissions and |
| 14 | +* limitations under the License. |
| 15 | +*/ |
| 16 | +package com.basistech.rosette.apimodel; |
| 17 | + |
| 18 | +import javax.validation.constraints.DecimalMax; |
| 19 | +import javax.validation.constraints.DecimalMin; |
| 20 | +import java.util.Objects; |
| 21 | + |
| 22 | +public final class TopicsOptions extends Options { |
| 23 | + @DecimalMin("0.0") |
| 24 | + @DecimalMax("1.0") |
| 25 | + private Double conceptSalienceThreshold; |
| 26 | + @DecimalMin("0.0") |
| 27 | + @DecimalMax("1.0") |
| 28 | + private Double keyphraseSalienceThreshold; |
| 29 | + |
| 30 | + public TopicsOptions(Double conceptSalienceThreshold, Double keyphraseSalienceThreshold) { |
| 31 | + this.conceptSalienceThreshold = conceptSalienceThreshold; |
| 32 | + this.keyphraseSalienceThreshold = keyphraseSalienceThreshold; |
| 33 | + } |
| 34 | + |
| 35 | + public Double getconceptSalienceThreshold() { |
| 36 | + return conceptSalienceThreshold; |
| 37 | + } |
| 38 | + |
| 39 | + public Double getkeyphraseSalienceThreshold() { |
| 40 | + return keyphraseSalienceThreshold; |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public boolean equals(final Object obj) { |
| 45 | + if (this == obj) { |
| 46 | + return true; |
| 47 | + } else if (obj == null || getClass() != obj.getClass()) { |
| 48 | + return false; |
| 49 | + } |
| 50 | + final TopicsOptions that = (TopicsOptions) obj; |
| 51 | + return Objects.equals(conceptSalienceThreshold, that.conceptSalienceThreshold) |
| 52 | + && Objects.equals(keyphraseSalienceThreshold, that.keyphraseSalienceThreshold); |
| 53 | + } |
| 54 | + |
| 55 | + @Override |
| 56 | + public int hashCode() { |
| 57 | + return Objects.hash(conceptSalienceThreshold, keyphraseSalienceThreshold); |
| 58 | + } |
| 59 | + |
| 60 | + public static class Builder { |
| 61 | + private Double conceptSalienceThreshold; |
| 62 | + private Double keyphraseSalienceThreshold; |
| 63 | + |
| 64 | + public Builder() { |
| 65 | + // |
| 66 | + } |
| 67 | + |
| 68 | + public Builder conceptSalienceThreshold(Double conceptSalienceThreshold) { |
| 69 | + this.conceptSalienceThreshold = conceptSalienceThreshold; |
| 70 | + return this; |
| 71 | + } |
| 72 | + |
| 73 | + |
| 74 | + public Builder keyphraseSalienceThreshold(Double keyphraseSalienceThreshold) { |
| 75 | + this.keyphraseSalienceThreshold = keyphraseSalienceThreshold; |
| 76 | + return this; |
| 77 | + } |
| 78 | + |
| 79 | + public TopicsOptions build() { |
| 80 | + return new TopicsOptions(conceptSalienceThreshold, keyphraseSalienceThreshold); |
| 81 | + } |
| 82 | + } |
| 83 | + |
| 84 | +} |
0 commit comments