public class BasicKernel extends DiscreteKernel
DiscreteKernel.
It serves as the base implementation for many kernels, and should not be used as stand alone kernel.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
GUI_NAME
The GUI name for this kernel.
|
static boolean |
HAS_DELAY
Can a delay be set for this kernel.
|
static boolean |
HAS_OOBP
Does this kernel have an
OutOfBoundsPolicy. |
static boolean |
HAS_WIDTH
Does this kernel have a width.
|
static int |
NR_EXTRA_FIELDS
The number of extra fields for this kernel.
|
static java.lang.String |
SHORT_NAME
The short name for this kernel.
|
DEFAULT_OOB_POLICY, DEFAULT_WIDTH| Modifier and Type | Method and Description |
|---|---|
double[] |
applyTo(double[] theInput)
Deprecated.
|
double[] |
applyTo(double[] theInput,
int theDelay)
Apply the kernel to the specified array, with the specified delay.
|
java.lang.String |
getGuiText()
Deprecated.
|
boolean |
getHasDelay()
Deprecated.
|
boolean |
getHasOOBP()
Deprecated.
|
boolean |
getHasWidth()
Deprecated.
|
java.lang.String |
getInfo()
Returns the
String representation of this
Kernel. |
double[] |
getKernel()
Returns the discrete representation of this kernel.
|
int |
getNrExtraFields()
Deprecated.
|
java.lang.String |
getShortText()
Deprecated.
|
boolean |
isValidWidth(int theWidth)
Indicates whether
theWidth parameter is a valid width
for this Kernel. |
AbstractKernel |
setOutOfBoundsPolicy(OutOfBoundsPolicy thePolicy)
Sets the new
OutOfBoundsPolicy for the Kernel. |
AbstractKernel |
setWidth(int theWidth)
Sets the new
width for the Kernel. |
java.lang.String |
toString()
Returns the
String representation of this
Kernel. |
public static final java.lang.String GUI_NAME
public static final java.lang.String SHORT_NAME
public static final boolean HAS_WIDTH
public static final boolean HAS_OOBP
OutOfBoundsPolicy.public static final boolean HAS_DELAY
public static final int NR_EXTRA_FIELDS
public AbstractKernel setOutOfBoundsPolicy(OutOfBoundsPolicy thePolicy)
OutOfBoundsPolicy for the Kernel.
The OutOfBoundsPolicy controls the value used in the
array returned by the applyTo method,
for those values in the input array to which no whole
Kernel could be applied.setOutOfBoundsPolicy in class DiscreteKernelthePolicy - The OutOfBoundsPolicy to use.Kernel on which this method is called.OutOfBoundsPolicypublic AbstractKernel setWidth(int theWidth)
width for the Kernel.
When using the Kernel to calculate a value,
width controls the number of adjacent values that are
taken into account in the calculation to determine the end result.
By default width is defined as
DiscreteKernel.DEFAULT_WIDTH, for any new
width only odd positive values are allowed for any
BasicKernel and its subclasses.
This assures the applyTo method
functions properly.setWidth in class DiscreteKerneltheWidth - The new width to be used.Kernel on which this method is called.isValidWidth(int)public boolean isValidWidth(int theWidth)
theWidth parameter is a valid width
for this Kernel.
Note: BasicKernels accept only odd widths >
0.
Some Kernels may use even widths, they can override this
method.
However, they should then also override the applyTo
method.isValidWidth in class DiscreteKerneltheWidth - The width to test.true if theWidth parameter is a
valid width for this Kernel, false
otherwise.applyTo(double[])public double[] getKernel()
DiscreteKernelgetKernel in class DiscreteKernel@Deprecated public double[] applyTo(double[] theInput)
Kernel to some input array.
Values for which it is not possible to apply the whole
Kernel are set based on the OutOfBoundsPolicy.
Note: this method assumes the Kernel has a positive odd
width.applyTo in class AbstractKerneltheInput - The array on which to apply the Kernel.theInput,
containing the result of applying the Kernel to
theInput, or an empty array if theInput is
null.OutOfBoundsPolicy,
setWidth(int)public double[] applyTo(double[] theInput,
int theDelay)
AbstractKernel
The delay may be 0, positive or negative.
For a delay of 0 the values in the return array map
directly to the input array.
For a positive delay of n the values in the input array
are 'shifted' n indices to the right.
For a negative delay this 'shift' is to the left.
In general, for kernels for which AbstractKernel.getHasWidth() returns
true, the application of the kernel to the head and
tail of the input array is undefined.
This method will fill in the values for which this condition
applies by using the OutOfBoundsPolicy set for the kernel.
applyTo in class AbstractKerneltheInput - The array to apply the kernel to.theDelay - The delay to use.double[] with the result.@Deprecated public java.lang.String getGuiText()
AbstractKernel
For most kernels this method returns the same result as a call to
kernel.class.getSimpleName().
For some, the returned String will include some
white spaces that beak up the various words, such that it forms
regular text.
getGuiText in class AbstractKernelString.@Deprecated public java.lang.String getShortText()
AbstractKernelgetShortText in class AbstractKernelString indicative of the class name.@Deprecated public boolean getHasWidth()
AbstractKernel
This is true for a DiscreteKernel, and
false for a ContinuousKernel.
getHasWidth in class AbstractKerneltrue iff the kernel has a width,
false otherwise.ContinuousKernel,
DiscreteKernel@Deprecated public boolean getHasOOBP()
AbstractKernelOutOfBoundsPolicy.
This is true for a DiscreteKernel, and
false for a ContinuousKernel.
getHasOOBP in class AbstractKerneltrue iff the kernel has an out of
bounds policy, false otherwise.OutOfBoundsPolicy,
ContinuousKernel,
DiscreteKernel@Deprecated public boolean getHasDelay()
AbstractKernel
This is true for almost all kernels, but not for
MovingAverage.
getHasDelay in class AbstractKerneltrue iff a delay can be set for the
kernel, false otherwise.@Deprecated public int getNrExtraFields()
AbstractKernelExtra fields hold kernel specific configuration settings, not shared with other kernels.
getNrExtraFields in class AbstractKernelpublic java.lang.String toString()
String representation of this
Kernel.
The items between the braces represent the width and
OutOfBoundsPolicy used for this Kernel.toString in class AbstractKernelString representation of the kernel.public java.lang.String getInfo()
String representation of this
Kernel.
It includes the width and the values of the
Kernel itself.String representation of this
Kernel.