public List<Recommendation<IMethodName>> computeRecommendations(final ObjectUsage query) throws Exception { UniqueTypeName name = new UniqueTypeName(null, query.type); ICallModel net = store.acquireModel(name).orNull(); try { // // set the inputs into the net net.setObservedOverrideContext(query.overrideFirst); net.setObservedDefinitionKind(query.kind); net.setObservedDefiningMethod(query.definition); // note setObservedCalls should *always* be called. net.setObservedCalls(query.calls); // // query the recommender (just a few examples) List<Recommendation<String>> patterns = top(net.recommendPatterns(), 10, 0.01); List<Recommendation<IMethodName>> definitions = top(net.recommendDefinitions(), 10); List<Recommendation<IMethodName>> calls = top(net.recommendCalls(), 5, 0.01d); return calls; } finally { store.releaseModel(net); } }
public SingleZipCallRecommender(final File models) throws IOException { store = new SingleZipCallModelProvider(models); store.open(); }