public class ShannonFeature extends java.lang.Object implements Feature
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 Feature |
cond
The filter that decides which sub-feature is to be evaluated
|
private Feature |
elseFeature
The feature for negative results of
filter |
private Feature |
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 |
ShannonFeature(Feature p_cond,
RuleAppCost p_trueCost,
Feature p_thenFeature,
Feature p_elseFeature) |
private final Feature cond
private final RuleAppCost trueCost
cond
is this cost, then the condition
is assumed to holdprivate final Feature thenFeature
filter
private final Feature elseFeature
filter
private ShannonFeature(Feature p_cond, RuleAppCost p_trueCost, Feature p_thenFeature, Feature p_elseFeature)
public RuleAppCost computeCost(RuleApp app, PosInOccurrence pos, Goal goal)
Feature
RuleApp
.computeCost
in interface Feature
app
- the RuleApppos
- position where app
is to be appliedgoal
- the goal on which app
is to be appliedRuleAppCost
object. TopRuleAppCost.INSTANCE
indicates that the rule shall not be applied at all (it is discarded by
the strategy).public static Feature createConditional(Feature cond, RuleAppCost trueCost, RuleAppCost thenValue)
cond
- the feature that decides which value is to be returnedtrueCost
- the value of cond
that is regarded as
true-valuethenValue
- the value of the feature, if cond
returns
trueCost
thenValue
if cond
returns
trueCost
, zero otherwisepublic static Feature createConditional(Feature cond, RuleAppCost trueCost, RuleAppCost thenValue, RuleAppCost elseValue)
cond
- the feature that decides which value is to be returnedtrueCost
- the value of cond
that is regarded as
true-valuethenValue
- the value of the feature if cond
returns
trueCost
elseValue
- the value of the feature if cond
does not
return trueCost
thenValue
if cond
returns
trueCost
, elseValue
otherwisepublic static Feature createConditional(Feature cond, RuleAppCost trueCost, Feature thenFeature)
cond
- the feature that decides which value is to be returnedtrueCost
- the value of cond
that is regarded as
true-valuethenFeature
- the value of the feature if cond
returns
trueCost
thenFeature
if cond
returns trueCost
, zero otherwisepublic static Feature createConditional(Feature cond, RuleAppCost trueCost, Feature thenFeature, RuleAppCost elseValue)
cond
- the feature that decides which value is to be returnedtrueCost
- the value of cond
that is regarded as
true-valuethenFeature
- the value of the feature if cond
returns
trueCost
elseValue
- the value of the feature if cond
does not
return trueCost
thenFeature
if cond
returns trueCost
, elseValue
otherwisepublic static Feature createConditional(Feature cond, RuleAppCost trueCost, Feature thenFeature, Feature elseFeature)
cond
- the feature that decides which value is to be returnedtrueCost
- the value of cond
that is regarded as
true-valuethenFeature
- the value of the feature if cond
returns
trueCost
elseFeature
- the value of the feature if cond
does not
return trueCost
thenFeature
if cond
returns trueCost
, the value of
elseFeature
otherwisepublic static Feature createConditionalBinary(Feature cond, RuleAppCost thenValue)
cond
- the feature that decides which value is to be returnedthenValue
- the value of the feature if cond
returns zerothenFeature
if cond
returns zero, zero otherwisepublic static Feature createConditionalBinary(Feature cond, RuleAppCost thenValue, RuleAppCost elseValue)
cond
- the feature that decides which value is to be returnedthenValue
- the value of the feature if cond
returns zeroelseValue
- the value of the feature if cond
does not
return zerothenValue
if cond
returns zero,
elseValue
otherwisepublic static Feature createConditionalBinary(Feature cond, Feature thenFeature, RuleAppCost elseValue)
cond
- the feature that decides which value is to be returnedthenFeature
- the value of the feature if cond
returns zeroelseValue
- the value of the feature if cond
does not
return zerothenFeature
if cond
returns zero, elseValue
otherwisepublic static Feature createConditionalBinary(Feature cond, Feature thenFeature, Feature 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 Feature createConditionalBinary(Feature cond, Feature 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