[context] min cleanup
This commit is contained in:
parent
91512adbb2
commit
544ee489a4
|
@ -30,47 +30,45 @@ type T struct {
|
||||||
* @return outName<outType> outDesc
|
* @return outName<outType> outDesc
|
||||||
*
|
*
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
|
|
||||||
func Create(win float64, optional... uint16) (*T, error) {
|
func Create(win float64, optional... uint16) (*T, error) {
|
||||||
|
|
||||||
var instance = new(T);
|
var inst = new(T);
|
||||||
|
|
||||||
/* (1) Window size error */
|
/* (1) Window size error */
|
||||||
if win < 0 { return nil, errors.New("Window size must be positive and is negative") }
|
if win < 0 { return nil, errors.New("Window size must be positive and is negative") }
|
||||||
instance.win = win;
|
inst.win = win;
|
||||||
|
|
||||||
/* (2) Default values */
|
/* (2) Default values */
|
||||||
instance.min = DefaultMin
|
inst.min = DefaultMin
|
||||||
instance.thr = DefaultThr
|
inst.thr = DefaultThr
|
||||||
instance.max = DefaultMax
|
inst.max = DefaultMax
|
||||||
|
|
||||||
/* (3) Optional 'min' */
|
/* (3) Optional 'min' */
|
||||||
if len(optional) > 0 {
|
if len(optional) > 0 {
|
||||||
|
|
||||||
if optional[0] < 0x0f { return nil, errors.New("Minimum depth must be greater than 0x0f (decimal 15) for consistency issues") }
|
if optional[0] < 0x0f {
|
||||||
|
return nil, errors.New("Minimum depth must be greater than 0x0f (decimal 15) for consistency issues")
|
||||||
instance.min = optional[0];
|
}
|
||||||
|
inst.min = optional[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (4) Optional 'thr' */
|
/* (4) Optional 'thr' */
|
||||||
if len(optional) > 1 {
|
if len(optional) > 1 {
|
||||||
instance.thr = optional[1];
|
inst.thr = optional[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (5) Optional 'max' */
|
/* (5) Optional 'max' */
|
||||||
if len(optional) > 2 {
|
if len(optional) > 2 {
|
||||||
|
|
||||||
if optional[2] <= instance.min+instance.thr {
|
if optional[2] <= inst.min+inst.thr {
|
||||||
return nil, errors.New("Minimum depth must be greater than 0x0f (decimal 15) for consistency issues")
|
return nil, errors.New("Minimum depth must be greater than 0x0f (decimal 15) for consistency issues")
|
||||||
}
|
}
|
||||||
|
inst.max = optional[2];
|
||||||
instance.max = optional[2];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance, nil
|
return inst, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (4) Getters */
|
/* (4) Getters */
|
||||||
|
|
Loading…
Reference in New Issue