1 /*******************************************************************************
2 * Copyright (c) 2000, 2012 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15
16 public class NSArray extends NSObject {
17
NSArray()18 public NSArray() {
19 super();
20 }
21
NSArray(long id)22 public NSArray(long id) {
23 super(id);
24 }
25
NSArray(id id)26 public NSArray(id id) {
27 super(id);
28 }
29
array()30 public static NSArray array() {
31 long result = OS.objc_msgSend(OS.class_NSArray, OS.sel_array);
32 return result != 0 ? new NSArray(result) : null;
33 }
34
arrayWithObject(id anObject)35 public static NSArray arrayWithObject(id anObject) {
36 long result = OS.objc_msgSend(OS.class_NSArray, OS.sel_arrayWithObject_, anObject != null ? anObject.id : 0);
37 return result != 0 ? new NSArray(result) : null;
38 }
39
containsObject(id anObject)40 public boolean containsObject(id anObject) {
41 return OS.objc_msgSend_bool(this.id, OS.sel_containsObject_, anObject != null ? anObject.id : 0);
42 }
43
count()44 public long count() {
45 return OS.objc_msgSend(this.id, OS.sel_count);
46 }
47
indexOfObjectIdenticalTo(id anObject)48 public long indexOfObjectIdenticalTo(id anObject) {
49 return OS.objc_msgSend(this.id, OS.sel_indexOfObjectIdenticalTo_, anObject != null ? anObject.id : 0);
50 }
51
objectAtIndex(long index)52 public id objectAtIndex(long index) {
53 long result = OS.objc_msgSend(this.id, OS.sel_objectAtIndex_, index);
54 return result != 0 ? new id(result) : null;
55 }
56
57 }
58