All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.TKnudsen.ComplexDataObject.model.weighting.Long.LinearLongWeightingKernel Maven / Gradle / Ivy

Go to download

A library that models real-world objects in Java, referred to as ComplexDataObjects. Other features: IO and preprocessing of ComplexDataObjects.

The newest version!
package com.github.TKnudsen.ComplexDataObject.model.weighting.Long;

/**
 * 
 * ComplexDataObject
 *
 * Copyright: (c) 2016-2018 Juergen Bernard,
 * https://github.com/TKnudsen/ComplexDataObject
*
* * Linear kernel applied on long distances. *

* * @author Juergen Bernard * * @version 1.01 */ public class LinearLongWeightingKernel implements ILongWeightingKernel { private Long reference; private Long interval; /** * for serialization */ @SuppressWarnings("unused") private LinearLongWeightingKernel() { this(10L); } public LinearLongWeightingKernel(Long interval) { this.interval = interval; } @Override public Long getInterval() { return interval; } @Override public void setInterval(Long t) { this.interval = t; } @Override public double getWeight(Long t) { if (Math.abs(reference - t) > interval) return 0.0; if (interval == 0) return 1.0; return 1.0 - (Math.abs(reference - t) / (double) interval); } @Override public Long getReference() { return reference; } @Override public void setReference(Long t) { this.reference = t; } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof LinearLongWeightingKernel)) return false; LinearLongWeightingKernel other = (LinearLongWeightingKernel) o; return other.interval == interval && other.reference == reference; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy