4 * Copyright 2004-2007 MTBJ, Inc.
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
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.
19 package com
.dtrules
.interpreter
;
22 import java
.util
.ArrayList
;
23 import java
.util
.Date
;
24 import java
.util
.HashMap
;
26 import com
.dtrules
.entity
.IREntity
;
27 import com
.dtrules
.infrastructure
.RulesException
;
28 import com
.dtrules
.mapping
.XMLTag
;
29 import com
.dtrules
.session
.DTState
;
30 import com
.dtrules
.session
.IRSession
;
32 @SuppressWarnings({"unchecked"})
33 public interface IRObject
{
35 public IRObject
clone(IRSession s
) throws RulesException
;
37 // *************** NOTE !!!!!!
38 // You can't put static methods on an interface. So the String to integer conversion
39 // for types is a static method on the RSession class.
41 final String rBoolean
= "boolean",
48 rDecisiontable
= "decisiontable",
51 rOperator
= "operator",
54 rXmlValue
= "xmlvalue";
56 final String types
[] = { rBoolean
, rString
, rInteger
, rFloat
,
57 rEntity
, rName
, rArray
, rDecisiontable
,
58 rNull
, rMark
, rOperator
, rTime
,
61 final int iBoolean
= 0,
77 void execute(DTState state
) throws RulesException
;
79 public IRObject
getExecutable();
81 public IRObject
getNonExecutable();
83 public boolean equals(IRObject o
) throws RulesException
;
85 public boolean isExecutable();
88 * By default, the toString() method for most Objects should provide
89 * a representation of the object that can be used as the postFix value.
90 * The stringValue should provide simply the data for the object. Thus
91 * If I want to append the a String and a Date to create a new string,
92 * I should append the results from their stringValue() implementation.
94 * If I needed the postfix (and thus the quotes and maybe other ) then
95 * call postFix(). But if the postFix is going to match either stringValue()
96 * or toString, it is going to match toString().
100 public String
stringValue();
101 public RString
rStringValue();
103 public String
postFix();
107 public IRObject
rclone();
109 public XMLTag
xmlTagValue() throws RulesException
;
110 public long longValue () throws RulesException
;
111 public int intValue () throws RulesException
;
112 public RInteger
rIntegerValue() throws RulesException
;
113 public double doubleValue () throws RulesException
;
114 public RDouble
rDoubleValue() throws RulesException
;
115 public ArrayList
<IRObject
> arrayValue () throws RulesException
;
116 public RArray
rArrayValue() throws RulesException
;
117 public boolean booleanValue () throws RulesException
;
118 public RBoolean
rBooleanValue() throws RulesException
;
119 public HashMap
hashMapValue () throws RulesException
;
120 public RXmlValue
rXmlValue () throws RulesException
;
121 public IREntity
rEntityValue () throws RulesException
;
122 public RName
rNameValue () throws RulesException
;
123 public RTime
rTimeValue () throws RulesException
;
124 public Date
timeValue () throws RulesException
;
125 public RTable
rTableValue() throws RulesException
;
126 public HashMap
tableValue() throws RulesException
;
127 public int compare(IRObject irObject
) throws RulesException
;