|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.bddbddb.InferenceRule
public abstract class InferenceRule
An InferenceRule represents a single Datalog rule.
Nested Class Summary | |
---|---|
static class |
InferenceRule.DependenceNavigator
A navigator that can navigate over rule dependencies. |
Field Summary | |
---|---|
protected RuleTerm |
bottom
Head of the rule (i.e. |
int |
id
Unique id number for this rule. |
protected java.util.Set |
necessaryVariables
Set of variables that are necessary. |
protected Solver |
solver
Link to solver. |
protected java.util.List |
top
List of subgoals for the rule (i.e. |
protected java.util.Set |
unnecessaryVariables
Set of variables that are unnecessary. |
Constructor Summary | |
---|---|
protected |
InferenceRule(Solver solver,
java.util.List top,
RuleTerm bottom)
Construct a new inference rule. |
protected |
InferenceRule(Solver solver,
java.util.List top,
RuleTerm bottom,
int id)
|
Method Summary | |
---|---|
protected java.util.Set |
calculateNecessaryVariables()
Calculate and return the set of necessary variables for this rule. |
Variable |
checkUnnecessaryVariables()
Checks to see if there are any variables that only appear once. |
void |
copyOptions(InferenceRule that)
Copy the options from another rule into this one. |
void |
free()
Free the memory associated with this rule. |
static InferenceRule |
fromXMLElement(org.jdom.Element e,
Solver s)
|
java.util.List |
generateIR_incremental()
Generate and return the IR that implements the incrementalized version of this rule. |
java.util.List |
generateIR()
Generate and return the IR that implements this rule. |
Attribute |
getAttribute(Variable v)
Returns the attribute associated with the given variable. |
RuleTerm |
getHead()
Returns the head term. |
java.util.Set |
getNecessaryVariables()
|
static jwutil.collections.MultiMap |
getRelationToDefiningRule(java.util.Collection rules)
Given a collection of rules, returns a multimap that maps relations to the rules that define that relation. |
static jwutil.collections.MultiMap |
getRelationToUsingRule(java.util.Collection rules)
Given a collection of rules, returns a multimap that maps relations to the rules that use that relation. |
java.util.List |
getSubgoals()
Returns the list of subgoals. |
java.util.Set |
getUnnecessaryVariables()
|
Variable |
getVariable(java.lang.String name)
Returns the variable with the given name, or null if there is none. |
java.util.Set |
getVariables()
|
java.util.Map |
getVarNameMap()
|
int |
hashCode()
The hashCode for rules is deterministic. |
int |
numberOfVariables()
|
abstract void |
reportStats()
Report statistics about this rule. |
java.util.Collection |
split(int myIndex)
Splits a rule into a collection of rules, such that each of the new rules has only two subgoals. |
java.lang.String |
toString()
|
org.jdom.Element |
toXMLElement()
|
abstract boolean |
update()
Update the head relation of this rule based on the subgoal relations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Solver solver
public final int id
protected java.util.List top
protected RuleTerm bottom
protected java.util.Set necessaryVariables
protected java.util.Set unnecessaryVariables
Constructor Detail |
---|
protected InferenceRule(Solver solver, java.util.List top, RuleTerm bottom)
solver
- solvertop
- subgoal termsbottom
- head termprotected InferenceRule(Solver solver, java.util.List top, RuleTerm bottom, int id)
Method Detail |
---|
public java.util.List getSubgoals()
public RuleTerm getHead()
protected java.util.Set calculateNecessaryVariables()
public Variable checkUnnecessaryVariables()
public abstract boolean update()
public abstract void reportStats()
public void free()
public static jwutil.collections.MultiMap getRelationToUsingRule(java.util.Collection rules)
rules
- collection of rules
public static jwutil.collections.MultiMap getRelationToDefiningRule(java.util.Collection rules)
rules
- collection of rules
public java.util.Collection split(int myIndex)
myIndex
- index number used to name the new rules
public void copyOptions(InferenceRule that)
that
- public java.util.List generateIR()
public java.util.List generateIR_incremental()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public Variable getVariable(java.lang.String name)
name
- variable name
public int numberOfVariables()
public java.util.Set getNecessaryVariables()
public java.util.Set getUnnecessaryVariables()
public java.util.Set getVariables()
public java.util.Map getVarNameMap()
public Attribute getAttribute(Variable v)
v
- variable
public static InferenceRule fromXMLElement(org.jdom.Element e, Solver s)
public org.jdom.Element toXMLElement()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |