KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > formatter > Location


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.formatter;
12
13 /**
14  * A location maintains positional information both in original source and in the output source.
15  * It remembers source offsets, line/column and indentation level.
16  * @since 2.1
17  */

18 public class Location {
19
20     public int inputOffset;
21     public int outputLine;
22     public int outputColumn;
23     public int outputIndentationLevel;
24     public boolean needSpace;
25     public boolean pendingSpace;
26     public int nlsTagCounter;
27     public int lastLocalDeclarationSourceStart;
28     public int numberOfIndentations;
29
30     // chunk management
31
public int lastNumberOfNewLines;
32     
33     // edits management
34
int editsIndex;
35     OptimizedReplaceEdit textEdit;
36     
37     public Location(Scribe scribe, int sourceRestart){
38         update(scribe, sourceRestart);
39     }
40     
41     public void update(Scribe scribe, int sourceRestart){
42         this.outputColumn = scribe.column;
43         this.outputLine = scribe.line;
44         this.inputOffset = sourceRestart;
45         this.outputIndentationLevel = scribe.indentationLevel;
46         this.lastNumberOfNewLines = scribe.lastNumberOfNewLines;
47         this.needSpace = scribe.needSpace;
48         this.pendingSpace = scribe.pendingSpace;
49         this.editsIndex = scribe.editsIndex;
50         this.nlsTagCounter = scribe.nlsTagCounter;
51         this.numberOfIndentations = scribe.numberOfIndentations;
52         textEdit = scribe.getLastEdit();
53     }
54 }
55
Popular Tags