Skip to main content
summaryrefslogtreecommitdiffstats
blob: a013572aa966c9baf3711cfab5a4da3442ad47bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*******************************************************************************
 * Copyright (c) 2001, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Jens Lukowski/Innoopract - initial renaming/restructuring
 *     
 *******************************************************************************/
package org.eclipse.wst.sse.core.internal.provisional.text;

import java.util.Iterator;

/**
 * ITextRegionList is to provide a list of regions. It can be used so clients
 * do not need to be aware of underlying implementation.
 */
public interface ITextRegionList {

	/**
	 * Adds region to the list.
	 * 
	 * For use by parsers and reparsers only, while list is being created.
	 * 
	 * @param region
	 * @return
	 */
	public boolean add(ITextRegion region);

	/**
	 * Adds new regions to the list.
	 * 
	 * For use by parsers and reparsers only, while list is being created.
	 * 
	 * @param insertPos
	 * @param newRegions
	 * @return
	 */
	public boolean addAll(int insertPos, ITextRegionList newRegions);

	/**
	 * Removes all regions from the list.
	 * 
	 * For use by parsers and reparsers only, while list is being created.
	 * 
	 */
	public void clear();


	/**
	 * Returns the region at <code>index</code>, where 0 is first one in
	 * the list. Throws an <code>ArrayIndexOutOfBoundsException</code> if
	 * list is empty, or if index is out of range.
	 * 
	 * @param index
	 * @return
	 */
	public ITextRegion get(int index);

	/**
	 * Returns the index of <code>region</code> or -1 if <code>region</code>
	 * is not in the list.
	 * 
	 * @param region
	 * @return
	 */
	public int indexOf(ITextRegion region);

	/**
	 * Returns true if list has no regions.
	 * 
	 * @return true if list has no regions.
	 */
	public boolean isEmpty();


	/**
	 * Returns an iterator for this list.
	 * 
	 * @return an iterator for this list.
	 */
	public Iterator iterator();

	/**
	 * Removes the region at index.
	 * 
	 * For use by parsers and reparsers only, while list is being created.
	 * 
	 */
	public ITextRegion remove(int index);

	/**
	 * Removes the region.
	 * 
	 * For use by parsers and reparsers only, while list is being created.
	 * 
	 */
	public void remove(ITextRegion region);


	/**
	 * Removes all regionList from this list.
	 * 
	 * For use by parsers and reparsers only, while list is being created.
	 * 
	 */
	public void removeAll(ITextRegionList regionList);

	/**
	 * Returns the size of the list.
	 * 
	 * @return the size of the list.
	 */
	public int size();


	/**
	 * Creates and returns the regions in an array. No assumptions should be
	 * made if the regions in the array are clones are same instance of
	 * original region.
	 * 
	 * ISSUE: do we need to specify if cloned copies or not?
	 * 
	 * @return an array of regions.
	 */
	public ITextRegion[] toArray();

}

Back to the top