public class MemoryGroundRuleStore extends Object implements GroundRuleStore
GroundRuleStore
that just stores each GroundRule
in memory.
addGroundRule() is thread-safe and will silently ignore already added rules.
Other methods are not guaranteed safe.Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.collections4.SetValuedMap<Rule,GroundRule> |
groundRules |
Constructor and Description |
---|
MemoryGroundRuleStore() |
Modifier and Type | Method and Description |
---|---|
void |
addGroundRule(GroundRule groundRule)
Adds a GroundRule to this store.
|
void |
close()
Release any memory held by the store.
|
boolean |
containsGroundRule(GroundRule groundRule)
Checks whether a GroundRule is in this store.
|
int |
count(Rule rule) |
Iterable<WeightedGroundRule> |
getCompatibilityRules() |
Iterable<UnweightedGroundRule> |
getConstraintRules() |
Iterable<GroundRule> |
getGroundRules() |
Iterable<GroundRule> |
getGroundRules(Rule rule)
Returns every GroundRule that was instantiated by a given Rule.
|
void |
removeGroundRule(GroundRule groundRule)
Removes a GroundRule from this store.
|
void |
removeGroundRules(Rule rule)
Removes all GroundRules that was instantiated by a given rule.
|
int |
size() |
protected org.apache.commons.collections4.SetValuedMap<Rule,GroundRule> groundRules
public void addGroundRule(GroundRule groundRule)
GroundRuleStore
addGroundRule
in interface GroundRuleStore
groundRule
- the GroundRule to addpublic boolean containsGroundRule(GroundRule groundRule)
GroundRuleStore
containsGroundRule
in interface GroundRuleStore
groundRule
- the GroundRule to checkpublic Iterable<WeightedGroundRule> getCompatibilityRules()
getCompatibilityRules
in interface GroundRuleStore
WeightedGroundRule
in this storepublic Iterable<UnweightedGroundRule> getConstraintRules()
getConstraintRules
in interface GroundRuleStore
UnweightedGroundRule
in this storepublic Iterable<GroundRule> getGroundRules()
getGroundRules
in interface GroundRuleStore
public Iterable<GroundRule> getGroundRules(Rule rule)
GroundRuleStore
getGroundRules
in interface GroundRuleStore
rule
- the Rule of the GroundRules to returnpublic void removeGroundRule(GroundRule groundRule)
GroundRuleStore
removeGroundRule
in interface GroundRuleStore
groundRule
- the GroundRule to removepublic void removeGroundRules(Rule rule)
GroundRuleStore
removeGroundRules
in interface GroundRuleStore
rule
- the originator of the ground rulespublic int size()
size
in interface GroundRuleStore
public int count(Rule rule)
count
in interface GroundRuleStore
public void close()
GroundRuleStore
close
in interface GroundRuleStore
Copyright © 2018 University of California, Santa Cruz. All rights reserved.