public Iterable<JavaClassModel> findByJavaClassPattern(String regex) { ExecutionStatistics.get().begin("JavaClassService.findByJavaClassPattern(regex)"); Iterable<JavaClassModel> result = super.findAllByPropertyMatchingRegex("qualifiedName", regex); ExecutionStatistics.get().end("JavaClassService.findByJavaClassPattern(regex)"); return result; }
/** * Gets the instance associated with the current thread. */ public static synchronized ExecutionStatistics get() { Thread currentThread = Thread.currentThread(); if (stats.get(currentThread) == null) { stats.put(currentThread, new ExecutionStatistics()); } return stats.get(currentThread); }
@Override public boolean evaluate(final GraphRewrite event, final EvaluationContext context) { final String queryStr = toString(); return ExecutionStatistics.performBenchmarked(queryStr, new Task<Boolean>() { public Boolean execute() { Query.this.setInitialFramesSelector(createInitialFramesSelector(Query.this)); Iterable<? extends WindupVertexFrame> result = framesSelector.getFrames(event, context); if (resultFilter != null) { com.google.common.base.Predicate<WindupVertexFrame> guavaPred= new com.google.common.base.Predicate<WindupVertexFrame>() { @Override public boolean apply(WindupVertexFrame input) { return resultFilter.accept(input); } }; result = Iterables.filter(result, guavaPred); } setResults(event, getOutputVariablesName(), result); return result.iterator().hasNext(); } }); }
@Override public boolean evaluate(final GraphRewrite event, final EvaluationContext context) { final String queryStr = toString(); return ExecutionStatistics.performBenchmarked(queryStr, new Task<Boolean>() { public Boolean execute() { Query.this.setInitialFramesSelector(createInitialFramesSelector(Query.this)); Iterable<? extends WindupVertexFrame> result = framesSelector.getFrames(event, context); if (resultFilter != null) { com.google.common.base.Predicate<WindupVertexFrame> guavaPred= new com.google.common.base.Predicate<WindupVertexFrame>() { @Override public boolean apply(WindupVertexFrame input) { return resultFilter.accept(input); } }; result = Iterables.filter(result, guavaPred); } setResults(event, getOutputVariablesName(), result); return result.iterator().hasNext(); } }); }
/** * Find a {@link JavaClassModel} by the qualified name, returning a single result. If more than one result is available, a * {@link AmbiguousJavaClassModel} reference will be returned. */ public JavaClassModel getByName(String qualifiedName) throws NonUniqueResultException { ExecutionStatistics.get().begin("getUniqueByName(qualifiedName)"); JavaClassModel result = resolveByQualifiedName(qualifiedName); ExecutionStatistics.get().end("getUniqueByName(qualifiedName)"); return result; }
/** * Create a new instance of the given {@link WindupVertexFrame} type. The ID is generated by the underlying graph database. */ @Override public T create() { return ExecutionStatistics.performBenchmarked("GraphService.create", () -> context.getFramed().addFramedVertex(type)); }
/** * Gets the instance associated with the current thread. */ public static synchronized ExecutionStatistics get() { if (stats.get() == null) { stats.set(new ExecutionStatistics()); } return stats.get(); }
/** * Find a {@link JavaClassModel} by the qualified name, returning a single result. If more than one result is available, a * {@link AmbiguousJavaClassModel} reference will be returned. */ public JavaClassModel getByName(String qualifiedName) throws NonUniqueResultException { ExecutionStatistics.get().begin("getUniqueByName(qualifiedName)"); JavaClassModel result = resolveByQualifiedName(qualifiedName); ExecutionStatistics.get().end("getUniqueByName(qualifiedName)"); return result; }
/** * Create a new instance of the given {@link WindupVertexFrame} type. The ID is generated by the underlying graph database. */ @Override public T create() { return ExecutionStatistics.performBenchmarked("GraphService.create", () -> context.getFramed().addFramedVertex(type)); }
/** * Gets the instance associated with the current thread. */ public static synchronized ExecutionStatistics get() { Thread currentThread = Thread.currentThread(); if (stats.get(currentThread) == null) { stats.put(currentThread, new ExecutionStatistics()); } return stats.get(currentThread); }
/** * Find a {@link JavaClassModel} by the qualified name, returning a single result. If more than one result is available, a * {@link AmbiguousJavaClassModel} reference will be returned. */ public JavaClassModel getByName(String qualifiedName) throws NonUniqueResultException { ExecutionStatistics.get().begin("getUniqueByName(qualifiedName)"); JavaClassModel result = resolveByQualifiedName(qualifiedName); ExecutionStatistics.get().end("getUniqueByName(qualifiedName)"); return result; }
@Override public T addTypeToModel(final WindupVertexFrame model) { return ExecutionStatistics.performBenchmarked("GraphService.addTypeToModel", () -> GraphService.addTypeToModel(getGraphContext(), model, type)); }
public Iterable<JavaClassModel> findByJavaClassPattern(String regex) { ExecutionStatistics.get().begin("JavaClassService.findByJavaClassPattern(regex)"); Iterable<JavaClassModel> result = super.findAllByPropertyMatchingRegex("qualifiedName", regex); ExecutionStatistics.get().end("JavaClassService.findByJavaClassPattern(regex)"); return result; }
@Override public T addTypeToModel(final WindupVertexFrame model) { return ExecutionStatistics.performBenchmarked("GraphService.addTypeToModel", () -> GraphService.addTypeToModel(getGraphContext(), model, type)); }
public Iterable<JavaClassModel> findByJavaClassPattern(String regex) { ExecutionStatistics.get().begin("JavaClassService.findByJavaClassPattern(regex)"); Iterable<JavaClassModel> result = super.findAllByPropertyMatchingRegex("qualifiedName", regex); ExecutionStatistics.get().end("JavaClassService.findByJavaClassPattern(regex)"); return result; }
@Override public void remove(final T model) { ExecutionStatistics.performBenchmarked("GraphService.commit", () -> { model.getElement().remove(); return null; }); }
@Override public void remove(final T model) { ExecutionStatistics.performBenchmarked("GraphService.commit", () -> { model.getElement().remove(); return null; }); }
/** * Returns the list of most frequently hinted packages (based upon JavaInlineHintModel references) within the given ProjectModel. If recursive is * set to true, then also include child projects. * * nameDepth controls how many package levels to include (com.* vs com.example.* vs com.example.sub.*) */ public Map<String, Integer> getPackageUseFrequencies(ProjectModel projectModel, int nameDepth, boolean recursive) { ExecutionStatistics.get().begin("TypeReferenceService.getPackageUseFrequencies(projectModel,nameDepth,recursive)"); Map<String, Integer> packageUseCount = new HashMap<>(); getPackageUseFrequencies(packageUseCount, projectModel, nameDepth, recursive); ExecutionStatistics.get().end("TypeReferenceService.getPackageUseFrequencies(projectModel,nameDepth,recursive)"); return packageUseCount; }
@Override public List<T> findAllWithoutProperty(final String key, final Object value) { return ExecutionStatistics.performBenchmarked("GraphService.findAllWithoutProperty(" + key + ")", () -> { //return (List<T>)findAllQuery().traverse(g -> g.hasNot(key).or(g.has(key, P.neq(value)))).toList(type); return findAllQuery().getRawTraversal().not(__.has(key, P.eq(value))).toList() .stream() .map(v -> frame((Vertex)v)) .collect(Collectors.toList()); }); }