com.github.TKnudsen.ComplexDataObject.model.weighting.Integer.BlockKernel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of complex-data-object Show documentation
Show all versions of complex-data-object Show documentation
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.Integer;
/**
*
* Title: BlockKernel
*
*
*
* Description:
*
*
*
* Copyright: Copyright (c) 2016-2017
*
*
* @author Juergen Bernard
* @version 1.02
*/
public class BlockKernel implements IIntegerWeightingKernel {
private Integer reference;
private Integer interval;
/**
* for serialization
*/
public BlockKernel() {
this.interval = 3;
}
public BlockKernel(Integer interval) {
this.interval = interval;
}
@Override
public Integer getInterval() {
return interval;
}
@Override
public void setInterval(Integer t) {
this.interval = t;
}
@Override
public double getWeight(Integer t) {
if (Math.abs(reference - t) > interval)
return 0.0;
return 1.0;
}
@Override
public Integer getReference() {
return reference;
}
@Override
public void setReference(Integer t) {
this.reference = t.intValue();
}
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof BlockKernel))
return false;
BlockKernel other = (BlockKernel) o;
return other.interval == interval && other.reference == reference;
}
}