1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.formatter.align;
14 * Exception used to backtrack and break available alignments
15 * When the exception is thrown, it is assumed that some alignment will be changed.
19 public class AlignmentException extends RuntimeException {
21 public static final int LINE_TOO_LONG = 1;
22 public static final int ALIGN_TOO_SMALL = 2;
26 public int relativeDepth;
28 public AlignmentException(int reason, int relativeDepth) {
29 this(reason, 0, relativeDepth);
32 public AlignmentException(int reason, int value, int relativeDepth) {
35 this.relativeDepth = relativeDepth;
38 public String toString(){
39 StringBuffer buffer = new StringBuffer(10);
42 buffer.append("LINE_TOO_LONG"); //$NON-NLS-1$
44 case ALIGN_TOO_SMALL :
45 buffer.append("ALIGN_TOO_SMALL"); //$NON-NLS-1$
49 .append("<relativeDepth: ") //$NON-NLS-1$
50 .append(this.relativeDepth)
51 .append(">\n"); //$NON-NLS-1$
52 return buffer.toString();