01: /*BEGIN_COPYRIGHT_BLOCK
02: *
03: * Copyright (c) 2001-2007, JavaPLT group at Rice University (javaplt@rice.edu)
04: * All rights reserved.
05: *
06: * Redistribution and use in source and binary forms, with or without
07: * modification, are permitted provided that the following conditions are met:
08: * * Redistributions of source code must retain the above copyright
09: * notice, this list of conditions and the following disclaimer.
10: * * Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
14: * names of its contributors may be used to endorse or promote products
15: * derived from this software without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28: *
29: * This software is Open Source Initiative approved Open Source Software.
30: * Open Source Initative Approved is a trademark of the Open Source Initiative.
31: *
32: * This file is part of DrJava. Download the current version of this project
33: * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
34: *
35: * END_COPYRIGHT_BLOCK*/
36:
37: package edu.rice.cs.drjava.model.definitions.reducedmodel;
38:
39: /** Indent information block.
40: * @version $Id: IndentInfo.java 4255 2007-08-28 19:17:37Z mgricken $
41: */
42: public class IndentInfo {
43: public String braceType; //the type of brace at the beginning of our line
44:
45: //the distance to the start of the line containing
46: //the brace that encloses the start of our line.
47: //____\n|_____
48: public int distToNewline;
49:
50: //distance to the brace enclosing the start of our line ____|{_____
51: public int distToBrace;
52:
53: // type of brace at current position
54: public String braceTypeCurrent;
55:
56: // distance to the start of the line containing the brace enclosing the current location
57: public int distToNewlineCurrent;
58:
59: // distance to the brace enclosing the current location
60: public int distToBraceCurrent;
61:
62: //the distance to the start of the current line
63: public int distToPrevNewline;
64:
65: static public final String noBrace = "";
66: static public final String openSquiggly = "{";
67: static public final String openParen = "(";
68: static public final String openBracket = "[";
69:
70: /**
71: * Creates an IndentInfo with default values.
72: */
73: public IndentInfo() {
74: braceType = noBrace;
75: distToNewline = -1;
76: distToBrace = -1;
77: braceTypeCurrent = noBrace;
78: distToNewlineCurrent = -1;
79: distToBraceCurrent = -1;
80: }
81:
82: /** Creates an indent info with the specified parameters
83: * @param _braceType the braceType
84: * @param _distToNewline the distance to the next newline
85: * @param _distToBrace the distance to a brace
86: * @param _distToPrevNewline the distance to the previous newline
87: */
88: public IndentInfo(String _braceType, int _distToNewline,
89: int _distToBrace, int _distToPrevNewline) {
90: braceType = _braceType;
91: distToNewline = _distToNewline;
92: distToBrace = _distToBrace;
93: distToPrevNewline = _distToPrevNewline;
94: }
95: }
|