Deprecate unused Program's methods, remove unused code.
Amend the API to support justifications.
This commit is contained in:
parent
478b43ce16
commit
3163324661
|
|
@ -23,6 +23,8 @@ import jetbrains.mps.logic.reactor.program.Rule;
|
|||
/**
|
||||
* A binding of a rule and the constraint occurrences that matched its head.
|
||||
*
|
||||
* // FIXME rename to RuleMatch
|
||||
*
|
||||
* @author Fedor Isakov
|
||||
*/
|
||||
public interface MatchRule {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package jetbrains.mps.logic.reactor.program;
|
|||
/**
|
||||
* A handler is a container of rules.
|
||||
* <p>
|
||||
* FIXME to be renamed to RulesList
|
||||
* @author Fedor Isakov
|
||||
*/
|
||||
public abstract class Handler {
|
||||
|
|
|
|||
|
|
@ -25,30 +25,36 @@ import java.util.List;
|
|||
/**
|
||||
* A collection of handlers that constitute a constraint rules program.
|
||||
*
|
||||
* FIXME a handler is to be renamed to RulesList
|
||||
* @author Fedor Isakov
|
||||
*/
|
||||
public abstract class Program {
|
||||
|
||||
public abstract String name();
|
||||
|
||||
public abstract Iterable<ConstraintSymbol> constraintSymbols();
|
||||
/**
|
||||
* @deprecated no usages
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public Iterable<ConstraintSymbol> constraintSymbols() { throw new UnsupportedOperationException (); }
|
||||
|
||||
public abstract List<Class<?>> constraintArgumentTypes(ConstraintSymbol constraintSymbol);
|
||||
/**
|
||||
* @deprecated no usages
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public List<Class<?>> constraintArgumentTypes(ConstraintSymbol constraintSymbol) { throw new UnsupportedOperationException (); }
|
||||
|
||||
public abstract Iterable<PredicateSymbol> predicateSymbols();
|
||||
/**
|
||||
* @deprecated no usages
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public Iterable<PredicateSymbol> predicateSymbols() { throw new UnsupportedOperationException (); }
|
||||
|
||||
public abstract Iterable<Handler> handlers();
|
||||
|
||||
/**
|
||||
* @deprecated use the overloaded method with InvocationContext parameter
|
||||
*/
|
||||
@Deprecated
|
||||
public List<?> instantiateArguments(List<?> arguments, LogicalContext logicalContext) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public List<?> instantiateArguments(List<?> arguments, LogicalContext logicalContext, InvocationContext ignore) {
|
||||
return instantiateArguments(arguments, logicalContext);
|
||||
}
|
||||
public abstract List<?> instantiateArguments(List<?> arguments, LogicalContext logicalContext, InvocationContext invocationContext);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,16 @@ public abstract class Rule {
|
|||
|
||||
public abstract Rule.Kind kind();
|
||||
|
||||
/**
|
||||
* A tag uniquely identifies the rule.
|
||||
*/
|
||||
public abstract String tag();
|
||||
|
||||
/**
|
||||
* An origin serves as justification for all constraints affected by this rule.
|
||||
*/
|
||||
public Object origin() { return null; }
|
||||
|
||||
public abstract Iterable<Constraint> headKept();
|
||||
|
||||
public abstract Iterable<Constraint> headReplaced();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
* @author Fedor Isakov
|
||||
*/
|
||||
|
||||
import jetbrains.mps.logic.reactor.evaluation.InvocationContext
|
||||
import jetbrains.mps.logic.reactor.logical.LogicalContext
|
||||
import jetbrains.mps.logic.reactor.logical.MetaLogical
|
||||
import jetbrains.mps.logic.reactor.program.*
|
||||
|
|
@ -96,6 +97,7 @@ class MockProgram(val name: String, val handlers: List<Handler>, val registry: M
|
|||
|
||||
override fun name(): String = name
|
||||
|
||||
|
||||
override fun constraintSymbols(): Iterable<ConstraintSymbol> =
|
||||
registry.constraintSymbols()
|
||||
|
||||
|
|
@ -105,7 +107,7 @@ class MockProgram(val name: String, val handlers: List<Handler>, val registry: M
|
|||
override fun predicateSymbols(): Iterable<PredicateSymbol> =
|
||||
registry.predicateSymbols()
|
||||
|
||||
override fun instantiateArguments(arguments: List<*>, logicalContext: LogicalContext): List<*> =
|
||||
override fun instantiateArguments(arguments: List<*>, logicalContext: LogicalContext, invocationContext: InvocationContext): List<*> =
|
||||
arguments.map { a ->
|
||||
if (a is MetaLogical<*>) logicalContext.variable(a)
|
||||
else a
|
||||
|
|
|
|||
Loading…
Reference in New Issue