Introduce the Handler API.

This commit is contained in:
Fedor Isakov 2016-12-22 12:39:28 +01:00
parent e6c7ee74f5
commit e80818607c
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package jetbrains.mps.logic.reactor.program;
/**
* @author Fedor Isakov
*/
public abstract class Handler {
public abstract String name();
public abstract ConstraintSymbol primarySymbol();
public abstract Iterable<Rule> rules();
}

View File

@ -14,7 +14,13 @@ public abstract class Program {
public abstract Iterable<PredicateSymbol> predicateSymbols();
/**
* @deprecated use handlers().foreach{ yieldAll it.rules() }
* @return
*/
@Deprecated
public abstract Iterable<Rule> rules();
public abstract Iterable<Handler> handlers();
}

View File

@ -88,6 +88,8 @@ class MemProgram(val name: String, val myRules : List<Rule>, val registry: Const
registry.predicateSymbols()
override fun rules(): Iterable<Rule> = unmodifiableCollection(myRules)
override fun handlers(): MutableIterable<Handler> = TODO()
}