public void checkTimer() { _completionTimer.ifPresent(t -> t.check()); }
public void checkTimer() { _completionTimer.ifPresent(t -> t.check()); }
public void checkTimer(final String name) { getTimer(name).orElseThrow(() -> _doesNotExist.apply(name))// .check(); }
public void checkTimer(final String name) { getTimer(name).orElseThrow(() -> _doesNotExist.apply(name))// .check(); }
protected boolean classify(final List<ATermAppl> phase, final boolean requireTopSearch) { final boolean useThreads = false; if (useThreads) phase.parallelStream()// .forEach(c -> // {// System.out.println(Thread.currentThread().getName() + " Classify on " + c + " [begin]"); classify(c, requireTopSearch); _monitor.incrementProgress(); _kb.getTimers().getTimer("classify").ifPresent(t -> t.check()); System.out.println(Thread.currentThread().getName() + " Classify on " + c + " [ end ]"); }); else for (final ATermAppl c : phase) { _logger.fine(() -> "Classify (" + _taxonomyImpl.getNodes().size() + ") " + format(c) + "..."); classify(c, requireTopSearch); _monitor.incrementProgress(); _kb.getTimers().getTimer("classify").ifPresent(t -> t.check()); if (_monitor.isCanceled()) return false; } return true; }
protected boolean classify(final List<ATermAppl> phase, final boolean requireTopSearch) { final boolean useThreads = false; if (useThreads) phase.parallelStream()// .forEach(c -> // {// System.out.println(Thread.currentThread().getName() + " Classify on " + c + " [begin]"); classify(c, requireTopSearch); _monitor.incrementProgress(); _kb.getTimers().getTimer("classify").ifPresent(t -> t.check()); System.out.println(Thread.currentThread().getName() + " Classify on " + c + " [ end ]"); }); else for (final ATermAppl c : phase) { _logger.fine(() -> "Classify (" + _taxonomyImpl.getNodes().size() + ") " + format(c) + "..."); classify(c, requireTopSearch); _monitor.incrementProgress(); _kb.getTimers().getTimer("classify").ifPresent(t -> t.check()); if (_monitor.isCanceled()) return false; } return true; }
public void addBranch(final Branch newBranch) { _abox.getBranches().add(newBranch); if (newBranch.getBranchIndexInABox() != _abox.getBranches().size()) throw new OpenError("Invalid branch created: " + newBranch.getBranchIndexInABox() + " != " + _abox.getBranches().size()); _completionTimer.ifPresent(t -> t.check()); // CHW - added for incremental deletion support if (OpenlletOptions.USE_INCREMENTAL_DELETION) _abox.getKB().getDependencyIndex().addBranchAddDependency(newBranch); }
public void addBranch(final Branch newBranch) { _abox.getBranches().add(newBranch); if (newBranch.getBranchIndexInABox() != _abox.getBranches().size()) throw new OpenError("Invalid branch created: " + newBranch.getBranchIndexInABox() + " != " + _abox.getBranches().size()); _completionTimer.ifPresent(t -> t.check()); // CHW - added for incremental deletion support if (OpenlletOptions.USE_INCREMENTAL_DELETION) _abox.getKB().getDependencyIndex().addBranchAddDependency(newBranch); }
private boolean realizeByConcepts() { if (null == _classes) // This occur only on concurrent environment that involve read / write / classification at same time; a correct handling require to create a state-less KnowledgeBase. classify(); _monitor.setProgressLength(_classes.size() + 2); _monitor.taskStarted(); clearMarks(); final Collection<ATermAppl> individuals = _kb.getIndividuals(); if (!individuals.isEmpty()) realizeByConcept(ATermUtils.TOP, individuals); _kb.getTimers().getTimer("realize").ifPresent(t -> t.check()); if (_monitor.isCanceled()) return false; _monitor.taskFinished(); return true; }
private boolean realizeByIndividuals() { _monitor.setProgressLength(_kb.getIndividuals().size()); _monitor.taskStarted(); final Iterator<Individual> i = _kb.getABox().getIndIterator(); for (int count = 0; i.hasNext(); count++) { final Individual x = i.next(); _monitor.incrementProgress(); _kb.getTimers().getTimer("realize").ifPresent(t -> t.check()); if (_monitor.isCanceled()) return false; if (_logger.isLoggable(Level.FINER)) _logger.finer(count + ") Realizing " + format(x.getName()) + " "); realize(x); } _monitor.taskFinished(); return true; }
/** * Check if the elapsed time is greater than the timeout limit and throw a TimeoutException if that is the case. Check the parent timer if there is one. * * @throws TimeoutException * @throws TimerInterruptedException */ public void check() throws TimeoutException, TimerInterruptedException { if (interrupted) { interrupted = false; throw new TimerInterruptedException("Timer " + getName() + " interrupted."); } final long elapsed = getElapsed(); if (_timeout != NO_TIMEOUT && elapsed > _timeout) throw new TimeoutException("Running time of " + _name + " exceeded timeout of " + _timeout); if (_parent != null) _parent.check(); }
/** * Check if the elapsed time is greater than the timeout limit and throw a TimeoutException if that is the case. Check the parent timer if there is one. * * @throws TimeoutException * @throws TimerInterruptedException */ public void check() throws TimeoutException, TimerInterruptedException { if (interrupted) { interrupted = false; throw new TimerInterruptedException("Timer " + getName() + " interrupted."); } final long elapsed = getElapsed(); if (_timeout != NO_TIMEOUT && elapsed > _timeout) throw new TimeoutException("Running time of " + _name + " exceeded timeout of " + _timeout); if (_parent != null) _parent.check(); }
private boolean realizeByIndividuals() { _monitor.setProgressLength(_kb.getIndividuals().size()); _monitor.taskStarted(); final Iterator<Individual> i = _kb.getABox().getIndIterator(); for (int count = 0; i.hasNext(); count++) { final Individual x = i.next(); _monitor.incrementProgress(); _kb.getTimers().getTimer("realize").ifPresent(t -> t.check()); if (_monitor.isCanceled()) return false; if (_logger.isLoggable(Level.FINER)) _logger.finer(count + ") Realizing " + format(x.getName()) + " "); realize(x); } _monitor.taskFinished(); return true; }
private boolean realizeByConcepts() { if (null == _classes) // This occur only on concurrent environment that involve read / write / classification at same time; a correct handling require to create a state-less KnowledgeBase. classify(); _monitor.setProgressLength(_classes.size() + 2); _monitor.taskStarted(); clearMarks(); final Collection<ATermAppl> individuals = _kb.getIndividuals(); if (!individuals.isEmpty()) realizeByConcept(ATermUtils.TOP, individuals); _kb.getTimers().getTimer("realize").ifPresent(t -> t.check()); if (_monitor.isCanceled()) return false; _monitor.taskFinished(); return true; }
_completionTimer.ifPresent(t -> t.check());
_completionTimer.ifPresent(t -> t.check());
return Collections.emptySet(); _kb.getTimers().getTimer("realize").ifPresent(t -> t.check());
return Collections.emptySet(); _kb.getTimers().getTimer("realize").ifPresent(t -> t.check());
while (!branchFound) _completionTimer.ifPresent(t -> t.check());
while (!branchFound) _completionTimer.ifPresent(t -> t.check());