org.kie.pmml.commons.model.KiePMMLTargetValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kie-pmml-commons Show documentation
Show all versions of kie-pmml-commons Show documentation
Common code for PMML module
/*
* Copyright 2021 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.pmml.commons.model;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;
import org.kie.pmml.api.models.TargetValue;
import org.kie.pmml.commons.model.abstracts.AbstractKiePMMLComponent;
/**
* @see TargetValue
*/
public class KiePMMLTargetValue extends AbstractKiePMMLComponent {
private static final long serialVersionUID = -4948552909458142415L;
private final TargetValue targetValue;
private KiePMMLTargetValue(String name, List extensions, TargetValue targetValue) {
super(name, extensions);
this.targetValue = targetValue;
}
public static Builder builder(String name, List extensions, TargetValue targetValue) {
return new Builder(name, extensions, targetValue);
}
public String getValue() {
return targetValue.getValue();
}
public String getDisplayValue() {
return targetValue.getDisplayValue();
}
public Double getPriorProbability() {
return targetValue.getPriorProbability();
}
public Double getDefaultValue() {
return targetValue.getDefaultValue();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
KiePMMLTargetValue that = (KiePMMLTargetValue) o;
return Objects.equals(targetValue, that.targetValue);
}
@Override
public int hashCode() {
return Objects.hash(targetValue);
}
@Override
public String toString() {
return new StringJoiner(", ", KiePMMLTargetValue.class.getSimpleName() + "[", "]")
.add("targetValue='" + targetValue + "'")
.add("name='" + name + "'")
.add("extensions=" + extensions)
.add("id='" + id + "'")
.add("parentId='" + parentId + "'")
.toString();
}
public static class Builder extends AbstractKiePMMLComponent.Builder {
private Builder(String name, List extensions, TargetValue targetValue) {
super("TargetValue-", () -> new KiePMMLTargetValue(name, extensions, targetValue));
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy