KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > editor > ObjectArray


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.editor;
21
22 /**
23  * Interface that allows to bridge various implementations
24  * of the arrays of objects (especially gap arrays).
25  * <p>Once an object implements this interface
26  * it's easy to build a list on top of it by using
27  * {@link org.netbeans.spi.lexer.util.LexerUtilities#createList(ObjectArray)}.
28  *
29  * @author Miloslav Metelka
30  * @version 1.00
31  */

32
33 public interface ObjectArray {
34
35     /** Get the item at the given index.
36      * @param index &gt;=0 and &lt;{@link #getItemCount()} index at which the item
37      * should be obtained.
38      * @return the item at the requested index.
39      * @throws IndexOutOfBoundsException if the index is &lt;0
40      * or &gt;={@link #getItemCount()}
41      */

42     public Object JavaDoc getItem(int index);
43     
44     /**
45      * @return &gt;=0 Number of items in the object array.
46      */

47     public int getItemCount();
48
49
50     /**
51      * Interface allowing more efficient getting of the objects
52      * from the object array. If the particular object array
53      * does not implement this interface then its items
54      * are accessed by {@link ObjectArray.getItem(int)} calls.
55      * The {@link ObjectArrayUtilities.copyItems(ObjectArray, int, int, Object[], int)}
56      * presents uniform access for obtaining of the items.
57      */

58     public interface CopyItems {
59         
60         /**
61          * Copy the items in the given index range from the object array into destination array.
62          * @param srcStartIndex index of the first item in the object array to get.
63          * @param srcEndIndex end index in the object array of the items to get.
64          * @param dest destination array of objects. The length of the array
65          * must be at least <CODE>destIndex + (srcEndIndex - srcStartIndex)</CODE>.
66          * @param destIndex first destination index at which the items are being stored.
67          */

68         public void copyItems(int srcStartIndex, int srcEndIndex,
69         Object JavaDoc[] dest, int destIndex);
70
71     }
72
73
74     public interface Modification {
75
76         public ObjectArray getArray();
77
78         public int getIndex();
79
80         public Object JavaDoc[] getAddedItems();
81
82         public int getRemovedItemsCount();
83     }
84
85 }
86
Popular Tags