/** Get a list of all available voices * @return a list of available voices */ public static List<NSVoice> availableVoices() { NSArray availableVoices = CLASS.availableVoices(); List<NSVoice> result = new ArrayList<NSVoice>(availableVoices.count()); for (int i=0; i < availableVoices.count(); i++) { result.add(new NSVoice(CLASS.attributesForVoice(availableVoices.objectAtIndex(i).toString()))); } return result; }
/** Get a list of phonemes the synthesizer uses * @return information about the phonemes the synthesizer uses */ public List<NSSpeechPhonemeInfo> getPhonemeInfo() { NSArray infos = Rococoa.cast(getProperty(SpeechProperty.PhonemeSymbolsProperty), NSArray.class); List<NSSpeechPhonemeInfo> result = new ArrayList<NSSpeechPhonemeInfo>(infos.count()); for(int i=0; i < infos.count(); i++) { NSDictionary phonemeInfo = Rococoa.cast(infos.objectAtIndex(i), NSDictionary.class); result.add(new NSSpeechPhonemeInfo(NSMutableDictionary.dictionaryWithDictionary(phonemeInfo))); } return result; }
public List<Runnable> call() { try { shutdownLock.lock(); state = State.SHUTDOWN; NSArray queuedTasks = queue.operations(); List<Runnable> result = new ArrayList<Runnable>(queuedTasks.count()); for(int i = 0; i < queuedTasks.count(); i++) { NSOperation o = Rococoa.cast(queuedTasks.objectAtIndex(i), NSOperation.class); InvocationFutureTask<?> task = tasks.get(o.id()); if(task != null && !(o.isFinished() || o.isCancelled())) { result.add(task.getOriginalRunnable()); } } queue.cancelAllOperations(); tasks.clear(); terminateIfDone(queue.operationCount().intValue() == 0); return result; } finally { shutdownLock.unlock(); } } });
public List<Runnable> call() { try { shutdownLock.lock(); state = State.SHUTDOWN; NSArray queuedTasks = queue.operations(); List<Runnable> result = new ArrayList<Runnable>(queuedTasks.count()); for (int i = 0; i < queuedTasks.count(); i++) { NSOperation o = Rococoa.cast(queuedTasks.objectAtIndex(i), NSOperation.class); InvocationFutureTask<?> task = tasks.get(o.id()); if ( task != null && !(o.isFinished() || o.isCancelled()) ) { result.add(task.getOriginalRunnable()); } } queue.cancelAllOperations(); tasks.clear(); terminateIfDone(queue.operationCount().intValue() == 0); return result; } finally { shutdownLock.unlock(); } } });