initial load
[DTRules.git] / DTRules / src / main / java / com / dtrules / session / ICompilerError.java
blobb445e1c03cc6735cf2f6217657128e3f7401c170
1 /*
2 * $Id$
3 *
4 * Copyright 2004-2007 MTBJ, Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package com.dtrules.session;
20 /**
21 * ICompilerError defines a linked list of errors generated when compiling
22 * a decision table. The error types are:
23 * <br><br>
24 * 1 -- Condition <br>
25 * 2 -- Action <br>
26 * 3 -- Table <br>
27 * 4 -- InitialAction <br>
28 * 5 -- Context <br>
29 * <br><br>
30 * @author paul snow
31 * Feb 20, 2007
34 public interface ICompilerError {
36 enum Type { CONDITION, ACTION, TABLE, INITIALACTION, CONTEXT};
38 /**
39 * Returns the Error type, which will be a 1 if the error was in the
40 * compilation of a Condition, a 2 if the error was in the compliation
41 * of an Action, or a 3 if it was in building the Table.
42 * @return ErrorTypeNumber
44 Type getErrorType();
45 /**
46 * Returns the text provided the compiler which generated the error. If
47 * the error type is a 3, this function returns null.
48 * @return Source code of error
50 String getSource();
51 /**
52 * Returns an error message explaining the error.
53 * @return message explaining the error
55 String getMessage();
56 /**
57 * Returns the index (1 based) of the condition that triggered the error.
58 * Returns a value > 0 if compling a condition caused the error, and a
59 * zero otherwise. Error types 2 and 3 will always return zero.
60 * @return index of condition
62 int getConditionIndex();
63 /**
64 * Returns the index (1 based) of the action that triggered the error.
65 * Returns a value > 0 if compling an action caused the error, and a zero
66 * otherwise. Error types 1 and 3 will always return zero.
67 * @return index of action
69 int getActionIndex();
70 /**
71 * Really, we should toss the getConditionIndex and getActionIndex in
72 * favor of a getIndex which returns a 1 or greater for valid indexes,
73 * and a zero otherwise. Use the errorType to decide if this is an
74 * index into InitialActions, Conditions, or Actions.
76 int getIndex();
77 /**
78 * If the error was due to an unbalanced decision table, this funciton
79 * returns the row in the condition table where the error was detected.
80 * @return row index of error
82 int getRow();
83 /**
84 * If the error was due to an unbalanced decision table, this funciton
85 * returns the column in the condition table where the error was detected.
86 * @return column index of error
88 int getCol();