dpvis.datastructures.impl
Class RewriteSystemImpl

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

public class RewriteSystemImpl
extends java.lang.Object
implements RewriteSystem

See Also:
Serialized Form

Constructor Summary
RewriteSystemImpl(java.util.List<Rule> rules)
           
RewriteSystemImpl(java.util.List<Rule> rules, int strategy)
           
RewriteSystemImpl(java.util.List<Rule> rules, Strategy strategy)
           
RewriteSystemImpl(RewriteSystem sys)
           
 
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 rules of the rewrite system.
 java.util.Set<Pair<java.lang.String,java.lang.Integer>> getAllFunctionSymbolsWithArity()
          Gets the list of function symbols of the rewrite system together with the corresponding arities.
 java.util.List<java.lang.String> getDefinedFunctionSymbols()
          Gets the defined function symbols of the rewrite system, i.e.
 java.util.List<Rule> getRules()
          Gets the rules of the rewrite system.
 java.util.Set<java.lang.String> getSignature()
          Gets the signature of the rewrite system.
 Strategy getStrategy()
          Gets the strategy of the rewrite system.
 java.util.List<java.lang.String> getVariables()
          Extracts all variables that are used in the rules of the rewrite systems.
 int hashCode()
           
 boolean isConditional()
          Computes whether the rewrite system is conditional, i.e.
 void markVariables()
           
 java.util.List<Term> narrow(Term t)
          Narrows a given term with respect to this rewrite system.
 void removeContextSensitivityFlags()
          Removes all forbidden flags from the rules of this Rewrite System.
 void reverse()
          Swaps the direction of all rules of the Rewrite System, i.e.
 void setRules(java.util.List<Rule> rules)
          Sets the rules of the rewrite system.
 void setStrategy(Strategy strategy)
          Sets the strategy of the rewrite system.
 void setVariables(java.util.List<java.lang.String> variables)
          Sets those functions that shall be interpreted as variables.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RewriteSystemImpl

public RewriteSystemImpl(java.util.List<Rule> rules)

RewriteSystemImpl

public RewriteSystemImpl(java.util.List<Rule> rules,
                         int strategy)

RewriteSystemImpl

public RewriteSystemImpl(java.util.List<Rule> rules,
                         Strategy strategy)

RewriteSystemImpl

public RewriteSystemImpl(RewriteSystem sys)
Method Detail

reverse

public void reverse()
Description copied from interface: RewriteSystem
Swaps the direction of all rules of the Rewrite System, i.e. the left-hand side of each rule becomes the new right-hand side and vice versa. Note that the reverse method may produce rule with variables as left-hand sides or extra variables in right-hand sides.

Specified by:
reverse in interface RewriteSystem

getRules

public java.util.List<Rule> getRules()
Description copied from interface: RewriteSystem
Gets the rules of the rewrite system.

Specified by:
getRules in interface RewriteSystem
Returns:
The rules of the rewrite system.

setRules

public void setRules(java.util.List<Rule> rules)
Description copied from interface: RewriteSystem
Sets the rules of the rewrite system.

Specified by:
setRules in interface RewriteSystem
Parameters:
rules - The new rules of the rewrite system.

getStrategy

public Strategy getStrategy()
Description copied from interface: RewriteSystem
Gets the strategy of the rewrite system.

Specified by:
getStrategy in interface RewriteSystem
Returns:
The strategy of the rewrite system.

setStrategy

public void setStrategy(Strategy strategy)
Description copied from interface: RewriteSystem
Sets the strategy of the rewrite system.

Specified by:
setStrategy in interface RewriteSystem
Parameters:
strategy - The new strategy of the rewrite system.

getVariables

public java.util.List<java.lang.String> getVariables()
Description copied from interface: RewriteSystem
Extracts all variables that are used in the rules of the rewrite systems.

Specified by:
getVariables in interface RewriteSystem
Returns:
The list of variables of the rewrite system.

setVariables

public void setVariables(java.util.List<java.lang.String> variables)
Description copied from interface: RewriteSystem
Sets those functions that shall be interpreted as variables.

Specified by:
setVariables in interface RewriteSystem
Parameters:
variables - The new variables of the TRS.

toString

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

getDefinedFunctionSymbols

public java.util.List<java.lang.String> getDefinedFunctionSymbols()
Description copied from interface: RewriteSystem
Gets the defined function symbols of the rewrite system, i.e. the functions that occur as root of the left-hand side of at least one rule.

Specified by:
getDefinedFunctionSymbols in interface RewriteSystem
Returns:
The defined function symbols of the rewite system.

markVariables

public void markVariables()

narrow

public java.util.List<Term> narrow(Term t)
Description copied from interface: RewriteSystem
Narrows a given term with respect to this rewrite system. All possible one step narrowings are computed, i.e. all possible narrowing steps are applied to all subterms of the given term.

Specified by:
narrow in interface RewriteSystem
Parameters:
t - The term to be narrowed
Returns:
A list of all one-step narrowings of the given term.

getSignature

public java.util.Set<java.lang.String> getSignature()
Description copied from interface: RewriteSystem
Gets the signature of the rewrite system.

Specified by:
getSignature in interface RewriteSystem
Returns:
The signature of the rewrite system.

filter

public void filter(java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> filtering)
Description copied from interface: RewriteSystem
Applies an argument filtering to the rules of the rewrite system. 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 RewriteSystem
Parameters:
filtering - The filtering given by a mapping from functions to lists of argument positions.

isConditional

public boolean isConditional()
Description copied from interface: RewriteSystem
Computes whether the rewrite system is conditional, i.e. contains conditional rules.

Specified by:
isConditional in interface RewriteSystem
Returns:
True if the rewrite system contains at least one conditional rule, 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

getAllFunctionSymbolsWithArity

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

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

removeContextSensitivityFlags

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

Specified by:
removeContextSensitivityFlags in interface RewriteSystem