Examples of NSArray


Examples of org.rococoa.cocoa.foundation.NSArray

    return movie;
    }
   
    @Test public void testGetTracks() throws Exception {
        QTMovie movie = loadMovie(testMovieFile);
        NSArray tracks = movie.tracks();
        assertEquals(2, tracks.count());
       
        NSArray pictureTracks = movie.tracksOfMediaType(QTMedia.QTMediaTypeVideo);
        assertEquals(1, pictureTracks.count());
       
        NSArray soundTracks = movie.tracksOfMediaType(QTMedia.QTMediaTypeSound);
        assertEquals(1, soundTracks.count());
       
        NSArray mpegTracks = movie.tracksOfMediaType(QTMedia.QTMediaTypeMPEG);
        assertEquals(0, mpegTracks.count());
    }
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

        return doWithAutoreleasePool(new Callable<List<Runnable>>() {
            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());
                        }
                    }
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

import org.rococoa.test.RococoaTestCase;

public class NSDictionaryTest extends RococoaTestCase {
   
    @Test public void testDictionaryWithObjects_forKeys() {
        NSArray objects = NSArray.CLASS.arrayWithObjects(
                NSString.stringWithString("string value"),
                NSNumber.CLASS.numberWithInt(42));
        NSArray keys = NSArray.CLASS.arrayWithObjects(
                NSString.stringWithString("string key"),
                NSString.stringWithString("int key"));
        NSDictionary dictionary = NSDictionary.dictionaryWithObjects_forKeys(objects, keys);
       
        check(dictionary);
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

import org.rococoa.test.RococoaTestCase;

public class NSArrayTest extends RococoaTestCase {

    @Test public void test() {
        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

Examples of org.rococoa.cocoa.foundation.NSArray

        NSDate anotherDate = NSDate.CLASS.dateWithTimeIntervalSince1970(40d);
        assertEquals(40, anotherDate.timeIntervalSince1970(), 0.000001f);       
    }
       
    @Test public void testVarags() {
        NSArray array = NSArray.CLASS.arrayWithObjects(
                NSNumber.CLASS.numberWithBool(true),
                NSNumber.CLASS.numberWithInt(42),
                NSDate.CLASS.dateWithTimeIntervalSince1970(666),
                null); // required by NSArray
        assertNotNull(array);
        assertFalse(array.id().isNull());
        assertEquals(3, array.count());
    }
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

        assertEquals(VoiceGender.Female, voice.getGender());
        assertEquals(NSVoice.VICKI, voice.getIdentifier());
        assertEquals(Locale.US.toString(), voice.getLocaleIdentifier());
        assertEquals("en-US", voice.getLanguage()); //deprecated method, but we test it anyway
        assertEquals("Vicki", voice.getName());
        NSArray supportedChars = voice.getSupportedCharacters();
        assertNotNull(supportedChars);
        assertTrue(supportedChars.count() > 0);
        NSArray individuallySpokenChars = voice.getIndividuallySpokenCharacters();
        assertNotNull(individuallySpokenChars);
        assertTrue(individuallySpokenChars.count() > 0);
    }
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

     */
    public final boolean register() {
        if (!registered) {
            // Construct our dictionary
            // Make the arrays of objects then keys
            NSArray objects = NSArray.CLASS.arrayWithObjects(
                    NSString.stringWithString(appName),
                    toNSArray(allNotes),
                    toNSArray(defNotes),
                    appImage != null ? appImage.TIFFRepresentation() : null
            );

            NSArray keys = NSArray.CLASS.arrayWithObjects(
                    NSString.stringWithString(GROWL_APP_NAME),
                    NSString.stringWithString(GROWL_NOTIFICATIONS_ALL),
                    NSString.stringWithString(GROWL_NOTIFICATIONS_DEFAULT),
                    appImage != null ? NSString.stringWithString(GROWL_APP_ICON) : null
            );
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

    /** 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;
    }
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

    /** 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;
    }
View Full Code Here

Examples of org.rococoa.cocoa.foundation.NSArray

        } catch (Throwable ex) {
            ex.printStackTrace(System.err);
            throw new RuntimeException("Unable to find program " + bundleIdentifier + " due to exception", ex);
        }
        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
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.