01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.internal.provisional.views.markers;
11:
12: import org.eclipse.core.resources.IMarker;
13:
14: /**
15: * The MarkerMap is a helper class that manages the mapping between a set of
16: * {@link IMarker} and thier {@link MarkerEntry} wrappers.
17: * @since 3.4
18: *
19: */
20: class MarkerMap {
21:
22: static final MarkerMap EMPTY_MAP = new MarkerMap();
23: private MarkerEntry[] markers;
24:
25: /**
26: * Creates an initially empty marker map
27: */
28: public MarkerMap() {
29: this (new MarkerEntry[0]);
30: }
31:
32: /**
33: * Create an instance of the receiver from markers.
34: * @param markers
35: */
36:
37: public MarkerMap(MarkerEntry[] markers) {
38: this .markers = markers;
39: }
40:
41: /**
42: * Get the size of the entries
43: * @return
44: */
45: public int getSize() {
46: return markers.length;
47: }
48:
49: /**
50: * Return the entries as an array.
51: * @return MarkerEntry[]
52: */
53: public MarkerEntry[] toArray() {
54: return markers;
55: }
56:
57: /**
58: * Return the entry at index
59: * @param index
60: * @return MarkerEntry
61: */
62: public MarkerEntry elementAt(int index) {
63: return markers[index];
64: }
65:
66: }
|