KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > fix > PositionGroup


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.corext.fix;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.List JavaDoc;
15
16 import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition;
17
18 public class PositionGroup {
19
20     private final String JavaDoc fGroupId;
21     private final List JavaDoc/*<ITrackedNodePosition>*/ fPositions;
22     private final List JavaDoc/*<String>*/ fProposals;
23     private final List JavaDoc/*<String>*/ fDisplayStrings;
24     private ITrackedNodePosition fFirstPosition;
25     
26     public ITrackedNodePosition getFirstPosition() {
27         return fFirstPosition;
28     }
29
30     public PositionGroup(String JavaDoc groupID) {
31         fGroupId= groupID;
32         fPositions= new ArrayList JavaDoc();
33         fProposals= new ArrayList JavaDoc();
34         fDisplayStrings= new ArrayList JavaDoc();
35     }
36
37     public void addPosition(ITrackedNodePosition position) {
38         fPositions.add(position);
39     }
40     
41     public void addFirstPosition(ITrackedNodePosition position) {
42         addPosition(position);
43         fFirstPosition= position;
44     }
45
46     public void addProposal(String JavaDoc displayString, String JavaDoc proposal) {
47         fProposals.add(proposal);
48         fDisplayStrings.add(displayString);
49     }
50
51     public String JavaDoc getGroupId() {
52         return fGroupId;
53     }
54
55     public ITrackedNodePosition[] getPositions() {
56         return (ITrackedNodePosition[])fPositions.toArray(new ITrackedNodePosition[fPositions.size()]);
57     }
58
59     public String JavaDoc[] getDisplayStrings() {
60         return (String JavaDoc[])fDisplayStrings.toArray(new String JavaDoc[fDisplayStrings.size()]);
61     }
62
63     public String JavaDoc[] getProposals() {
64         return (String JavaDoc[])fProposals.toArray(new String JavaDoc[fProposals.size()]);
65     }
66 }
67
Popular Tags