Package org.rococoa.cocoa.foundation

Examples of org.rococoa.cocoa.foundation.NSArray.objectAtIndex()


                    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());
                        }
                    }
View Full Code Here


        NSArray array = NSArray.CLASS.arrayWithObjects(
                NSNumber.CLASS.numberWithInt(42),
                NSNumber.CLASS.numberWithInt(64)
        );
        assertEquals(2, array.count());
        NSNumber second = Rococoa.cast(array.objectAtIndex(1), NSNumber.class);
        assertEquals(64, second.intValue());
    }
   
}
View Full Code Here

     */
    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;
    }

    /** Determine whether any application is currently generating speech through
View Full Code Here

     */
    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;
    }

View Full Code Here

        }
        try {
            final NSArray nsArray = NSRunningApplication.CLASS.runningApplicationsWithBundleIdentifier(bundleIdentifier);
            final int size = nsArray.count();
            for (int i = 0; i < size; i++) {
                final NSRunningApplication nsRunningApplication = Rococoa.cast(nsArray.objectAtIndex(i), NSRunningApplication.class);

                // This double-check of the bundle identifier is probably unnecessary...
                if (bundleIdentifier.equals(nsRunningApplication.bundleIdentifier())) {
                    // We've found the application, so we can skip the rest of the loop
                    return nsRunningApplication.processIdentifier();
View Full Code Here

    }
    try {
      final NSArray nsArray = NSRunningApplication.CLASS.runningApplicationsWithBundleIdentifier(_bundleIdentifier);
      final int size = nsArray.count();
      for (int i = 0; i < size; i++) {
        final NSRunningApplication nsRunningApplication = Rococoa.cast(nsArray.objectAtIndex(i), NSRunningApplication.class);

        // This double-check of the bundle identifier is probably unnecessary...
        if (_bundleIdentifier.equals(nsRunningApplication.bundleIdentifier())) {
          boolean result = nsRunningApplication.activateWithOptions(0);
          debugLog.debug("nsRunningApplication.activateWithOptions returned {}", result);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.