initial load
[DTRules.git] / DTRules / src / main / java / com / dtrules / decisiontables / DTNode.java
blobf18eb9337d99b16679a3378a3e03ac00ef09bfc4
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 */
19 package com.dtrules.decisiontables;
21 import com.dtrules.infrastructure.RulesException;
22 import com.dtrules.session.DTState;
24 public interface DTNode {
25 static class Coordinate {
26 int row;
27 int col;
28 Coordinate(int row, int col){
29 this.row = row;
30 this.col = col;
32 public int getCol() {
33 return col;
35 public void setCol(int col) {
36 this.col = col;
38 public int getRow() {
39 return row;
41 public void setRow(int row) {
42 this.row = row;
46 public int getRow();
48 /**
49 * Returns a clone of this node, and all nodes below (if it
50 * has subnodes).
51 * @return
53 public DTNode cloneDTNode();
55 public int countColumns();
57 void execute(DTState state) throws RulesException;
58 Coordinate validate();
60 /**
61 * For two DTNodes are equal if every path through both nodes
62 * execute exactly the same set of Actions.
63 * @param node
64 * @return
66 boolean equalsNode(DTNode node);
67 /**
68 * Returns an ANode which represents the execution of every
69 * path through the given DTNode. If different paths through
70 * the DTNode execute different actions, this method returns
71 * a null. Note that ANodes always return themselves (i.e.
72 * there is only one execution path through an ANode).
74 ANode getCommonANode();