-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: merge action implementation back into state from master
- Loading branch information
1 parent
fac7e67
commit 8191e89
Showing
24 changed files
with
320 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/programs/ASPCore2Program.java
This file was deleted.
Oops, something went wrong.
13 changes: 10 additions & 3 deletions
13
alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/programs/InputProgram.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
package at.ac.tuwien.kr.alpha.api.programs; | ||
|
||
import at.ac.tuwien.kr.alpha.api.rules.Rule; | ||
import at.ac.tuwien.kr.alpha.api.rules.heads.Head; | ||
import at.ac.tuwien.kr.alpha.api.programs.rules.Rule; | ||
import at.ac.tuwien.kr.alpha.api.programs.rules.heads.Head; | ||
import at.ac.tuwien.kr.alpha.api.programs.tests.TestCase; | ||
|
||
import java.util.List; | ||
|
||
// TODO javadoc | ||
public interface InputProgram extends Program<Rule<Head>> { | ||
|
||
/** | ||
* The test cases associated with this program. | ||
*/ | ||
List<TestCase> getTestCases(); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/programs/rules/RuleInstantiator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package at.ac.tuwien.kr.alpha.api.programs.rules; | ||
|
||
import at.ac.tuwien.kr.alpha.api.grounder.Substitution; | ||
import at.ac.tuwien.kr.alpha.api.programs.atoms.BasicAtom; | ||
import at.ac.tuwien.kr.alpha.api.programs.rules.heads.InstantiableHead; | ||
|
||
public interface RuleInstantiator { | ||
|
||
BasicAtom instantiate(InstantiableHead ruleHead, Substitution substitution); | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/programs/rules/heads/ActionHead.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package at.ac.tuwien.kr.alpha.api.programs.rules.heads; | ||
|
||
import at.ac.tuwien.kr.alpha.api.programs.terms.Term; | ||
import at.ac.tuwien.kr.alpha.api.programs.terms.VariableTerm; | ||
|
||
import java.util.List; | ||
|
||
public interface ActionHead extends NormalHead { | ||
|
||
String getActionName(); | ||
|
||
List<Term> getActionInputTerms(); | ||
|
||
VariableTerm getActionOutputTerm(); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/programs/rules/heads/InstantiableHead.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package at.ac.tuwien.kr.alpha.api.programs.rules.heads; | ||
|
||
import at.ac.tuwien.kr.alpha.api.grounder.Substitution; | ||
import at.ac.tuwien.kr.alpha.api.programs.atoms.BasicAtom; | ||
import at.ac.tuwien.kr.alpha.api.programs.rules.RuleInstantiator; | ||
|
||
public interface InstantiableHead extends Head { | ||
|
||
BasicAtom instantiate(RuleInstantiator instantiator, Substitution substitution); | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
alpha-api/src/main/java/at/ac/tuwien/kr/alpha/api/programs/terms/ActionResultTerm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package at.ac.tuwien.kr.alpha.api.programs.terms; | ||
|
||
/** | ||
* A term representing the result of an evolog action (i.e. result of action function application). | ||
* Action result terms are function terms with symbol "success" or "error" depending on whether the corresponding action was sucessful. | ||
* There is always one argument which is either some term representing the actual function result or an error message, respectively. | ||
*/ | ||
public interface ActionResultTerm<T extends Term> extends FunctionTerm { | ||
|
||
public static final String SUCCESS_SYMBOL = "success"; | ||
public static final String ERROR_SYMBOL = "error"; | ||
|
||
/** | ||
* True if the action that generated this result was successful (i.e. executed normally). | ||
*/ | ||
boolean isSuccess(); | ||
|
||
/** | ||
* True if the action that generated this result failed (i.e. threw an error in execution). | ||
*/ | ||
boolean isError(); | ||
|
||
/** | ||
* Gets the actual value wrapped in this result. | ||
* Either a term representing the action return value or a string term representing an error | ||
* message.s | ||
*/ | ||
T getValue(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.