public class ShannonTermFeature extends java.lang.Object implements TermFeature
c ? f1 : f2
, whereby the
condition c
determines whether the value of the whole
expression is f1
(if c
returns zero, or more
general if c
returns a distinguished value
trueCost
) or f2
Modifier and Type | Field and Description |
---|---|
private TermFeature |
cond
The filter that decides which sub-feature is to be evaluated
|
private TermFeature |
elseFeature
The feature for negative results of
filter |
private TermFeature |
thenFeature
The feature for positive results of
filter |
private RuleAppCost |
trueCost
If the result of
cond is this cost, then the condition is
assumed to hold |
Modifier | Constructor and Description |
---|---|
private |
ShannonTermFeature(TermFeature p_cond,
RuleAppCost p_trueCost,
TermFeature p_thenFeature,
TermFeature p_elseFeature) |
Modifier and Type | Method and Description |
---|---|
RuleAppCost |
compute(Term term,
Services services) |
static TermFeature |
createConditionalBinary(TermFeature cond,
TermFeature thenFeature) |
static TermFeature |
createConditionalBinary(TermFeature cond,
TermFeature thenFeature,
TermFeature elseFeature) |
private final TermFeature cond
private final RuleAppCost trueCost
cond
is this cost, then the condition is
assumed to holdprivate final TermFeature thenFeature
filter
private final TermFeature elseFeature
filter
private ShannonTermFeature(TermFeature p_cond, RuleAppCost p_trueCost, TermFeature p_thenFeature, TermFeature p_elseFeature)
public RuleAppCost compute(Term term, Services services)
compute
in interface TermFeature
public static TermFeature createConditionalBinary(TermFeature cond, TermFeature thenFeature, TermFeature elseFeature)
cond
- the feature that decides which value is to be returnedthenFeature
- the value of the feature if cond
returns zeroelseFeature
- the value of the feature if cond
does not
return zerothenFeature
if cond
returns zero, the value of elseFeature
otherwisepublic static TermFeature createConditionalBinary(TermFeature cond, TermFeature thenFeature)
cond
- the feature that decides which value is to be returnedthenFeature
- the value of the feature if cond
returns zerothenFeature
if cond
returns zero, zero otherwise