Package org.rococoa.cocoa.foundation

Examples of org.rococoa.cocoa.foundation.NSMutableArray


    public void setModificationDate(Date modificationDate) {
        setDate(ModificationDate, modificationDate);
    }

    public List<Entry> getPronunciations() {
        NSMutableArray pronounciations = getValueAsType(Pronunciations, NSMutableArray.class);
        List<Entry> result = new ArrayList<Entry>(pronounciations.count());
        for (int i=0; i < pronounciations.count(); i++) {
            result.add(new Entry(Rococoa.cast(pronounciations.objectAtIndex(i), NSMutableDictionary.class)));
        }
        return Collections.unmodifiableList(result);
    }
View Full Code Here


        }
        return Collections.unmodifiableList(result);
    }

    public void setPronunciations(List<Entry> pronounciations) {
        NSMutableArray pronounciationDicts = NSMutableArray.CLASS.arrayWithCapacity(pronounciations.size());
        for (Entry e : pronounciations) {
            pronounciationDicts.addObject(e.getData());
        }
        setValue(Pronunciations, pronounciationDicts);
    }
View Full Code Here

        }
        setValue(Pronunciations, pronounciationDicts);
    }
   
    public void addPronounciation(Entry pronounciation) {
        NSMutableArray pronounciations = getValueAsType(Pronunciations, NSMutableArray.class);
        if ( pronounciations == null ) {
            pronounciations = NSMutableArray.CLASS.arrayWithCapacity(1);
        }
        pronounciations.addObject(pronounciation.getData());
        setValue(Pronunciations, pronounciations);
    }
View Full Code Here

        pronounciations.addObject(pronounciation.getData());
        setValue(Pronunciations, pronounciations);
    }

    public List<Entry> getAbbreviations() {
        NSMutableArray abbreviations = getValueAsType(Abbreviations, NSMutableArray.class);
        List<Entry> result = new ArrayList<Entry>(abbreviations.count());
        for (int i=0; i < abbreviations.count(); i++) {
            result.add(new Entry(Rococoa.cast(abbreviations.objectAtIndex(i), NSMutableDictionary.class)));
        }
        return Collections.unmodifiableList(result);
    }
View Full Code Here

        }
        return Collections.unmodifiableList(result);
    }

    public void setAbbreviations(List<Entry> abbreviations) {
        NSMutableArray abbreviationDicts = NSMutableArray.CLASS.arrayWithCapacity(abbreviations.size());
        for (Entry e : abbreviations) {
            abbreviationDicts.addObject(e.getData());
        }
        setValue(Abbreviations, abbreviationDicts);
    }
View Full Code Here

        }
        setValue(Abbreviations, abbreviationDicts);
    }

    public void addAbbreviation(Entry abbreviation) {
        NSMutableArray abbreviations = getValueAsType(Abbreviations, NSMutableArray.class);
        if ( abbreviations == null ) {
            abbreviations = NSMutableArray.CLASS.arrayWithCapacity(1);
        }
        abbreviations.addObject(abbreviation.getData());
        setValue(Abbreviations, abbreviations);
    }
View Full Code Here

import org.rococoa.test.RococoaTestCase;

public class NSMutableArrayTest extends RococoaTestCase {

    @Test public void test() {
        NSMutableArray array = NSMutableArray.CLASS.arrayWithCapacity(3);
        assertEquals(0, array.count());
        array.addObject(NSString.stringWithString("Hello"));
        array.addObject("Goodbye");
        assertEquals(2, array.count());
        assertEquals("(\n    Hello,\n    Goodbye\n)", array.description());
       
        NSObject first = array.objectAtIndex(0);
        assertEquals(NSString.stringWithString("Hello"), first);
       
        NSString firstAsString = Rococoa.cast(first, NSString.class);
        assertEquals("Hello", firstAsString.toString());
        assertEquals("Goodbye",
                Rococoa.cast(array.objectAtIndex(1), NSString.class).toString());
    }  
View Full Code Here

TOP

Related Classes of org.rococoa.cocoa.foundation.NSMutableArray

Copyright © 2018 www.massapicom. 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.