KickJava   Java API By Example, From Geeks To Geeks.

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


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 Location2 {
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 numberOfIndentations;
28
29     // chunk management
30
public int lastNumberOfNewLines;
31     
32     // edits management
33
int editsIndex;
34     OptimizedReplaceEdit textEdit;
35     
36     public Location2(Scribe2 scribe, int sourceRestart){
37         update(scribe, sourceRestart);
38     }
39     
40     public void update(Scribe2 scribe, int sourceRestart){
41         this.outputColumn = scribe.column;
42         this.outputLine = scribe.line;
43         this.inputOffset = sourceRestart;
44         this.outputIndentationLevel = scribe.indentationLevel;
45         this.lastNumberOfNewLines = scribe.lastNumberOfNewLines;
46         this.needSpace = scribe.needSpace;
47         this.pendingSpace = scribe.pendingSpace;
48         this.editsIndex = scribe.editsIndex;
49         this.nlsTagCounter = scribe.nlsTagCounter;
50         this.numberOfIndentations = scribe.numberOfIndentations;
51         textEdit = scribe.getLastEdit();
52     }
53 }
54
Popular Tags