From: <tho...@us...> - 2014-03-15 10:58:32
|
Revision: 7980 http://sourceforge.net/p/bigdata/code/7980 Author: thompsonbry Date: 2014-03-15 10:58:29 +0000 (Sat, 15 Mar 2014) Log Message: ----------- Pulled the IBinder interface out of the IBindingExtractor interface. Modified Paths: -------------- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java Added Paths: ----------- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBinder.java Added: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBinder.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBinder.java (rev 0) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBinder.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -0,0 +1,51 @@ +/** + Copyright (C) SYSTAP, LLC 2006-2012. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +package com.bigdata.rdf.graph; + +import org.openrdf.model.Value; +import org.openrdf.model.ValueFactory; + +/** + * An interface that may be used to extract variable bindings for the + * vertices visited by the algorithm. + * + * @author <a href="mailto:tho...@us...">Bryan + * Thompson</a> + */ +public interface IBinder<VS, ES, ST> { + + /** + * The ordinal index of the variable that is bound by this + * {@link IBinder}. By convention, index ZERO is the vertex. Indices + * greater than ZERO are typically aspects of the state of the vertex. + */ + int getIndex(); + + /** + * @param vf + * The {@link ValueFactory} used to create the return + * {@link Value}. + * @param u + * The vertex. + * + * @return The {@link Value} for that ordinal variable or + * <code>null</code> if there is no binding for that ordinal + * variable. + */ + Value bind(ValueFactory vf, final IGASState<VS, ES, ST> state, Value u); + +} + Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -17,9 +17,6 @@ import java.util.List; -import org.openrdf.model.Value; -import org.openrdf.model.ValueFactory; - /** * This interface makes it possible to extract bindings for variables from an * {@link IGASProgram}. @@ -41,37 +38,6 @@ public interface IBindingExtractor<VS, ES, ST> { /** - * An interface that may be used to extract variable bindings for the - * vertices visited by the algorithm. - * - * @author <a href="mailto:tho...@us...">Bryan - * Thompson</a> - */ - public interface IBinder<VS, ES, ST> { - - /** - * The ordinal index of the variable that is bound by this - * {@link IBinder}. By convention, index ZERO is the vertex. Indices - * greater than ZERO are typically aspects of the state of the vertex. - */ - int getIndex(); - - /** - * @param vf - * The {@link ValueFactory} used to create the return - * {@link Value}. - * @param u - * The vertex. - * - * @return The {@link Value} for that ordinal variable or - * <code>null</code> if there is no binding for that ordinal - * variable. - */ - Value bind(ValueFactory vf, final IGASState<VS, ES, ST> state, Value u); - - } - - /** * Return a list of interfaces that may be used to extract variable bindings * for the vertices visited by the algorithm. */ Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -30,6 +30,7 @@ import com.bigdata.rdf.graph.EdgesEnum; import com.bigdata.rdf.graph.Factory; import com.bigdata.rdf.graph.FrontierEnum; +import com.bigdata.rdf.graph.IBinder; import com.bigdata.rdf.graph.IBindingExtractor; import com.bigdata.rdf.graph.IGASContext; import com.bigdata.rdf.graph.IGASScheduler; @@ -278,11 +279,11 @@ * </dl> */ @Override - public List<IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>> getBinderList() { + public List<IBinder<BFS.VS, BFS.ES, Void>> getBinderList() { - final List<IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>> tmp = super.getBinderList(); + final List<IBinder<BFS.VS, BFS.ES, Void>> tmp = super.getBinderList(); - tmp.add(new IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>() { + tmp.add(new IBinder<BFS.VS, BFS.ES, Void>() { @Override public int getIndex() { @@ -298,7 +299,7 @@ } }); - tmp.add(new IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>() { + tmp.add(new IBinder<BFS.VS, BFS.ES, Void>() { @Override public int getIndex() { Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -30,6 +30,7 @@ import com.bigdata.rdf.graph.EdgesEnum; import com.bigdata.rdf.graph.Factory; import com.bigdata.rdf.graph.FrontierEnum; +import com.bigdata.rdf.graph.IBinder; import com.bigdata.rdf.graph.IBindingExtractor; import com.bigdata.rdf.graph.IGASScheduler; import com.bigdata.rdf.graph.IGASState; @@ -314,11 +315,11 @@ * </dl> */ @Override - public List<IBindingExtractor.IBinder<CC.VS, CC.ES, Value>> getBinderList() { + public List<IBinder<CC.VS, CC.ES, Value>> getBinderList() { - final List<IBindingExtractor.IBinder<CC.VS, CC.ES, Value>> tmp = super.getBinderList(); + final List<IBinder<CC.VS, CC.ES, Value>> tmp = super.getBinderList(); - tmp.add(new IBindingExtractor.IBinder<CC.VS, CC.ES, Value>() { + tmp.add(new IBinder<CC.VS, CC.ES, Value>() { @Override public int getIndex() { Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -28,13 +28,12 @@ import com.bigdata.rdf.graph.EdgesEnum; import com.bigdata.rdf.graph.Factory; import com.bigdata.rdf.graph.FrontierEnum; +import com.bigdata.rdf.graph.IBinder; import com.bigdata.rdf.graph.IBindingExtractor; -import com.bigdata.rdf.graph.IBindingExtractor.IBinder; import com.bigdata.rdf.graph.IGASContext; import com.bigdata.rdf.graph.IGASScheduler; import com.bigdata.rdf.graph.IGASState; import com.bigdata.rdf.graph.IReducer; -import com.bigdata.rdf.graph.analytics.CC.Bindings; import com.bigdata.rdf.graph.impl.BaseGASProgram; /** @@ -349,11 +348,11 @@ * </dl> */ @Override - public List<IBindingExtractor.IBinder<PR.VS, PR.ES, Double>> getBinderList() { + public List<IBinder<PR.VS, PR.ES, Double>> getBinderList() { - final List<IBindingExtractor.IBinder<PR.VS, PR.ES, Double>> tmp = super.getBinderList(); + final List<IBinder<PR.VS, PR.ES, Double>> tmp = super.getBinderList(); - tmp.add(new IBindingExtractor.IBinder<PR.VS, PR.ES, Double>() { + tmp.add(new IBinder<PR.VS, PR.ES, Double>() { @Override public int getIndex() { Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -25,6 +25,7 @@ import com.bigdata.rdf.graph.EdgesEnum; import com.bigdata.rdf.graph.Factory; import com.bigdata.rdf.graph.FrontierEnum; +import com.bigdata.rdf.graph.IBinder; import com.bigdata.rdf.graph.IBindingExtractor; import com.bigdata.rdf.graph.IGASContext; import com.bigdata.rdf.graph.IGASScheduler; @@ -446,12 +447,12 @@ * </dl> */ @Override - public List<IBindingExtractor.IBinder<SSSP.VS, SSSP.ES, Integer>> getBinderList() { + public List<IBinder<SSSP.VS, SSSP.ES, Integer>> getBinderList() { - final List<IBindingExtractor.IBinder<SSSP.VS, SSSP.ES, Integer>> tmp = super + final List<IBinder<SSSP.VS, SSSP.ES, Integer>> tmp = super .getBinderList(); - tmp.add(new IBindingExtractor.IBinder<SSSP.VS, SSSP.ES, Integer>() { + tmp.add(new IBinder<SSSP.VS, SSSP.ES, Integer>() { @Override public int getIndex() { Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java =================================================================== --- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -29,6 +29,7 @@ import com.bigdata.rdf.graph.EdgesEnum; import com.bigdata.rdf.graph.Factory; import com.bigdata.rdf.graph.FrontierEnum; +import com.bigdata.rdf.graph.IBinder; import com.bigdata.rdf.graph.IBindingExtractor; import com.bigdata.rdf.graph.IGASContext; import com.bigdata.rdf.graph.IGASProgram; @@ -232,11 +233,11 @@ * </dl> */ @Override - public List<IBindingExtractor.IBinder<VS, ES, ST>> getBinderList() { + public List<IBinder<VS, ES, ST>> getBinderList() { - final List<IBindingExtractor.IBinder<VS, ES, ST>> tmp = new LinkedList<IBindingExtractor.IBinder<VS, ES, ST>>(); + final List<IBinder<VS, ES, ST>> tmp = new LinkedList<IBinder<VS, ES, ST>>(); - tmp.add(new IBindingExtractor.IBinder<VS, ES, ST>() { + tmp.add(new IBinder<VS, ES, ST>() { @Override public int getIndex() { Modified: branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java =================================================================== --- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java 2014-03-15 10:53:47 UTC (rev 7979) +++ branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java 2014-03-15 10:58:29 UTC (rev 7980) @@ -44,8 +44,7 @@ import com.bigdata.bop.IVariable; import com.bigdata.bop.bindingSet.ListBindingSet; import com.bigdata.journal.IIndexManager; -import com.bigdata.rdf.graph.IBindingExtractor; -import com.bigdata.rdf.graph.IBindingExtractor.IBinder; +import com.bigdata.rdf.graph.IBinder; import com.bigdata.rdf.graph.IGASContext; import com.bigdata.rdf.graph.IGASEngine; import com.bigdata.rdf.graph.IGASProgram; @@ -871,7 +870,7 @@ /** * The list of objects used to extract the variable bindings. */ - private final List<IBindingExtractor.IBinder<VS, ES, ST>> binderList; + private final List<IBinder<VS, ES, ST>> binderList; /** * The collected solutions. @@ -908,7 +907,7 @@ final IBindingSet bs = new ListBindingSet(); - for (IBindingExtractor.IBinder<VS, ES, ST> b : binderList) { + for (IBinder<VS, ES, ST> b : binderList) { // The variable for this binder. final IVariable<?> var = outVars[b.getIndex()]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |