~ubuntu-branches/ubuntu/saucy/libtggraphlayout-java/saucy

« back to all changes in this revision

Viewing changes to com/touchgraph/graphlayout/TGException.java

  • Committer: Bazaar Package Importer
  • Author(s): Morten Sørensen
  • Date: 2009-12-06 17:57:32 UTC
  • Revision ID: james.westby@ubuntu.com-20091206175732-auvd39j1u30e0x50
Tags: upstream-122
Import upstream version 122

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * TouchGraph LLC. Apache-Style Software License
 
3
 *
 
4
 *
 
5
 * Copyright (c) 2001-2002 Alexander Shapiro. All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions
 
9
 * are met:
 
10
 *
 
11
 * 1. Redistributions of source code must retain the above copyright
 
12
 *    notice, this list of conditions and the following disclaimer. 
 
13
 *
 
14
 * 2. Redistributions in binary form must reproduce the above copyright
 
15
 *    notice, this list of conditions and the following disclaimer in
 
16
 *    the documentation and/or other materials provided with the
 
17
 *    distribution.
 
18
 *
 
19
 * 3. The end-user documentation included with the redistribution,
 
20
 *    if any, must include the following acknowledgment:  
 
21
 *       "This product includes software developed by 
 
22
 *        TouchGraph LLC (http://www.touchgraph.com/)."
 
23
 *    Alternately, this acknowledgment may appear in the software itself,
 
24
 *    if and wherever such third-party acknowledgments normally appear.
 
25
 *
 
26
 * 4. The names "TouchGraph" or "TouchGraph LLC" must not be used to endorse 
 
27
 *    or promote products derived from this software without prior written 
 
28
 *    permission.  For written permission, please contact 
 
29
 *    alex@touchgraph.com
 
30
 *
 
31
 * 5. Products derived from this software may not be called "TouchGraph",
 
32
 *    nor may "TouchGraph" appear in their name, without prior written
 
33
 *    permission of alex@touchgraph.com.
 
34
 *
 
35
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 
36
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
37
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
38
 * DISCLAIMED.  IN NO EVENT SHALL TOUCHGRAPH OR ITS CONTRIBUTORS BE 
 
39
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 
40
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 
41
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
 
42
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
 
43
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 
44
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 
45
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
46
 * ====================================================================
 
47
 *
 
48
 */
 
49
 
 
50
package com.touchgraph.graphlayout;
 
51
 
 
52
/** <p>An class for exceptions thrown during TouchGraph processing. </p>
 
53
  *
 
54
  * @author   Alexander Shapiro
 
55
  * @author   Murray Altheim
 
56
  * @version  1.22-jre1.1  $Id: TGException.java,v 1.1 2002/09/19 15:58:08 ldornbusch Exp $
 
57
  */
 
58
public class TGException extends Exception {
 
59
 
 
60
    /** An exception occurring when a Node already exists. */
 
61
    public final static int NODE_EXISTS       = 1;
 
62
 
 
63
    /** An exception occurring when a Node doesn't exist. */
 
64
    public final static int NODE_DOESNT_EXIST = 2;
 
65
 
 
66
    /** An exception occurring when a Node is missing its required ID. */
 
67
    public final static int NODE_NO_ID        = 3;
 
68
 
 
69
 
 
70
 
 
71
    /** An int containing an exception type identifier (ID). */
 
72
    protected int id = -1;
 
73
 
 
74
    /** The embedded Exception if tunnelling.
 
75
      * @serial The embedded exception if tunnelling, or null.
 
76
      */    
 
77
    public Exception exception = null;
 
78
    
 
79
    // .............
 
80
 
 
81
    /** Constructor for TGException with Exception ID.
 
82
      *
 
83
      * @param id The unique message identifier.
 
84
      */
 
85
    public TGException( int id ) 
 
86
    {
 
87
        super();
 
88
        this.id = id;
 
89
    }
 
90
 
 
91
    /** Constructor for TGException with Exception ID and error message String.
 
92
      *
 
93
      * @param id The unique message identifier.
 
94
      * @param message The Exception message.
 
95
      */
 
96
    public TGException( int id, String message ) 
 
97
    {
 
98
        super(message);
 
99
        this.id = id;
 
100
    }
 
101
 
 
102
    /** Constructor for TGException with an error message String.
 
103
      *
 
104
      * @param message The Exception message.
 
105
      */
 
106
    public TGException( String message ) 
 
107
    {
 
108
        super(message);
 
109
    }
 
110
 
 
111
    /** Constructor for TGException tunnelling the original Exception.
 
112
      *
 
113
      * @param exception The original Exception.
 
114
      */
 
115
    public TGException( Exception exception ) 
 
116
    {
 
117
        super();
 
118
        this.exception = exception;
 
119
    }
 
120
 
 
121
    /** If the message was expressed as a MessageId, return the original
 
122
      * id (e.g. "45"). 
 
123
      *
 
124
      * @return the exception identifier.
 
125
      */
 
126
    public int getId()
 
127
    {
 
128
        return id;
 
129
    }
 
130
 
 
131
} // end com.touchgraph.graphlayout.TGException