dpvis.datastructures.impl
Class RuleImpl

java.lang.Object
  extended by dpvis.datastructures.impl.RuleImpl
All Implemented Interfaces:
Rule, java.io.Serializable

public class RuleImpl
extends java.lang.Object
implements Rule

See Also:
Serialized Form

Constructor Summary
RuleImpl(Rule rule)
           
RuleImpl(Term lhs, Term rhs)
           
RuleImpl(Term lhs, Term rhs, java.util.List<Rule> conditions)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 void filter(java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> filtering)
          Applies an argument filtering to the rule.
 java.util.Set<Pair<java.lang.String,java.lang.Integer>> getAllFunctionSymbolsWithArity()
          Gets the list of function symbols of the rule together with the corresponding arities.
 java.util.List<Rule> getConditions()
          Gets the conditions of the rule.
 java.util.Set<java.lang.String> getFunctions()
          Gets all function symbols that occur in the rule (Including conditions).
 Term getLhs()
          Gets the left-hand side of the rule.
 Term getRhs()
          Gets the right-hand side of the rule.
 int hashCode()
           
 boolean isConditional()
          Computes whether the rule is a conditional one.
 void markVariables(java.util.List<java.lang.String> vars)
          Marks the variables in the rule (see also Term.markVariables()).
 void removeContextSensitivityFlags()
          Removes all forbidden flags from the rules of this Rule.
 void renameVariables(java.lang.String var)
          Renames all variables (including those in conditions) of this rule.
 void setConditions(java.util.List<Rule> conditions)
          Sets the conditions of the rule.
 void setLhs(Term lhs)
          Sets the left-hand side of the rule.
 void setRhs(Term rhs)
          Sets the right-hand side of the rule.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleImpl

public RuleImpl(Term lhs,
                Term rhs)

RuleImpl

public RuleImpl(Term lhs,
                Term rhs,
                java.util.List<Rule> conditions)

RuleImpl

public RuleImpl(Rule rule)
Method Detail

markVariables

public void markVariables(java.util.List<java.lang.String> vars)
Description copied from interface: Rule
Marks the variables in the rule (see also Term.markVariables()).

Specified by:
markVariables in interface Rule
Parameters:
vars - The functions that shall be interpreted as variables.

renameVariables

public void renameVariables(java.lang.String var)
Description copied from interface: Rule
Renames all variables (including those in conditions) of this rule. The new variable names will be $var1, ..., $varN (where $var is the String passed as parameter)

Specified by:
renameVariables in interface Rule
Parameters:
var - The variable prefix for the new variable names.

getLhs

public Term getLhs()
Description copied from interface: Rule
Gets the left-hand side of the rule.

Specified by:
getLhs in interface Rule
Returns:
The left-hand side of the rule.

setLhs

public void setLhs(Term lhs)
Description copied from interface: Rule
Sets the left-hand side of the rule.

Specified by:
setLhs in interface Rule
Parameters:
lhs - The new left-hand side of the rule.

getRhs

public Term getRhs()
Description copied from interface: Rule
Gets the right-hand side of the rule.

Specified by:
getRhs in interface Rule
Returns:
The right-hand side of the rule.

setRhs

public void setRhs(Term rhs)
Description copied from interface: Rule
Sets the right-hand side of the rule.

Specified by:
setRhs in interface Rule
Parameters:
rhs - The new right-hand side of the rule.

getConditions

public java.util.List<Rule> getConditions()
Description copied from interface: Rule
Gets the conditions of the rule.

Specified by:
getConditions in interface Rule
Returns:
The conditions of the rule.

setConditions

public void setConditions(java.util.List<Rule> conditions)
Description copied from interface: Rule
Sets the conditions of the rule.

Specified by:
setConditions in interface Rule
Parameters:
conditions - The new conditions of the rule.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isConditional

public boolean isConditional()
Description copied from interface: Rule
Computes whether the rule is a conditional one.

Specified by:
isConditional in interface Rule
Returns:
True if the rule contains conditions, False otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getFunctions

public java.util.Set<java.lang.String> getFunctions()
Description copied from interface: Rule
Gets all function symbols that occur in the rule (Including conditions).

Specified by:
getFunctions in interface Rule
Returns:
All functions symbols contained in the rule.

filter

public void filter(java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> filtering)
Description copied from interface: Rule
Applies an argument filtering to the rule. An argument filtering is specified by a mapping from functions to lists of argument positions, e.g. f -> [2, 3]. The argument positions in the list specify those arguments of the function symbol that are filtered, i.e. removed. So the above filtering applied to the term f(x, y, z) yields f(x). In order to indicate a collapsing filtering negative integers are used, e.g. f -> [-2], which yields y if applied to f(x, y, z).

Specified by:
filter in interface Rule
Parameters:
filtering - The filtering given by a mapping from functions to lists of argument positions.

getAllFunctionSymbolsWithArity

public java.util.Set<Pair<java.lang.String,java.lang.Integer>> getAllFunctionSymbolsWithArity()
Description copied from interface: Rule
Gets the list of function symbols of the rule together with the corresponding arities.

Specified by:
getAllFunctionSymbolsWithArity in interface Rule
Returns:
A list of Pairs of function symbols and arities.

removeContextSensitivityFlags

public void removeContextSensitivityFlags()
Description copied from interface: Rule
Removes all forbidden flags from the rules of this Rule.

Specified by:
removeContextSensitivityFlags in interface Rule