Skip to content
Snippets Groups Projects
FeaturePoint.java 2.08 KiB
Newer Older
package cz.fidentis.analyst.feature;

import cz.fidentis.analyst.feature.api.IPosition;

import java.io.Serializable;
import javax.vecmath.Point3d;
public class FeaturePoint implements IPosition, Serializable {
    private final FeaturePointType featurePointType;
     * @param y Location y
     * @param z Location z
     * @param featurePointType Original type
     */
    public FeaturePoint(double x, double y, double z, FeaturePointType featurePointType) {
        this.position = new Point3d(x, y, z);
        this.featurePointType = featurePointType;
    public Point3d getPosition() {
        return position;
    public FeaturePointType getFeaturePointType() {
        return featurePointType;

    @Override
    public boolean equals(Object o) {
        // self check
        if (this == o) {
            return true;
        }
        // null check
        if (o == null) {
            return false;
        }
        // type check and cast
        if (getClass() != o.getClass()) {
            return false;
        }
        FeaturePoint fp = (FeaturePoint) o;
        // field comparison
        return Objects.equals(position.x, fp.position.x)
                && Objects.equals(position.y, fp.position.y)
                && Objects.equals(position.z, fp.position.z)
                && Objects.equals(featurePointType.getCode(), fp.featurePointType.getCode())
                && Objects.equals(featurePointType.getInfo(), fp.featurePointType.getInfo())
                && Objects.equals(featurePointType.getName(), fp.featurePointType.getName())
                && Objects.equals(featurePointType.getType(), fp.featurePointType.getType());
    }

    /**
     * generated hash code function
     * 
     * @return 
     */
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 23 * hash + Objects.hashCode(this.position);
        hash = 23 * hash + Objects.hashCode(this.featurePointType);
        return hash;
    }