You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/06/29 15:39:33 UTC

[4/6] jena git commit: JENA-901 Java 8 style Callable

JENA-901 Java 8 style Callable


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/05885d70
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/05885d70
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/05885d70

Branch: refs/heads/master
Commit: 05885d70c3ce62c2c0a017b0b3f9481d57ac5d3b
Parents: f1a2752
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Fri Jun 24 13:35:49 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Fri Jun 24 13:35:49 2016 +0100

----------------------------------------------------------------------
 .../reasoner/rulesys/impl/LPBRuleEngine.java    | 48 +++++++++-----------
 1 file changed, 21 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/05885d70/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
index 0ea82dd..08e8f82 100644
--- a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
+++ b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/LPBRuleEngine.java
@@ -281,24 +281,21 @@ public class LPBRuleEngine {
      * @param clauses the precomputed set of code blocks used to implement the goal
      */
     public synchronized Generator generatorFor(final TriplePattern goal, final List<RuleClauseCode> clauses) {
-          return getCachedTabledGoal(goal, new Callable<Generator>() {
-      		 	@Override
-      		    public Generator call() {
-      		 		/** FIXME: Unify with #generatorFor(TriplePattern) - but investigate what about
-      		 		 * the edge case that this method might have been called with the of goal == null
-      		 		 * or goal.size()==0 -- which gives different behaviour in
-      		 		 * LPInterpreter constructor than through the route of
-      		 		 * generatorFor(TriplePattern) which calls a different LPInterpreter constructor
-      		 		 * which would fill in from RuleStore.
-      		 		 */
-      		        LPInterpreter interpreter = new LPInterpreter(LPBRuleEngine.this, goal, clauses, false);
-      		        activeInterpreters.add(interpreter);
-      		        Generator generator = new Generator(interpreter, goal);
-      		        schedule(generator);
-      		        return generator;
-      		 	}
-      		});
-    }
+        return getCachedTabledGoal(goal, () -> {
+	 		/** FIXME: Unify with #generatorFor(TriplePattern) - but investigate what about
+	 		 * the edge case that this method might have been called with the of goal == null
+	 		 * or goal.size()==0 -- which gives different behaviour in
+	 		 * LPInterpreter constructor than through the route of
+	 		 * generatorFor(TriplePattern) which calls a different LPInterpreter constructor
+	 		 * which would fill in from RuleStore.
+	 		 */
+			LPInterpreter interpreter = new LPInterpreter(LPBRuleEngine.this, goal, clauses, false);
+			activeInterpreters.add(interpreter);
+			Generator generator = new Generator(interpreter, goal);
+			schedule(generator);
+			return generator;
+		});
+	}
 
     /**
      * Return a generator for the given goal (assumes that the caller knows that
@@ -306,15 +303,12 @@ public class LPBRuleEngine {
      * @param goal the goal whose results are to be generated
      */
     public synchronized Generator generatorFor(final TriplePattern goal) {
-		return getCachedTabledGoal(goal, new Callable<Generator>() {
-		 	@Override
-		    public Generator call() {
-	            LPInterpreter interpreter = new LPInterpreter(LPBRuleEngine.this, goal, false);
-	            activeInterpreters.add(interpreter);
-	            Generator generator = new Generator(interpreter, goal);
-	            schedule(generator);
-	            return generator;
-		 	}
+    	return getCachedTabledGoal(goal, () -> {
+            LPInterpreter interpreter = new LPInterpreter(LPBRuleEngine.this, goal, false);
+            activeInterpreters.add(interpreter);
+            Generator generator = new Generator(interpreter, goal);
+            schedule(generator);
+            return generator;
 		});
     }